diff --git a/src/runner.py b/src/runner.py index b8720600..be7284a3 100644 --- a/src/runner.py +++ b/src/runner.py @@ -1,4 +1,6 @@ import dns +import os +import stat import subprocess import dns.resolver import traceback @@ -35,12 +37,15 @@ def get_hosts_origin_ips(): def override_hosts(): print("Overriding hosts") + os.chmod(host_path, stat.S_IWRITE) with open(host_path, "a") as f: f.writelines(host_entries) + print("Hosts override") def restore_hosts(): print("Restoring hosts") + os.chmod(host_path, stat.S_IWRITE) with open(host_path, "r+") as f: host = f.read() for line in host_entries: @@ -48,3 +53,4 @@ def restore_hosts(): f.seek(0) f.write(host) f.truncate() + print("Restored hosts") \ No newline at end of file