Removed unnecessary and strange features

This commit is contained in:
stef-devs 2022-07-29 11:00:42 +02:00
parent 84992a78aa
commit f9863f8db8
1 changed files with 0 additions and 42 deletions

42
main.py
View File

@ -30,48 +30,6 @@ sito = tk.StringVar
text_input= tk.Entry(textvariable=sito)
text_input.grid(row=3, column=0, sticky="WE", padx=10, pady=10)
#Shutdown pc
def spegni():
subprocess.run('shutdown now', shell=True)
subprocess.run('shutdown -s -t O', shell=True)
#If i visit youtube, shutdown pc
def smetti():
sito = text_input.get()
print(sito)
f = open ("siti.dat","w")
f.write(sito)
f.close()
a = open("executable.py","w")
a.write("#!/usr/bin/env python3 \n")
a.write("import os,json,lz4.block,time \n")
a.write("f = open(\"siti.dat\",\"r\") \n")
a.write("sito = f.read()\n")
a.write("d = open(\"/home/usr/snap/firefox/common/.mozilla/firefox/8gnxd9f4.default/sessionstore-backups/recovery.jsonlz4\", \"rb\") \n")
a.write("magic = d.read(8)\n")
a.write("data = json.loads(lz4.block.decompress(d.read()).decode(\"utf-8\"))\n")
a.write("d.close()\n")
a.write("current_window = \"\"\n")
a.write("for win in data.get(\"windows\"):\n")
a.write(" for tab in win.get(\"tabs\"):\n")
a.write(" i = int(tab.get(\"index\")) - 1 \n")
a.write(" current_window = tab.get(\"entries\")[i].get(\"url\")\n")
a.write("print(current_window)\n")
a.write("if sito in str(current_window):\n")
a.write(" print(\"Yes\")\n")
a.write(" os.system(\"shutdown now\")")
a.close()
b = open("executable.sh", "w")
b.write("#!/bin/bash\n")
b.write("/home/lorenzo/Scrivania/poweroffer/executable.py")
b.close()
#Button stop procrastinating
second_button= tk.Button(text="Stop procrastinating", command=smetti)
second_button.grid(row=5, column=0, sticky="WE", padx=15, pady=8)