66from colorama import Back
77from colorama import Style
88from id_changer import IDchanger
9-
9+ from backup_restore import restore_user_conf
10+ import random
11+ import pyfiglet
1012init (autoreset = True )
1113
14+
1215# Backuping user.conf file
13- def backup_user_conf ():
16+ def backup_user_conf_main ():
1417 user_conf = os .path .expandvars (r"%APPDATA%\AnyDesk\user.conf" )
1518 backup_conf = os .path .expanduser ("~/Desktop/user.conf.backup" )
1619
@@ -44,20 +47,48 @@ def Killing_AnyDesk():
4447# Removing old version of Adesk
4548def remove_anydesk ():
4649 print (Style .BRIGHT + Fore .YELLOW + "Removing the old version of AnyDesk..." )
47- paths_to_remove = [
48- r"C:\ProgramData\AnyDesk" ,
49- os .path .expandvars (r"%APPDATA%\AnyDesk" ),
50- os .path .expandvars (r"%LOCALAPPDATA%\AnyDesk" ),
51- r"C:\Program Files (x86)\AnyDesk"
52- ]
53- for path in paths_to_remove :
54- if os .path .exists (path ):
55- shutil .rmtree (path , ignore_errors = True )
56- print (Style .BRIGHT + Fore .YELLOW + f"Deleted: { path } " )
50+
51+ choice = input (Style .BRIGHT + Fore .CYAN +
52+ "Do you want to remove AnyDesk from the default paths (d) or specify a custom path (c)? (d/c): " ).strip ().lower ()
53+
54+ if choice == 'd' :
55+ # Standart path
56+ paths_to_remove = [
57+ r"C:\ProgramData\AnyDesk" ,
58+ os .path .expandvars (r"%APPDATA%\AnyDesk" ),
59+ os .path .expandvars (r"%LOCALAPPDATA%\AnyDesk" ),
60+ r"C:\Program Files (x86)\AnyDesk"
61+ ]
62+ for path in paths_to_remove :
63+ if os .path .exists (path ):
64+ shutil .rmtree (path , ignore_errors = True )
65+ print (Style .BRIGHT + Fore .YELLOW + f"Deleted: { path } " )
66+ else :
67+ print (Style .BRIGHT + Fore .YELLOW + f"Folder { path } is already missing." )
68+ elif choice == 'c' :
69+ # Custom path if user wants
70+ print (Style .BRIGHT + Fore .CYAN + "Please select the folder you want to remove." )
71+ root = tk .Tk ()
72+ root .attributes ('-topmost' , True )
73+ root .withdraw ()
74+ custom_path = filedialog .askdirectory (title = "Select AnyDesk Directory" )
75+
76+ if custom_path :
77+ if os .path .exists (custom_path ):
78+ try :
79+ shutil .rmtree (custom_path , ignore_errors = True )
80+ print (Style .BRIGHT + Fore .GREEN + f"Deleted: { custom_path } " )
81+ except OSError as e :
82+ print (Style .BRIGHT + Fore .RED + f"Failed to delete { custom_path } : { e } " )
83+ else :
84+ print (Style .BRIGHT + Fore .RED + f"The specified path '{ custom_path } ' does not exist." )
5785 else :
58- print (Style .BRIGHT + Fore .YELLOW + f"Folder { path } Already missing.." )
86+ print (Style .BRIGHT + Fore .GREEN + "No folder selected. Skipping AnyDesk removal." )
87+ else :
88+ print (Style .BRIGHT + Fore .RED + "Invalid input. Skipping AnyDesk removal." )
89+
5990
60- # Installing new AnyDesk
91+ # Installing new AnyDesk if user wants
6192import tkinter as tk
6293from tkinter import filedialog
6394import subprocess
@@ -69,8 +100,8 @@ def install_anydesk():
69100 if choice == 'y' :
70101 print (Style .BRIGHT + Fore .GREEN + "Please select the AnyDesk installer (.exe file)." )
71102 root = tk .Tk ()
72- root .attributes ('-topmost' , True ) # Окно всегда сверху
73- root .withdraw () # Скрываем окно, но не удаляем его
103+ root .attributes ('-topmost' , True )
104+ root .withdraw ()
74105 installer_path = filedialog .askopenfilename (
75106 title = "Select AnyDesk Installer" ,
76107 filetypes = [("Executable files" , "*.exe" )],
@@ -82,6 +113,7 @@ def install_anydesk():
82113 print (Style .BRIGHT + Fore .YELLOW + "Running the installer..." )
83114 subprocess .run (installer_path , check = True )
84115 print (Style .BRIGHT + Fore .GREEN + "Installation completed." )
116+ restore_user_conf_main ()
85117 except subprocess .CalledProcessError as e :
86118 print (Style .BRIGHT + Fore .RED + f"Error during installation: { e } " )
87119 else :
@@ -94,7 +126,7 @@ def install_anydesk():
94126 print (Style .BRIGHT + Fore .RED + "Invalid choice. Installation skipped." )
95127
96128# Restoring old user.conf from backup
97- def restore_user_conf ():
129+ def restore_user_conf_main ():
98130 backup_conf = os .path .expanduser ("~/Desktop/user.conf.backup" )
99131 user_conf = os .path .expandvars (r"%APPDATA%\AnyDesk\user.conf" )
100132
@@ -105,7 +137,7 @@ def restore_user_conf():
105137 else :
106138 print (Style .BRIGHT + Fore .RED + "Backup file user.conf not found. Skipping restoration." ) # why?
107139
108- # Running AnyDesk
140+ # Running AnyDesk if user wants
109141def run_anydesk ():
110142 choice = input (Style .BRIGHT + Fore .CYAN + "Do you want to run AnyDesk now? (y = run, n = don't run): " ).strip ().lower ()
111143
@@ -153,41 +185,64 @@ def IDchangerQuestion():
153185 else :
154186 print (Style .BRIGHT + Fore .RED + "Invalid input. Skipping ID change." )
155187
188+ # Logo
189+ def colorful_text (text ):
190+ color_choices = [
191+ Fore .RED , Fore .GREEN , Fore .YELLOW , Fore .BLUE , Fore .MAGENTA , Fore .CYAN , Fore .WHITE
192+ ]
193+ result = ""
194+ for char in text :
195+ color = random .choice (color_choices )
196+ result += color + char
197+ return result
198+
199+ # ASCII logo
200+ anydesk_text = pyfiglet .figlet_format ("AnyDesk" , font = "slant" )
201+ reset_text = pyfiglet .figlet_format ("reset" , font = "slant" )
156202
157203def main_cleanup ():
158- backup_user_conf ()
204+ backup_user_conf_main ()
159205 Killing_AnyDesk ()
160206 remove_anydesk ()
207+ restore_user_conf_main ()
161208 install_anydesk ()
162209 IDchangerQuestion ()
163210 run_anydesk ()
164211 print (Style .BRIGHT + Fore .LIGHTGREEN_EX + "Done, enjoy!" )
165212
166213if __name__ == "__main__" :
167214 while True :
168- print (Style .BRIGHT + Fore .CYAN + "Select an action:" )
169- print (Style .BRIGHT + Fore .LIGHTYELLOW_EX + "1. Main cleanup script" )
215+ print (Style .BRIGHT + Fore .RED + anydesk_text ); print (Style .BRIGHT + colorful_text (reset_text ))
216+ print (Style .BRIGHT + Fore .LIGHTWHITE_EX + "Made by MKultra69" )
217+ print (Fore .LIGHTWHITE_EX + "GitHub: https://github.com/MKultra6969/AnyDesk-reset" )
218+ print (Style .BRIGHT + Fore .CYAN + "\n Select an action:" )
219+ print (Style .BRIGHT + Fore .LIGHTYELLOW_EX + "1. Main cleanup" )
170220 print (Style .BRIGHT + Fore .LIGHTYELLOW_EX + "2. Change AnyDesk ID" )
171- print (Style .BRIGHT + Fore .LIGHTRED_EX + "3. Exit" )
221+ print (Style .BRIGHT + Fore .LIGHTYELLOW_EX + "3. Backup/Restore user.conf" )
222+ print (Style .BRIGHT + Fore .LIGHTRED_EX + "4. Exit" )
172223
173- choice = input (Style .BRIGHT + Fore .CYAN + "Enter your choice (1, 2, or 3 ): " ).strip ()
224+ choice = input (Style .BRIGHT + Fore .CYAN + "Enter your choice (1, 2, 3, or 4 ): " ).strip ()
174225
175226 if choice == '1' :
176- print (Style .BRIGHT + Fore .GREEN + "Running the main cleanup script ..." )
227+ print (Style .BRIGHT + Fore .GREEN + "Running the Main cleanup tool ..." )
177228 main_cleanup ()
178- break
179229 elif choice == '2' :
180- print (Style .BRIGHT + Fore .GREEN + "Running the ID changer script ..." )
230+ print (Style .BRIGHT + Fore .GREEN + "Running the ID changer tool ..." )
181231 Killing_AnyDesk ()
182232 IDchanger ()
183- break
184233 elif choice == '3' :
234+ print (Style .BRIGHT + Fore .GREEN + "Running the Backup/Restore tool..." )
235+ restore_user_conf ()
236+ run_anydesk ()
237+ elif choice == '4' :
185238 print (Style .BRIGHT + Fore .GREEN + "Exiting the program." )
186239 break
187240 else :
188241 print (Style .BRIGHT + Fore .RED + "Invalid choice. Please try again." )
189242
190243
244+
191245# Why? Idk.
192246
193- # upd 03:17PM Why are you reading this shit, you little motherfucker?
247+ # upd 26.11.24 03:17PM Why are you reading this shit, you little motherfucker?
248+ # upd 27.11.24
0 commit comments