From c66e87e4b75e4e2890fa46566983d20aa7728f22 Mon Sep 17 00:00:00 2001 From: Alexandr Dubovikov Date: Fri, 29 Sep 2023 10:07:25 +0200 Subject: [PATCH 1/2] fix for sipassembly --- decoder/decoder.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/decoder/decoder.go b/decoder/decoder.go index db7c620..cb73f40 100644 --- a/decoder/decoder.go +++ b/decoder/decoder.go @@ -3,13 +3,14 @@ package decoder import ( "bytes" "container/list" - "github.com/segmentio/encoding/json" "net" "strconv" "strings" "sync/atomic" "time" + "github.com/segmentio/encoding/json" + "github.com/google/gopacket" "github.com/google/gopacket/layers" "github.com/google/gopacket/tcpassembly" @@ -932,7 +933,6 @@ func (d *Decoder) processTransport(foundLayerTypes *[]gopacket.LayerType, udp *l case layers.LayerTypeTCP: pkt.SrcPort = uint16(tcp.SrcPort) pkt.DstPort = uint16(tcp.DstPort) - //pkt.Payload = tcp.Payload atomic.AddUint64(&d.tcpCount, 1) logp.Debug("payload", "TCP", pkt) @@ -947,12 +947,15 @@ func (d *Decoder) processTransport(foundLayerTypes *[]gopacket.LayerType, udp *l if !checkResult || payloadList.Len() <= 0 { return } - } else { + payloadList.PushBack(pkt.Payload) - } - for elem := payloadList.Front(); elem != nil; elem = elem.Next() { - extractCID(pkt.SrcIP, pkt.SrcPort, pkt.DstIP, pkt.DstPort, elem.Value.([]byte)) + for elem := payloadList.Front(); elem != nil; elem = elem.Next() { + extractCID(pkt.SrcIP, pkt.SrcPort, pkt.DstIP, pkt.DstPort, elem.Value.([]byte)) + } + } else { + pkt.Payload = tcp.Payload + extractCID(pkt.SrcIP, pkt.SrcPort, pkt.DstIP, pkt.DstPort, pkt.Payload) } case layers.LayerTypeSCTP: pkt.SrcPort = uint16(sctp.SrcPort) From 275f6a8f57afabd733cd49dd09ea51de86940c4f Mon Sep 17 00:00:00 2001 From: Alexandr Dubovikov Date: Fri, 29 Sep 2023 16:08:15 +0200 Subject: [PATCH 2/2] fix for sipassembly --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 0036489..1a1f864 100644 --- a/main.go +++ b/main.go @@ -12,7 +12,7 @@ import ( "github.com/sipcapture/heplify/sniffer" ) -const version = "heplify 1.65.10" +const version = "heplify 1.65.11" func createFlags() {