mirror of
https://github.com/lgandx/Responder.git
synced 2025-07-05 20:41:22 -07:00
DHCP poisoner: refactor FindIP
- do not crash on IP addresses where one octet contains 0x45 0x4f or 0x46 - operate on bytes (avoid encoding/decoding round-trip) and use simple string search instead of regular expressions closes #181 closes #304
This commit is contained in:
parent
545137275f
commit
a0d1f03617
1 changed files with 6 additions and 3 deletions
|
@ -239,9 +239,12 @@ def ParseSrcDSTAddr(data):
|
|||
return SrcIP, SrcPort, DstIP, DstPort
|
||||
|
||||
def FindIP(data):
|
||||
data = data.decode('latin-1')
|
||||
IP = ''.join(re.findall(r'(?<=\x32\x04)[^EOF]*', data))
|
||||
return ''.join(IP[0:4]).encode('latin-1')
|
||||
IPPos = data.find(b"\x32\x04") + 2
|
||||
if IPPos == -1 or IPPos + 4 >= len(data):
|
||||
return None
|
||||
else:
|
||||
IP = data[IPPos:IPPos+4]
|
||||
return IP
|
||||
|
||||
def ParseDHCPCode(data, ClientIP,DHCP_DNS):
|
||||
global DHCPClient
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue