Added optional domain intercepting
This commit is contained in:
parent
51f55040d9
commit
d0161776a6
39
main.py
39
main.py
@ -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,26 +79,26 @@ 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"]
|
||||||
|
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)
|
||||||
|
print(response)
|
||||||
|
# There's probably a better way of doing this, but I can't figure it out...
|
||||||
|
if str(query_type) == "A":
|
||||||
|
IP = regex4.findall(str(response.answer))
|
||||||
|
print(bcolors.OK+"IP is", str(IP[0])+bcolors.RESET)
|
||||||
|
elif str(query_type) == "AAAA":
|
||||||
|
IP = regex6.findall(str(response.answer))
|
||||||
|
#print("Not implemented yet!")
|
||||||
else:
|
else:
|
||||||
q = dns.message.make_query(str(domain), str(query_type))
|
print(bcolors.FAIL+"Queries beyond A or AAAA are not implemented"+bcolors.RESET)
|
||||||
response = dns.query.tls(q, "74.80.18.217", server_hostname="calebfontenot.com", port=853)
|
return IP
|
||||||
print(response)
|
|
||||||
# There's probably a better way of doing this, but I can't figure it out...
|
|
||||||
if str(query_type) == "A":
|
|
||||||
IP = regex4.findall(str(response.answer))
|
|
||||||
print(bcolors.OK+"IP is", str(IP[0])+bcolors.RESET)
|
|
||||||
elif str(query_type) == "AAAA":
|
|
||||||
IP = regex6.findall(str(response.answer))
|
|
||||||
#print("Not implemented yet!")
|
|
||||||
else:
|
|
||||||
print(bcolors.FAIL+"Queries beyond A or AAAA are not implemented"+bcolors.RESET)
|
|
||||||
return IP
|
|
||||||
#server.start_thread()
|
#server.start_thread()
|
||||||
server.start()
|
server.start()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user