Add some error checking
This commit is contained in:
parent
5b80a51e35
commit
51f55040d9
9
main.py
9
main.py
@ -23,7 +23,7 @@ for iface in netifaces.interfaces():
|
||||
interface_info = interface_info1[0]
|
||||
listeningIPs.append(interface_info["addr"])
|
||||
print("Listening on", listeningIPs)
|
||||
|
||||
print("Hailey is my Soulmate!")
|
||||
ttl=53
|
||||
class bcolors:
|
||||
OK = '\033[92m' #GREEN
|
||||
@ -66,7 +66,13 @@ class DoTProxy:
|
||||
#Setup DNS server, this will listen for incoming DNS packets
|
||||
resolver = DoTProxy()
|
||||
logger = server.DNSLogger(prefix=False)
|
||||
try:
|
||||
server = server.DNSServer(resolver,port=53,address="0.0.0.0",logger=logger, tcp=False)
|
||||
except:
|
||||
print(bcolors.FAIL+"Failed to open socket!"+bcolors.RESET)
|
||||
if operating_system == "posix":
|
||||
print("Detected posix environment. Linux requires root privleges to open port 53")
|
||||
exit()
|
||||
#server.start_thread()
|
||||
# Query upstream DoH server
|
||||
def DoTquery(domain, query_type):
|
||||
@ -90,3 +96,4 @@ def DoTquery(domain, query_type):
|
||||
return IP
|
||||
#server.start_thread()
|
||||
server.start()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user