I am trying to send binary data using python raw socket. To do this, I will do the following.
s = '\x01\x00\x12\x59' # some binary data sock.send(s) # assuming "sock" is a valid, open socket object
I created DATAGRAM in HEX, sniffing network traffic using wirehark. What I want to send over the network. This manual datagram is similar to
"04 f8 00 50 4f 30 fb 47 28 62 a7 6d 50 02 02 00 d2 7f 00 00"
So, I want to convert this aforementioned HEX datagram to binary format, like "\ x01 \ x00 \ x12 \ x59". How can i do this?
source share