How to give client mac for BOOTP, in DHCP scapy?

1.3k Views Asked by At

clientMac = "00:00:01:00:11:03" bootp = BOOTP(op = opcode,chaddr = clientMac, ciaddr = "0.0.0.0",xid = 0x01020304,flags= 0x8000)

Here, I try to create bootp part for a DHCP offer packet. But in the packet capture, the clientMac is shown as 30 30 3a 30 30 3a. I get a junk mac address. When I convert my original clientmac into ascii, its coming as 30 30 3a 30 30 3a. ie,

      ASCII
: -> 3a (hex)
0 -> 30 (hex)
1 -> 31 (hex)

Here how to give clientMac for BOOTP(), in DHCP scapy?

2

There are 2 best solutions below

0
On
clientMac = binascii.unhexlify('000001001201')

This way, its worked.

0
On

On BOOTP only (I assume for historical reasons), you need to pass the raw MAC value to chafe rather than the literal one.

Use clientMac = str2mac("...")