IPv6 on analysis mode currently not supported properly in Utils.py
Hi, just wanted to give notice that utils.py on line 78 is not parsing IPv6 addresses properly. When using analyze mode, the "Invalid literal for int" error pops up for an IPv6 DNS host. Error as seen below:
Traceback (most recent call last):
File "/usr/share/responder/./Responder.py", line 340, in <module>
main()
File "/usr/share/responder/./Responder.py", line 250, in main from poisoners.LLMNR
import LLMNR
File "/usr/share/responder/poisoners/LLMNR.py", line 55, in <module>
IsICMPRedirectPlausible(settings.Config.Bind_To)
File "/usr/share/responder/poisoners/LLMNR.py", line 49, in IsICMPRedirectPlausible
if x != "127.0.0.1" and IsOnTheSameSubnet(x,IP) is False:
File "/usr/share/responder/utils.py", line 78, in IsOnTheSameSubnet
ipaddr = int(''.join([ '%02x' % int(x) for x in ip.split('.') ]), 16)
File "/usr/share/responder/utils.py", line 78, in <listcomp>
ipaddr = int(''.join([ '%02x' % int(x) for x in ip.split('.') ]), 16)
ValueError: invalid literal for int() with base 10: '240e:58:c000:1000:116:228:111:118'
This causes responder to break and stop running. The current work around for me is manually commenting out ipv6 nameservers in /etc/resolv.conf. Just wanted to let you know that it seems the int() on line 78 isn't meant for parsing IPv6 addresses.
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)
I'm also getting this error
Traceback (most recent call last):
File "/home/kali/Desktop/Responder/./Responder.py", line 389, in <module>
main()
File "/home/kali/Desktop/Responder/./Responder.py", line 277, in main
from poisoners.LLMNR import LLMNR
File "/home/kali/Desktop/Responder/poisoners/LLMNR.py", line 50, in <module>
IsICMPRedirectPlausible(settings.Config.Bind_To)
File "/home/kali/Desktop/Responder/poisoners/LLMNR.py", line 44, in IsICMPRedirectPlausible
if x != "127.0.0.1" and IsOnTheSameSubnet(x,IP) is False:
File "/home/kali/Desktop/Responder/utils.py", line 104, in IsOnTheSameSubnet
ipaddr = int(''.join([ '%02x' % int(x) for x in ip.split('.') ]), 16)
File "/home/kali/Desktop/Responder/utils.py", line 104, in <listcomp>
ipaddr = int(''.join([ '%02x' % int(x) for x in ip.split('.') ]), 16)
ValueError: invalid literal for int() with base 10: 'fd4b:8d38:69ba:1:9272:82ff:fe56:800b'
Quick Fix possible:
from ipaddress import ip_address,ip_network
def is_on_the_same_subnet(ip, net): ip_netw = ip_network(net, strict=False) ip_addr = ip_address(ip) return ip_addr in ip_netw