Problem with analysing SIP headers


I have been trying to analyze Zeek SIP headers and so far I can perform the following code succesfully on the .pcap file :

event sip_header(c: connection, is_orig: bool, name: string, value: string){ print “sip”; print c; print value; } event sip_all_headers(c: connection, is_orig: bool, hlist: mime_header_list){ print “sip”; }
The issue comes up when I generate the SIP traffic in Python using Scapy, in the following way:

from telnetlib import IP
from scapy.all import *
from scapy.layers.inet import UDP

sourcePort = 3001
destinationIp = “”
sourceIp = “”
ip=IP(src=sourceIp, dst=destinationIp)

TCP PSH+ACK with Payload

‘INVITE sip:{0}:5060;transport=tcp SIP/2.0\r\n’
‘Via: SIP/2.0/TCP;branch=1234\r\n’
‘From: “somedevice”<sip:somedevice@>;tag=5678\r\n’
‘To: sip:{0}:5060\r\n’
‘Call-ID: 9abcd\r\n’
‘CSeq: 1 INVITE\r\n’
‘Max-Forwards: 70\r\n’
‘Content-Length: 0\r\n\r\n’).format(destinationIp)
layer4 = UDP(dport = 5060,sport = sourcePort)

After running the code, there is no output result in Zeek. Even though in Wireshark everything seems to be working - I can observe the SIP traffic. What do you think may cause this problem?



It works for me. I modified your script as follows:

< send(ip/layer4/myPayload)

wrpcap(‘sip.pcap’, Ether()/ip/layer4/myPayload)

This causes scapy to just write the PCAP instead of sending it. Then, I uploaded that PCAP here:

You can see your output, and if you scroll down, you can see a sip.log file with the relevant info.

How are you capturing the PCAP? I’m betting that you have an incorrect checksum, which causes Zeek to discard those packets. You’d get a warning for TCP traffic, but not for UDP.


Yes the problem is connected with the incorrect checksum. When I have ran the Zeek with -C flag it worked well.