I need a software that sniffs packets and records packet type (UDP or TCP), the sending port or receiving port of the packet, and the sending time and receiving time of the packet. I also need to run that software for a certain number of seconds and be able to export the data into comma separated values (CMV) file or something similiar. Any suggestions? I need this data for a python program I am building.
1 Answer
Your best bet is scapy which is itself python based. Runs on Python 2.7 & 3.4-3.8 is installable on Linux, Windows & OS-X.
It allows packet capture, sniffing, (and injection), gives you the send & destination ports, timestamps & more, can be run for a fixed time or number of packets and has multiple export options and you can easily write the required packet data to a .csv file. There are even options for graphical output: