Added optional domain intercepting

master
Chloe Fontenot 🏳️‍⚧️ 2022-01-15 19:20:41 +07:00
parent 51f55040d9
commit d0161776a6
1 changed files with 22 additions and 17 deletions

@ -6,6 +6,11 @@ import dns.query
import dns.message import dns.message
import netifaces import netifaces
import os import os
import argparse
parser = argparse.ArgumentParser(description='a DoT Proxy resolver.')
parser.add_argument('-r',action="store_true", help='Optional: Disable request intercepting')
args = parser.parse_args()
print(args)
listeningIPs = [] listeningIPs = []
print("DoT (DNS over TLS) Proxy resolver - <Written by Caleb Fontenot>") print("DoT (DNS over TLS) Proxy resolver - <Written by Caleb Fontenot>")
# ASCII Art because why not # ASCII Art because why not
@ -74,13 +79,13 @@ except:
print("Detected posix environment. Linux requires root privleges to open port 53") print("Detected posix environment. Linux requires root privleges to open port 53")
exit() exit()
#server.start_thread() #server.start_thread()
# Query upstream DoH server # Query upstream DoH server
def DoTquery(domain, query_type): def DoTquery(domain, query_type):
#response = pythonDoh.client.query(str(domain), type=str(query_type), server="calebfontenot.com", verbose=True, fallback=False) if args.r == True:
if "nintendowifi.net." in str(domain): if "nintendowifi.net." in str(domain):
print(bcolors.FAIL+"Intercepted query!"+bcolors.RESET) print(bcolors.FAIL+"Intercepted query!"+bcolors.RESET)
return ["172.104.88.237"] return ["172.104.88.237"]
else:
q = dns.message.make_query(str(domain), str(query_type)) q = dns.message.make_query(str(domain), str(query_type))
response = dns.query.tls(q, "74.80.18.217", server_hostname="calebfontenot.com", port=853) response = dns.query.tls(q, "74.80.18.217", server_hostname="calebfontenot.com", port=853)
print(response) print(response)