I have searched my questions a lot but I couldn't find any solutions, so here's my questions:
I have exported some txt files from pcap files using wireshark. I can also see this output using pkt.hexdump() from scapy module. I want to read the hex part and convert it into binary sequences.
As you can see in the image the file contains other characters such as ASCII that it's not needed. I know how to get an hex input from user or a file containing only hex and convert it, but I don't know how to deal with these files.
I also don't know if it's possible to convert pcap files to binary directly.
I have exported some txt files from pcap files using wireshark. I can also see this output using pkt.hexdump() from scapy module. I want to read the hex part and convert it into binary sequences.
As you can see in the image the file contains other characters such as ASCII that it's not needed. I know how to get an hex input from user or a file containing only hex and convert it, but I don't know how to deal with these files.
I also don't know if it's possible to convert pcap files to binary directly.
hexdec = input("Enter any number in Hexadecimal Format: ") dec = int(hexdec, 16) print(hexdec,"in Binary = ", bin(dec))
![[Image: IKJGg3N.png]](https://pasteboard.co/IKJGg3N.png)