From 696ee656e067ad24c3d7fb20a4edbaed3f094910 Mon Sep 17 00:00:00 2001 From: Seth Wright Date: Wed, 13 Mar 2024 16:31:16 -0400 Subject: [PATCH] Reserialize the packet's raw bytes to pick up any layer changes --- actions/tamper_action.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/actions/tamper_action.go b/actions/tamper_action.go index 815adf8..07c13fc 100644 --- a/actions/tamper_action.go +++ b/actions/tamper_action.go @@ -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) }