Skip to content

Commit

Permalink
Reserialize the packet's raw bytes to pick up any layer changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Crosse committed Mar 13, 2024
1 parent 4935a8c commit 696ee65
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions actions/tamper_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,13 @@ func (a *TCPTamperAction) Apply(packet gopacket.Packet) ([]gopacket.Packet, erro
}
}

sb := gopacket.NewSerializeBuffer()
err := gopacket.SerializePacket(sb, gopacket.SerializeOptions{}, packet)
if err != nil {
panic(err)
}
packet = gopacket.NewPacket(sb.Bytes(), layers.LayerTypeEthernet, gopacket.Default)

return a.Action.Apply(packet)
}

Expand Down

0 comments on commit 696ee65

Please sign in to comment.