-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
261 lines (241 loc) · 11.4 KB
/
app.py
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
import os
import requests
import subprocess
from tqdm import tqdm
from colorama import init, Fore, Back
import platform
import ctypes
init(autoreset=True)
def main():
while True:
print_menu()
choice = input("Write App by number: ").strip()
if choice == "1":
install_anydesk()
elif choice == "2":
install_google_chrome()
elif choice == "3":
install_mozilla_firefox()
elif choice == "4":
install_zoom()
elif choice == "5":
install_vlc_media_player()
elif choice == "6":
install_microsoft_office()
elif choice == "7":
install_visual_studio_code()
elif choice == "8":
install_discord()
elif choice == "9":
install_winrar()
elif choice == "10":
install_notepad_plus_plus()
elif choice == "11":
install_dropbox()
elif choice == "12":
install_adobe_cc()
elif choice == "13":
print(Back.BLACK + Fore.GREEN + "Shutting down...")
break
else:
print(Back.BLACK + Fore.RED + "Not valide.")
def print_menu():
os.system('cls' if os.name == 'nt' else 'clear') # Limpa o terminal
print(Back.BLACK + Fore.GREEN + "========== Main Menu ==========")
print(Back.BLACK + Fore.GREEN + "Choose a option:")
print(Back.BLACK + Fore.YELLOW + "1. Install AnyDesk")
print(Back.BLACK + Fore.YELLOW + "2. Install Google Chrome")
print(Back.BLACK + Fore.YELLOW + "3. Install Mozilla Firefox")
print(Back.BLACK + Fore.YELLOW + "4. Install Zoom")
print(Back.BLACK + Fore.YELLOW + "5. Install VLC Media Player")
print(Back.BLACK + Fore.YELLOW + "6. Install Microsoft Office (online)")
print(Back.BLACK + Fore.YELLOW + "7. Install Visual Studio Code")
print(Back.BLACK + Fore.YELLOW + "8. Install Discord")
print(Back.BLACK + Fore.YELLOW + "9. Install WinRAR")
print(Back.BLACK + Fore.YELLOW + "10. Install Notepad++")
print(Back.BLACK + Fore.YELLOW + "11. Install Dropbox")
print(Back.BLACK + Fore.YELLOW + "12. Install Adobe Creative Cloud (Trial Version)")
print(Back.BLACK + Fore.GREEN + "13. Exit")
print(Back.BLACK + Fore.GREEN + "====================================")
def install_anydesk():
print(Back.BLACK + Fore.GREEN + "Starting download: AnyDesk...")
anydesk_download_url = "https://download.anydesk.com/AnyDesk.exe"
installer_filename = "AnyDesk.exe"
try:
download_with_progress(anydesk_download_url, installer_filename)
run_installer(installer_filename, "AnyDesk")
print(Back.BLACK + Fore.GREEN + "AnyDesk: installation successful")
except Exception as e:
print(Back.BLACK + Fore.RED + f"AnyDesk installation ERROR: {e}")
finally:
input("Press Enter to continue...")
def install_google_chrome():
print(Back.BLACK + Fore.GREEN + "IStarting download: Google Chrome...")
chrome_download_url = "https://www.google.com/intl/pt-BR/chrome/"
installer_filename = "ChromeStandaloneSetup64.exe"
try:
download_with_progress(chrome_download_url, installer_filename)
run_installer(installer_filename, "Google Chrome")
print(Back.BLACK + Fore.GREEN + "Google Chrome: installation successful")
except Exception as e:
print(Back.BLACK + Fore.RED + f"Google Chrome installation ERROR: {e}")
finally:
input("Press Enter to continue...")
def install_mozilla_firefox():
print(Back.BLACK + Fore.GREEN + "Starting download: Mozilla Firefox...")
firefox_download_url = "https://download.mozilla.org/?product=firefox-latest&os=win&lang=pt-BR"
installer_filename = "FirefoxSetup.exe"
try:
download_with_progress(firefox_download_url, installer_filename)
run_installer(installer_filename, "Mozilla Firefox")
print(Back.BLACK + Fore.GREEN + "Mozilla Firefox: installation successful")
except Exception as e:
print(Back.BLACK + Fore.RED + f"Mozilla Firefox installation ERROR: {e}")
finally:
input("Press Enter to continue...")
def install_zoom():
print(Back.BLACK + Fore.GREEN + "Starting download: Zoom...")
zoom_download_url = "https://zoom.us/client/latest/ZoomInstaller.exe"
installer_filename = "ZoomInstaller.exe"
try:
download_with_progress(zoom_download_url, installer_filename)
run_installer(installer_filename, "Zoom")
print(Back.BLACK + Fore.GREEN + "Zoom: installation successful")
except Exception as e:
print(Back.BLACK + Fore.RED + f"Zoom installation ERROR: {e}")
finally:
input("Press Enter to continue...")
def install_vlc_media_player():
print(Back.BLACK + Fore.GREEN + "Starting download: VLC Media Player...")
system_architecture = platform.architecture()[0]
arch_suffix = "64" if system_architecture == "64bit" else "32"
vlc_download_url = f"https://get.videolan.org/vlc/last/win{arch_suffix}/vlc-{arch_suffix}.0.16-win{arch_suffix}.exe"
installer_filename = f"vlc-{arch_suffix}.0.16-win{arch_suffix}.exe"
try:
download_with_progress(vlc_download_url, installer_filename)
run_installer(installer_filename, "VLC Media Player")
print(Back.BLACK + Fore.GREEN + "VLC Media Player: installation successful")
except Exception as e:
print(Back.BLACK + Fore.RED + f"VLC Media Player installation ERROR: {e}")
finally:
input("Press Enter to continue...")
def install_microsoft_office():
print(Back.BLACK + Fore.GREEN + "Starting download: Microsoft Office (online)...")
office_download_url = "https://www.office.com/"
installer_filename = "OfficeInstaller.exe"
try:
download_with_progress(office_download_url, installer_filename)
run_installer(installer_filename, "Microsoft Office")
print(Back.BLACK + Fore.GREEN + "Microsoft Office: installation successful")
except Exception as e:
print(Back.BLACK + Fore.RED + f"Microsoft Office installation ERROR: {e}")
finally:
input("Press Enter to continue...")
def install_visual_studio_code():
print(Back.BLACK + Fore.GREEN + "Starting download: Visual Studio Code...")
system_architecture = platform.architecture()[0]
vscode_download_url = "https://code.visualstudio.com/sha/download?build=stable&os=win32-x64" if system_architecture == "64bit" else "https://code.visualstudio.com/sha/download?build=stable&os=win32"
installer_filename = "VSCodeSetup.exe"
try:
download_with_progress(vscode_download_url, installer_filename)
run_installer(installer_filename, "Visual Studio Code")
print(Back.BLACK + Fore.GREEN + "Visual Studio Code: installation successful")
except Exception as e:
print(Back.BLACK + Fore.RED + f"Visual Studio Code installation ERROR: {e}")
finally:
input("Press Enter to continue...")
def install_discord():
print(Back.BLACK + Fore.GREEN + "Starting download: Discord...")
system_architecture = platform.architecture()[0]
arch_suffix = "x64" if system_architecture == "64bit" else "ia32"
discord_download_url = f"https://discord.com/api/download?platform=win&arch={arch_suffix}"
installer_filename = f"DiscordSetup-{arch_suffix}.exe"
try:
download_with_progress(discord_download_url, installer_filename)
run_installer(installer_filename, "Discord")
print(Back.BLACK + Fore.GREEN + "Discord: installation successful")
except Exception as e:
print(Back.BLACK + Fore.RED + f"Discord installation ERROR: {e}")
finally:
input("Press Enter to continue...")
def install_winrar():
print(Back.BLACK + Fore.GREEN + "Starting download: WinRAR...")
system_architecture = platform.architecture()[0]
arch_suffix = "x64" if system_architecture == "64bit" else "x86"
winrar_download_url = f"https://www.win-rar.com/fileadmin/winrar-versions/{arch_suffix}/wrar641.exe"
installer_filename = f"winrar-{arch_suffix}.exe"
try:
download_with_progress(winrar_download_url, installer_filename)
run_installer(installer_filename, "WinRAR")
print(Back.BLACK + Fore.GREEN + "WinRAR: installation successful")
except Exception as e:
print(Back.BLACK + Fore.RED + f"WinRAR installation ERROR: {e}")
finally:
input("Press Enter to continue...")
def install_notepad_plus_plus():
print(Back.BLACK + Fore.GREEN + "Starting download: Notepad++...")
npp_download_url = "https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v8.3.1/npp.8.3.1.Installer.exe"
installer_filename = "npp.8.3.1.Installer.exe"
try:
download_with_progress(npp_download_url, installer_filename)
run_installer(installer_filename, "Notepad++")
print(Back.BLACK + Fore.GREEN + "Notepad++: installation successful")
except Exception as e:
print(Back.BLACK + Fore.RED + f"Notepad++ installation ERROR: {e}")
finally:
input("Press Enter to continue...")
def install_dropbox():
print(Back.BLACK + Fore.GREEN + "Starting download: Dropbox...")
dropbox_download_url = "https://www.dropbox.com/download?plat=win"
installer_filename = "DropboxInstaller.exe"
try:
download_with_progress(dropbox_download_url, installer_filename)
run_installer(installer_filename, "Dropbox")
print(Back.BLACK + Fore.GREEN + "Dropbox: installation successful!")
except Exception as e:
print(Back.BLACK + Fore.RED + f"Dropbox installation ERROR: {e}")
finally:
input("Press Enter to continue...")
def install_adobe_cc():
print(Back.BLACK + Fore.GREEN + "Starting download: Adobe Creative Cloud (Trial Version)...")
adobe_cc_download_url = "https://www.adobe.com/creativecloud/desktop-app.html"
installer_filename = "AdobeCreativeCloud.exe"
try:
download_with_progress(adobe_cc_download_url, installer_filename)
run_installer(installer_filename, "Adobe Creative Cloud (Trial Version)")
print(Back.BLACK + Fore.GREEN + "Adobe Creative Cloud (Trial Version): installation successful")
except Exception as e:
print(Back.BLACK + Fore.RED + f"Adobe Creative Cloud (Trial Version) installation ERROR: {e}")
finally:
input("Press Enter to continue...")
def download_with_progress(url, filename):
with requests.get(url, stream=True) as r:
r.raise_for_status()
total_size = int(r.headers.get('content-length', 0))
with open(filename, 'wb') as f, tqdm(
desc=f"Downloading {filename}",
total=total_size,
unit='B',
unit_scale=True,
unit_divisor=1024,
colour='green'
) as progress_bar:
for chunk in r.iter_content(chunk_size=8192):
f.write(chunk)
progress_bar.update(len(chunk))
def run_installer(filename, app_name):
print(Back.BLACK + Fore.YELLOW + f"Starting installation: {app_name}...")
try:
#Execute with admin privilegies
if platform.system() == "Windows":
ctypes.windll.shell32.ShellExecuteW(None, "runas", filename, None, None, 1)
else:
subprocess.run(["sudo", filename], check=True)
except subprocess.CalledProcessError as e:
raise Exception(f"Error during installation {app_name}: {e}")
def clean_up():
# Limpa o terminal
os.system('cls' if os.name == 'nt' else 'clear')
if __name__ == "__main__":
print(Back.BLACK + Fore.RED + "by Romulo Gusman de Oliveira.")
main()