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

Fails with IPv6 DNS server #2

Open
bramp opened this issue Oct 30, 2021 · 0 comments
Open

Fails with IPv6 DNS server #2

bramp opened this issue Oct 30, 2021 · 0 comments

Comments

@bramp
Copy link

bramp commented Oct 30, 2021

My default DNS server is a IPv6 address, and when the tool receives a DNS request it fails with a error

$ ./dns-mitm.py
DNS MitM by Adrian Vollmer, SySS GmbH
Warning: Failed to drop privileges
Warning: No hosts specified. Operating in passive mode.
127.0.0.1:60629 is requesting the A record of google.com
Forwarding DNS request to 2601:646:ca00:43c::1
Traceback (most recent call last):
  File "./dns-mitm.py", line 167, in <module>
    main()
  File "./dns-mitm.py", line 161, in main
    main_loop(udps)
  File "./dns-mitm.py", line 129, in main_loop
    answer = forwarded_dns_request(data)
  File "./dns-mitm.py", line 104, in forwarded_dns_request
    udps.sendto(data, (DNS_IP, 53))
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

The fix is simple change line 103 from

udps = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

to

udps = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)

However, I suspect you'd want to check if DNS_IP is v4 or v6 and select AF_INET[6] appropriately.

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

1 participant