Daedro's avatar

Daedro

Member for 18 years, 2 months, 18 hours User #115

Comments 1

On a packet ·

How to get the port # from DWORD with Python:
socket.ntohs(struct.unpack("< i", "\x17\xe0\x00\x00")[0])

How to convert port to DWORD with Python:
struct.pack("< i", socket.htons(6112))

Remove the space between < and i, these docs dont parse code comments well.

How to get the IP from DWORD with Python:
socket.inet_ntoa("\x3f\xf1\x53\x12")

How to convert IP to DWORD with Python:
socket.inet_aton("63.241.83.18")

Remove the extra quotation marks, these docs dont parse code comments well.