From f9863f8db82060b13e65b310571a12d45ece98ea Mon Sep 17 00:00:00 2001 From: stef-devs Date: Fri, 29 Jul 2022 11:00:42 +0200 Subject: [PATCH] Removed unnecessary and strange features --- main.py | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/main.py b/main.py index 0134d85..bc97a7f 100644 --- a/main.py +++ b/main.py @@ -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)