简体   繁体   中英

Scapy DHCP retrieving offered IP address

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM