1

Whenever I try to load Giaddr (or YIADDR Ciaddr, siaddr ) for any DHCP packet it prints random string of numbers. ( this happens for each n every packet I load)

Am I doing something wrong or it's a bug in code?

code

dh = dpkt.dhcp.DHCP(udp.data)
print dh.giaddr

output : 182435815

I am pretty sure that my giaddr(relay ip) is 10.223.191.231 - confirmed in wireshark for this packet.

Manojcode
  • 41
  • 4

1 Answers1

1

Your output is correct. You have a the integer value of the address. To print the dotted-decimal version, you can do this:

>>> import struct
>>> socket.inet_ntoa(struct.pack(">L",x))
'10.223.191.231'
Kiran Bandla
  • 686
  • 4
  • 10