mirror of
https://github.com/lgandx/Responder.git
synced 2025-08-20 21:33:31 -07:00
Added: Analyze ICMP Redirect plausibility on current subnet.
This commit is contained in:
parent
13e7623312
commit
06df704960
1 changed files with 28 additions and 0 deletions
28
Responder.py
28
Responder.py
|
@ -903,12 +903,40 @@ def Parse_IPV6_Addr(data):
|
|||
else:
|
||||
return False
|
||||
|
||||
def IsOnTheSameSubnet(ip, net):
|
||||
net = net+'/24'
|
||||
ipaddr = int(''.join([ '%02x' % int(x) for x in ip.split('.') ]), 16)
|
||||
netstr, bits = net.split('/')
|
||||
netaddr = int(''.join([ '%02x' % int(x) for x in netstr.split('.') ]), 16)
|
||||
mask = (0xffffffff << (32 - int(bits))) & 0xffffffff
|
||||
return (ipaddr & mask) == (netaddr & mask)
|
||||
|
||||
def IsICMPRedirectPlausible(IP):
|
||||
dnsip = []
|
||||
for line in file('/etc/resolv.conf', 'r'):
|
||||
ip = line.split()
|
||||
if ip[0] == 'nameserver':
|
||||
dnsip.extend(ip[1:])
|
||||
for x in dnsip:
|
||||
if IsOnTheSameSubnet(x,IP) == False:
|
||||
print "[+]You can ICMP Redirect on this network. This workstation (%s) is not on the same subnet than the DNS server (%s). Use python Icmp-Redirect.py for more details."%(IP, x)
|
||||
else:
|
||||
pass
|
||||
|
||||
def FindLocalIP(Iface):
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
s.setsockopt(socket.SOL_SOCKET, 25, Iface+'\0')
|
||||
s.connect(("127.0.0.1",9))#RFC 863
|
||||
return s.getsockname()[0]
|
||||
|
||||
def AnalyzeICMPRedirect():
|
||||
if Analyze(AnalyzeMode) and OURIP is not None and INTERFACE == 'Not set':
|
||||
IsICMPRedirectPlausible(OURIP)
|
||||
if Analyze(AnalyzeMode) and INTERFACE != 'Not set':
|
||||
IsICMPRedirectPlausible(FindLocalIP(INTERFACE))
|
||||
|
||||
AnalyzeICMPRedirect()
|
||||
|
||||
def RunLLMNR():
|
||||
try:
|
||||
ALL = '0.0.0.0'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue