Reputation: 355
I have an DHCP packet received. I want to obtain the number of the option from that packet. E.g. server_id option has number 53. I need to do this in scapy.
I tried if pkt[DHCP].options[i] == 53: do something
but dosen't work.
Upvotes: 3
Views: 480
Reputation: 355
Solved.
Options field are a tuples. To acces a value of an option you have to use
if pkt[DHCP].options[i][j] == 53: do something
where i -is the number of the option(starts from 0) and j - is the value or the name of the option(j=0 is the name, and j=1 is the value).
Upvotes: 1