From c35acd8a256fa233fa6875a48ac314ae5162c8bf Mon Sep 17 00:00:00 2001 From: Acinomatnas Date: Fri, 3 Jul 2020 23:19:41 -0600 Subject: [PATCH 1/2] Update fakedns.py --- fakedns.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/fakedns.py b/fakedns.py index 3889417..32e1b64 100755 --- a/fakedns.py +++ b/fakedns.py @@ -511,10 +511,15 @@ def __init__(self, file_): for rule in rules: - # ignore blank lines or lines starting with hashmark (coments) + # ignore blank lines or lines starting with hashmark (comments) if len(rule.strip()) == 0 or rule.lstrip()[0] == "#" or rule == '\n': # thank you to github user cambid for the comments suggestion continue + + # remove any hashmarks (comments) at the end of a rule + if "#" in rule: + rule = rule.split("#", 1)[0] + print(rule) # Confirm that the rule has at least three columns to it if len(rule.split()) < 3: @@ -692,7 +697,10 @@ def signal_handler(signal, frame): try: server = ThreadedUDPServer((interface, int(port)), UDPHandler) except socket.error: - print(">> Could not start server -- is another program on udp:{0}?".format(port)) + if os.geteuid() != 0 and int(port) < 1024: + print("Root privileges may be required to run on udp:{0}".format(port)); + else: + print(">> Could not start server -- is another program on udp:{0}?".format(port)) exit(1) server.daemon = True From 3b696239a1269304adcb1031212de97072b56586 Mon Sep 17 00:00:00 2001 From: Acinomatnas Date: Sun, 27 Sep 2020 13:02:46 -0600 Subject: [PATCH 2/2] Remove debug print --- fakedns.py | 1 - 1 file changed, 1 deletion(-) diff --git a/fakedns.py b/fakedns.py index 32e1b64..161ee27 100755 --- a/fakedns.py +++ b/fakedns.py @@ -519,7 +519,6 @@ def __init__(self, file_): # remove any hashmarks (comments) at the end of a rule if "#" in rule: rule = rule.split("#", 1)[0] - print(rule) # Confirm that the rule has at least three columns to it if len(rule.split()) < 3: