Python code for read/write binary file and convert it to .pcap

29 views Asked by At

I want to write a python script that reads a binary file (have no extension but when open in hex viewer software, IPv4 packets presents), search 45 in file, reads 3rd and 4th byte for determining the length of IP packet, then write all the packet in other file. Repeat all this until file completely reads. Save the new file. After that, the new saved file should be converted into pcap by using text2pcap utility.

When I use text2pcap utility, it reads the expected packets in that binary file but wrote 0 packets. I want to convert this binary file into pcap for further analysis by using wireshark as I know that IPv4 packets presents in it without any header of IPv4 and ethernet headers.

0

There are 0 answers