Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/10se1ucgo/DisableWinTracking.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author10se1ucgo <hammaadu1@gmail.com>2015-08-23 23:45:38 +0300
committer10se1ucgo <hammaadu1@gmail.com>2015-08-23 23:45:38 +0300
commit42e3b3bb3aefa340a2eadf7fb2a29243bad8be9f (patch)
treee4ee0fdfcf3e37007ddfcf7937f0a5dba94bf03f
parent1e740d696703602f7b749dac3554121f1515ce49 (diff)
Fixed normal domains being added to the host file twice if the extra box was ticked.v2.1.1
Changed nullip from 0.0.0.0 to 127.0.0.0
-rw-r--r--run.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/run.py b/run.py
index 07bb3b3..7fb2234 100644
--- a/run.py
+++ b/run.py
@@ -182,7 +182,7 @@ class MainFrame(wx.Frame):
def modifyhosts(extra, undo):
- nullip = "0.0.0.0 " # IP to route domains to
+ nullip = "127.0.0.0 " # IP to route domains to
# List of tracking domains
normallist = ['a-0001.a-msedge.net', 'a-0002.a-msedge.net', 'a-0003.a-msedge.net',
@@ -227,16 +227,23 @@ def modifyhosts(extra, undo):
hostspath = os.path.join(os.environ['SYSTEMROOT'], 'System32\\drivers\\etc\\hosts')
if not undo:
- try:
- with open(hostspath, 'ab') as f:
- f.write('\r\n' + '\r\n'.join(normallistip))
- if extra:
+ if not extra:
+ try:
+ with open(hostspath, 'ab') as f:
+ f.write('\r\n' + '\r\n'.join(normallistip))
+ print "Domains successfully appended to HOSTS file."
+ except (WindowsError, IOError):
+ print "Could not access HOSTS file. Is the program not elevated?"
+
+ elif extra:
+ try:
+ with open(hostspath, 'ab') as f:
f.write('\r\n' + '\r\n'.join(extralistip))
- print "Domains successfully appended to HOSTS file."
- except (WindowsError, IOError):
- print "Could not access HOSTS file. Is the program not elevated?"
+ print "Extra domains successfully appended to HOSTS file."
+ except (WindowsError, IOError):
+ print "Could not access HOSTS file. Is the program not elevated?"
- else:
+ elif undo:
try:
with open(hostspath, 'r') as hostfile, open(hostspath + "temp", 'w') as tempfile:
for line in hostfile: