python - issue with formatting characters -
having bit of issue displaying characters
i have payload recieved protocol request :
538cb9350404521a6c44020404563b152606102001085800020002aabb0000563b1526000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
the length of 509
what want display first 4 bytes, 1 byte, 1 byte
538cb935 04 04
currently view payload doing following :
tm = struct.unpack(">l", payload[0:4]) print "time : ", tm ouroripv = struct.unpack(">b", payload[5]) print "our onion address : " print "ip version : ", ouroripv ouroraddrlen = struct.unpack(">b", payload[6]) # giving length of 82 etc atm print "ip length : ", ouroraddrlen
i result :
time : (1401731381,) our onion address : ip version : (4,) ip length : (82,)
as can see ip length, 6th byte in on payload displaying 82 rather 4 should be, correct struct.unpack
command needed display ?
how can ?
thanks guys
in python, slicing doesn't include last value, payload[0:4]
takes first 4 bytes, 0 3.
payload[3]
fourth byte
payload[4]
fifth byte
Comments
Post a Comment