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