1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
def desactivation ():
if HOST_URL in file("C:\WINDOWS\system32\drivers\etc\hosts"):
tkMessageBox.showinfo("Info", "Vous avez déjà désactivé le site.")
else:
loading = Label(fenetre)
loading.configure(text = "patientez ...")
loading.grid()
hosts_copy = open('C:\WINDOWS\system32\drivers\etc\hosts','r')
hosts_save = open('hosts_save','w')
while 1:
chaine_copy = hosts_copy.readline(50)
if (chaine_copy == ""):
break
chaine_save = hosts_save.write(chaine_copy)
hosts_save.close()
hosts_copy.close()
write_hosts = open('C:\WINDOWS\system32\drivers\etc\hosts','a')
host = write_hosts.write("\n127.0.0.1")
host = write_hosts.write(URL)
write_hosts.close() |
Partager