Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPv6 on analysis mode currently not supported properly in Utils.py #152

Open
n1jj1n opened this issue Feb 21, 2021 · 2 comments
Open

IPv6 on analysis mode currently not supported properly in Utils.py #152

n1jj1n opened this issue Feb 21, 2021 · 2 comments

Comments

@n1jj1n
Copy link

n1jj1n commented Feb 21, 2021

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)

@ACK-J
Copy link

ACK-J commented Oct 28, 2022

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'

@chamaillard
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants