I'm sending a DHCP Discover packet generated using python raw sockets but i didn't get a DHCP OFFER, I don't know what the problem is?
def DHCP(self):
Op = '\x01'
HwType = '\x01'
HwAddrLen = '\x06'
HopC = '\x00'
TransactionID = self.TransactionID
NumOfSec = '\x00\x00'
Flags_B_Res = '\x00\x00'
ciaddr = '\x00\x00\x00\x00'
yiaddr = '\x00\x00\x00\x00'
siaddr = '\x00\x00\x00\x00'
giaddr = '\x00\x00\x00\x00'
chwaddr = self.macInBytes
#chwaddr = '\xaa\x9f\xfa\xa4\x57\x9a'
chwpadding = '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
srchostname = '\x00' * 64
bootfilename = '\x00' * 128
magic_cookie = '\x63\x82\x53\x63' # Taken from http://tools.ietf.org/html/rfc1497
msg_type = '\x35\x01\x01'
par_req_list = '\x37\x0d\x01\x1c\x02\x03\x0f\x06\x77\x0c\x2c\x2f\x1a\x79\x2a'
end = '\xff'
pkt =Op+HwType+HwAddrLen+HopC+TransactionID+NumOfSec+Flags_B_Res+ciaddr+yiaddr+siaddr+giaddr+chwaddr+chwpadding+srchostname+bootfilename+magic_cookie+msg_type+par_req_list+end
return pkt
Note : I compared this packet with the dhclient(linux command) packet using wireshark and both packets were the same