问题
I've successfully created a DHCP discover, Offer and Request in Scapy. I was wondering if it is possible for me to retrieve the offer DHCP IP address, saving it to a variable where I will be able to request for it specifically in my DHCP Request using Scapy. I've tried using sniff but it doesn't seem to retrieve any IP address as follows :
sniff(iface=myiface, filter="port 68 and port 67")
Are there any methods to retrieve the offered IP? Thanks
回答1:
I've solved this already. For anyone else who needs help on this. Basically BOOTP in the sniffed packet contains the offered IP address and to retrieve the address. Simply do this:
pckt.getlayer(BOOTP).yiaddr #pckt is the sniffed packet
来源:https://stackoverflow.com/questions/58372129/scapy-dhcp-retrieving-offered-ip-address