-
Notifications
You must be signed in to change notification settings - Fork 0
/
windowsfetch.py
374 lines (344 loc) · 18.2 KB
/
windowsfetch.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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
try:
import os
import time
import platform
if platform.system() == 'Linux':
print('This program works only on Windows OS!')
time.sleep(5)
exit()
from cpuinfo import get_cpu_info
import GPUtil
import psutil
import colorama
import subprocess
from uptime import uptime
import pyautogui
import requests
import datetime
except ImportError:
os.system('cls')
try:
for i in range(5):
os.system('cls')
print('Attempting to install libraries... |')
time.sleep(0.3)
os.system('cls')
print('Attempting to install libraries... /')
time.sleep(0.3)
os.system('cls')
print('Attempting to install libraries... -')
time.sleep(0.3)
os.system('cls')
print('Attempting to install libraries... \\')
time.sleep(0.3)
os.system('cls')
print('Installation started...')
os.system('pip install py-cpuinfo GPUtil psutil colorama uptime pyautogui requests')
print('Almost ready...')
time.sleep(5)
exit()
except:
print('Done! Re-launch the program!')
time.sleep(3)
exit()
colorama.init()
def bar(var):
if var >= 0 and var <= 10:
loadbar = f'[ {colorama.Fore.RED}#{colorama.Fore.RESET}--------- ]'
elif var > 10 and var <= 20:
loadbar = f'[ {colorama.Fore.RED}##{colorama.Fore.RESET}-------- ]'
elif var > 20 and var <= 30:
laodbar = f'[ {colorama.Fore.YELLOW}###{colorama.Fore.RESET}------- ]'
elif var > 30 and var <= 40:
loadbar = f'[ {colorama.Fore.YELLOW}####{colorama.Fore.RESET}------ ]'
elif var > 40 and var <= 50:
loadbar = f'[ {colorama.Fore.GREEN}#####{colorama.Fore.RESET}----- ]'
elif var > 50 and var <= 60:
loadbar = f'[ {colorama.Fore.GREEN}######{colorama.Fore.RESET}---- ]'
elif var > 60 and var <= 70:
loadbar = f'[ {colorama.Fore.GREEN}#######{colorama.Fore.RESET}--- ]'
elif var > 70 and var <= 80:
loadbar = f'[ {colorama.Fore.GREEN}########{colorama.Fore.RESET}-- ]'
elif var > 80 and var <= 90:
loadbar = f'[ {colorama.Fore.GREEN}#########{colorama.Fore.RESET}- ]'
elif var > 90 and var <= 100:
loadbar = f'[ {colorama.Fore.GREEN}##########{colorama.Fore.RESET} ]'
return loadbar
class colors:
HEADER = '\033[95m'
BLUE = '\033[94m'
CYAN = '\033[96m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
os.system('cls')
print(f'{colors.FAIL}Fetching PC infos please wait.', end='')
def convert(seconds):
seconds = seconds % (24 * 3600)
hour = seconds // 3600
seconds %= 3600
minutes = seconds // 60
seconds %= 60
return "%d:%02d:%02d" % (hour, minutes, seconds)
## ---GENERAL VARIABLES--- ##
# CPU INFO #
try:
cpucores = psutil.cpu_count(logical=True)
cpuname = get_cpu_info()
cpuname = cpuname['brand_raw']
except:
cpucores = cpuname = 'N/A'
# PC/USER INFO #
try:
pc_username = os.getenv("UserName")
pc_name = os.getenv("COMPUTERNAME")
arch = platform.machine()
except:
pc_username, pc_name, arch = 'N/A'
# GPU INFO (ONLY NVIDIA) #
try:
gpus = GPUtil.getGPUs()
except:
gpus = []
if len(gpus)!=0:
for gpu in gpus:
gpu_id = gpu.name
gpu_mem = int(gpu.memoryTotal/1024)
gpu_used_memory = gpu.memoryUsed
gpu_total_memory = gpu.memoryTotal
gpu_temperature = gpu.temperature
gpuper = round(gpu_used_memory/gpu_total_memory*100, 2)
else:
gpu_id = 'N/A'
gpu_mem = '0'
gpuper = '0'
gpu_temperature = '0'
print(f'{colors.FAIL}.', end='')
# OS INFO #
opsys = platform.system()
opsysver = platform.version()
ver = platform.version().split('.')[2]
ver = ver.startswith('22')
if ver == True:
release = '11'
else:
release = platform.release()
# MOTHERBOARD & MANUFACTURER INFO #
try:
manufacturer = subprocess.check_output('wmic baseboard get Manufacturer').decode()
manufacturer = manufacturer[13:len(manufacturer)]
manufacturer = manufacturer.strip()
except:
manufacturer = 'N/A'
try:
product = subprocess.check_output('wmic baseboard get product').decode()
product = product[7:len(product)]
product = product.strip()
except:
product = 'N/A'
# UPTIME #
try:
uptime = time.strftime(f'{colorama.Fore.GREEN}Uptime{colorama.Fore.WHITE}: %H Hours, %M Minutes, %S Seconds', time.gmtime(uptime()))
except:
uptime = 'N/A'
# TOTAL APPS #
try:
apps = subprocess.check_output('winget list').decode()
line_count = 0
for character in apps:
if character == "\n":
line_count += 1
except:
line_count = 'N/A'
# DESKTOP #
de = 'N/A'
if platform.release() == 10:
de = 'Fluent'
elif platform.release() == 8:
de = 'Metro'
else:
de = 'Aero'
# SCREEN RATIO #
width, height = pyautogui.size()
# TRACK SHELL/TERMINAL #
term = psutil.Process( ).parent().parent().parent().name()
if term == 'WindowsTerminal.exe':
term = 'Windows Terminal'
elif term == 'explorer.exe':
term = 'Command Prompt (CMD)'
else:
term = 'Windows Powershell'
# MEMEORY INFO (RAM) #
totalram = round(psutil.virtual_memory().total/1000000000, 2)
usedram = round(psutil.virtual_memory()[3]/1000000000, 2)
freeram = round(psutil.virtual_memory()[1]/1000000000, 2)
usedrampercent = psutil.virtual_memory()[2]
# DISK COUNT #
disks = len(psutil.disk_partitions())
# PYTHON VERSION #
pyver = platform.python_version()
print(f'{colors.FAIL}.', end='')
# IP ADDRESS #
timeout = 5
try:
myip = requests.get('https://api.ipify.org', timeout=timeout).text
proxapi = requests.get(f'https://proxycheck.io/v2/{myip}?vpn=1&asn=1', timeout=timeout)
json = proxapi.json()
countryname = json[str(myip)]['country']
countrynamecode = json[str(myip)]['isocode']
json2 = proxapi.json()
isproxy = json2[myip]['proxy']
if isproxy == 'no':
isproxy = 'Clean IP'
elif isproxy == 'yes':
isproxy = 'Likely Proxy/VPN'
else:
isproxy = 'N/A'
except(requests.ConnectionError, requests.Timeout) as exception:
myip = 'N/A'
countryname = '?'
countrynamecode = '?'
isproxy = 'N/A'
# BATTERY INFO #
try:
battery = psutil.sensors_battery()
batterpercent = battery[0]
charging = battery[2]
barforpercent = bar(batterpercent)
if charging == True:
charging = 'Charging'
else:
charging = 'Discharging'
except:
battery = 'NO BATTERY'
batterpercent = '-'
charging = '-'
barforpercent = '[----------]'
def w10nf():
os.system('cls')
dashes = len(pc_name+pc_username)
dashes = dashes+1
dashes1 = ('-' * dashes)
print(f'''{colors.BLUE}
,,,,wgg&@$$$ {colorama.Fore.LIGHTRED_EX}{pc_username}{colorama.Fore.WHITE}@{colorama.Fore.LIGHTRED_EX}{pc_name}{colors.BLUE}
,,,,wgr @$$$lllllllllllllll {colorama.Fore.WHITE}{dashes1}{colors.BLUE}
@$$$$lllllllllF lllllllllllllllllll {colorama.Fore.GREEN}OS{colorama.Fore.WHITE}: {opsys} {release} {arch}{colors.BLUE}
llllllllllllllF lllllllllllllllllll {colorama.Fore.GREEN}Host{colorama.Fore.WHITE}: {manufacturer} {product}{colors.BLUE}
llllllllllllllF lllllllllllllllllll {colorama.Fore.GREEN}Kernel{colorama.Fore.WHITE}: {opsysver}{colors.BLUE}
llllllllllllllF lllllllllllllllllll {uptime}{colors.BLUE}
llllllllllllllF lllllllllllllllllll {colorama.Fore.GREEN}Apps{colorama.Fore.WHITE}: {line_count}{colors.BLUE}
**************` ******************* {colorama.Fore.GREEN}Terminal{colorama.Fore.WHITE}: {term}{colors.BLUE}
ggggggggggggggr ggwwwwwwwwwwwwwwwww {colorama.Fore.GREEN}Resolution{colorama.Fore.WHITE}: {width}x{height}{colors.BLUE}
llllllllllllllF lllllllllllllllllll {colorama.Fore.GREEN}CPU{colorama.Fore.WHITE}: {cpuname} ({cpucores}){colors.BLUE}
llllllllllllllF lllllllllllllllllll {colorama.Fore.GREEN}GPU{colorama.Fore.WHITE}: {gpu_id} {gpu_mem}GB ({gpuper}%) - ({gpu_temperature}°C){colors.BLUE}
llllllllllllllF lllllllllllllllllll {colorama.Fore.GREEN}Memory{colorama.Fore.WHITE}: {usedram}GB / {totalram}GB ({usedrampercent}%){colors.BLUE}
llllllllllllllF lllllllllllllllllll {colorama.Fore.GREEN}Disks{colorama.Fore.WHITE}: {disks}{colors.BLUE}
&&$lllllllllllF lllllllllllllllllll {colorama.Fore.GREEN}Python{colorama.Fore.WHITE}: {pyver}{colors.BLUE}
'"*** &&$llllllllllllllll {colorama.Fore.GREEN}IP{colorama.Fore.WHITE}: {myip}, {countryname} ({countrynamecode}), {isproxy}{colors.BLUE}
'"****&&&l {colorama.Fore.GREEN}Battery{colorama.Fore.WHITE}: {barforpercent} {batterpercent}%, {charging}{colors.BLUE}
''')
def w11nf():
os.system('cls')
dashes = len(pc_name+pc_username)
dashes = dashes+1
dashes1 = ('-' * dashes)
print(f'''{colors.CYAN}
################ ################ {colorama.Fore.LIGHTRED_EX}{pc_username}{colorama.Fore.WHITE}@{colorama.Fore.LIGHTRED_EX}{pc_name}{colors.CYAN}
################ ################ {colorama.Fore.WHITE}{dashes1}{colors.CYAN}
################ ################ {colorama.Fore.GREEN}OS{colorama.Fore.WHITE}: {opsys} {release} {arch}{colors.CYAN}
################ ################ {colorama.Fore.GREEN}Host{colorama.Fore.WHITE}: {manufacturer} {product}{colors.CYAN}
################ ################ {colorama.Fore.GREEN}Kernel{colorama.Fore.WHITE}: {opsysver}{colors.CYAN}
################ ################ {uptime}{colors.CYAN}
################ ################ {colorama.Fore.GREEN}Apps{colorama.Fore.WHITE}: {line_count}{colors.CYAN}
{colorama.Fore.GREEN}Terminal{colorama.Fore.WHITE}: {term}{colors.CYAN}
################ ################ {colorama.Fore.GREEN}Resolution{colorama.Fore.WHITE}: {width}x{height}{colors.CYAN}
################ ################ {colorama.Fore.GREEN}CPU{colorama.Fore.WHITE}: {cpuname} ({cpucores}){colors.CYAN}
################ ################ {colorama.Fore.GREEN}GPU{colorama.Fore.WHITE}: {gpu_id} {gpu_mem}GB ({gpuper}%) - ({gpu_temperature}°C){colors.CYAN}
################ ################ {colorama.Fore.GREEN}Memory{colorama.Fore.WHITE}: {usedram}GB / {totalram}GB ({usedrampercent}%){colors.CYAN}
################ ################ {colorama.Fore.GREEN}Disks{colorama.Fore.WHITE}: {disks}{colors.CYAN}
################ ################ {colorama.Fore.GREEN}Python{colorama.Fore.WHITE}: {pyver}{colors.CYAN}
################ ################ {colorama.Fore.GREEN}IP{colorama.Fore.WHITE}: {myip}, {countryname} ({countrynamecode}), {isproxy}{colors.CYAN}
{colorama.Fore.GREEN}Battery{colorama.Fore.WHITE}: {barforpercent} {batterpercent}%, {charging}{colors.CYAN}
''')
def w7nf():
os.system('cls')
dashes = len(pc_name+pc_username)
dashes = dashes+1
dashes1 = ('-' * dashes)
print(f'''
{colorama.Fore.LIGHTRED_EX},.=:!!t3Z3z., {colorama.Fore.LIGHTRED_EX}{pc_username}{colorama.Fore.WHITE}@{colorama.Fore.LIGHTRED_EX}{pc_name}
{colorama.Fore.LIGHTRED_EX}:tt:::tt333EE3 {colorama.Fore.WHITE}{dashes1}
{colorama.Fore.LIGHTRED_EX}Et:::ztt33EEEL {colors.GREEN}@Ee., .., {colorama.Fore.GREEN}OS{colorama.Fore.WHITE}: {opsys} {release} {arch}
{colorama.Fore.LIGHTRED_EX};tt:::tt333EE7 {colors.GREEN};EEEEEEttttt33# {colorama.Fore.GREEN}Host{colorama.Fore.WHITE}: {manufacturer} {product}
{colorama.Fore.LIGHTRED_EX}:Et:::zt333EEQ. {colors.GREEN}$EEEEEttttt33QL {colorama.Fore.GREEN}Kernel{colorama.Fore.WHITE}: {opsysver}
{colorama.Fore.LIGHTRED_EX}it::::tt333EEF {colors.GREEN}@EEEEEEttttt33F {uptime}{colors.CYAN}
{colorama.Fore.LIGHTRED_EX};3=*^```"*4EEV {colors.GREEN}:EEEEEEttttt33@. {colorama.Fore.GREEN}Apps{colorama.Fore.WHITE}: {line_count}
{colors.BLUE},.=::::!t=., ` {colors.GREEN}@EEEEEEtttz33QF {colorama.Fore.GREEN}Terminal{colorama.Fore.WHITE}: {term}
{colors.BLUE};::::::::zt33) {colors.GREEN}"4EEEtttji3P* {colorama.Fore.GREEN}Resolution{colorama.Fore.WHITE}: {width}x{height}
{colors.BLUE}:t::::::::tt33.{colors.YELLOW}:Z3z.. `` ,..g. {colorama.Fore.GREEN}CPU{colorama.Fore.WHITE}: {cpuname} ({cpucores})
{colors.BLUE}i::::::::zt33F {colors.YELLOW}AEEEtttt::::ztF {colorama.Fore.GREEN}GPU{colorama.Fore.WHITE}: {gpu_id} {gpu_mem}GB ({gpuper}%) - ({gpu_temperature}°C){colors.BLUE}
{colors.BLUE};:::::::::t33V {colors.YELLOW};EEEttttt::::t3 {colorama.Fore.GREEN}Memory{colorama.Fore.WHITE}: {usedram}GB / {totalram}GB ({usedrampercent}%)
{colors.BLUE}E::::::::zt33L {colors.YELLOW}@EEEtttt::::z3F {colorama.Fore.GREEN}Disks{colorama.Fore.WHITE}: {disks}
{colors.BLUE}(3=*^```"*4E3) {colors.YELLOW};EEEtttt:::::tZ` {colorama.Fore.GREEN}Python{colorama.Fore.WHITE}: {pyver}
{colors.BLUE}` {colors.YELLOW}:EEEEtttt::::z7 {colorama.Fore.GREEN}IP{colorama.Fore.WHITE}: {myip}, {countryname} ({countrynamecode}), {isproxy}{colors.BLUE}
{colors.YELLOW}"VEzjt:;;z>*` {colorama.Fore.GREEN}Battery{colorama.Fore.WHITE}: {barforpercent} {batterpercent}%, {charging}
''')
def w8nf():
os.system('cls')
dashes = len(pc_name+pc_username)
dashes = dashes+1
dashes1 = ('-' * dashes)
print(f'''{colors.BLUE}
,,,,wgg&@$$$ {colorama.Fore.LIGHTRED_EX}{pc_username}{colorama.Fore.WHITE}@{colorama.Fore.LIGHTRED_EX}{pc_name}{colors.BLUE}
,,,,wgr @$$$lllllllllllllll {colorama.Fore.WHITE}{dashes1}{colors.BLUE}
@$$$$lllllllllF lllllllllllllllllll {colorama.Fore.GREEN}OS{colorama.Fore.WHITE}: {opsys} {release} {arch}{colors.BLUE}
llllllllllllllF lllllllllllllllllll {colorama.Fore.GREEN}Host{colorama.Fore.WHITE}: {manufacturer} {product}{colors.BLUE}
llllllllllllllF lllllllllllllllllll {colorama.Fore.GREEN}Kernel{colorama.Fore.WHITE}: {opsysver}{colors.BLUE}
llllllllllllllF lllllllllllllllllll {uptime}{colors.BLUE}
llllllllllllllF lllllllllllllllllll {colorama.Fore.GREEN}Apps{colorama.Fore.WHITE}: {line_count}{colors.BLUE}
**************` ******************* {colorama.Fore.GREEN}Terminal{colorama.Fore.WHITE}: {term}{colors.BLUE}
ggggggggggggggr ggwwwwwwwwwwwwwwwww {colorama.Fore.GREEN}Resolution{colorama.Fore.WHITE}: {width}x{height}{colors.BLUE}
llllllllllllllF lllllllllllllllllll {colorama.Fore.GREEN}CPU{colorama.Fore.WHITE}: {cpuname} ({cpucores}){colors.BLUE}
llllllllllllllF lllllllllllllllllll {colorama.Fore.GREEN}GPU{colorama.Fore.WHITE}: {gpu_id} {gpu_mem}GB ({gpuper}%) - ({gpu_temperature}°C){colors.BLUE}
llllllllllllllF lllllllllllllllllll {colorama.Fore.GREEN}Memory{colorama.Fore.WHITE}: {usedram}GB / {totalram}GB ({usedrampercent}%){colors.BLUE}
llllllllllllllF lllllllllllllllllll {colorama.Fore.GREEN}Disks{colorama.Fore.WHITE}: {disks}{colors.BLUE}
&&$lllllllllllF lllllllllllllllllll {colorama.Fore.GREEN}Python{colorama.Fore.WHITE}: {pyver}{colors.BLUE}
'"*** &&$llllllllllllllll {colorama.Fore.GREEN}IP{colorama.Fore.WHITE}: {myip}, {countryname} ({countrynamecode}), {isproxy}{colors.BLUE}
'"****&&&l {colorama.Fore.GREEN}Battery{colorama.Fore.WHITE}: {barforpercent} {batterpercent}%, {charging}{colors.BLUE}
''')
def genericwinnf():
os.system('cls')
dashes = len(pc_name+pc_username)
dashes = dashes+1
dashes1 = ('-' * dashes)
print(f'''
{colorama.Fore.LIGHTRED_EX},.=:!!t3Z3z., {colorama.Fore.LIGHTRED_EX}{pc_username}{colorama.Fore.WHITE}@{colorama.Fore.LIGHTRED_EX}{pc_name}
{colorama.Fore.LIGHTRED_EX}:tt:::tt333EE3 {colorama.Fore.WHITE}{dashes1}
{colorama.Fore.LIGHTRED_EX}Et:::ztt33EEEL {colors.GREEN}@Ee., .., {colorama.Fore.GREEN}OS{colorama.Fore.WHITE}: {opsys} {release} {arch}
{colorama.Fore.LIGHTRED_EX};tt:::tt333EE7 {colors.GREEN};EEEEEEttttt33# {colorama.Fore.GREEN}Host{colorama.Fore.WHITE}: {manufacturer} {product}
{colorama.Fore.LIGHTRED_EX}:Et:::zt333EEQ. {colors.GREEN}$EEEEEttttt33QL {colorama.Fore.GREEN}Kernel{colorama.Fore.WHITE}: {opsysver}
{colorama.Fore.LIGHTRED_EX}it::::tt333EEF {colors.GREEN}@EEEEEEttttt33F {uptime}{colors.CYAN}
{colorama.Fore.LIGHTRED_EX};3=*^```"*4EEV {colors.GREEN}:EEEEEEttttt33@. {colorama.Fore.GREEN}Apps{colorama.Fore.WHITE}: {line_count}
{colors.BLUE},.=::::!t=., ` {colors.GREEN}@EEEEEEtttz33QF {colorama.Fore.GREEN}Terminal{colorama.Fore.WHITE}: {term}
{colors.BLUE};::::::::zt33) {colors.GREEN}"4EEEtttji3P* {colorama.Fore.GREEN}Resolution{colorama.Fore.WHITE}: {width}x{height}
{colors.BLUE}:t::::::::tt33.{colors.YELLOW}:Z3z.. `` ,..g. {colorama.Fore.GREEN}CPU{colorama.Fore.WHITE}: {cpuname} ({cpucores})
{colors.BLUE}i::::::::zt33F {colors.YELLOW}AEEEtttt::::ztF {colorama.Fore.GREEN}GPU{colorama.Fore.WHITE}: {gpu_id} {gpu_mem}GB ({gpuper}%) - ({gpu_temperature}°C)
{colors.BLUE};:::::::::t33V {colors.YELLOW};EEEttttt::::t3 {colorama.Fore.GREEN}Memory{colorama.Fore.WHITE}: {usedram}GB / {totalram}GB ({usedrampercent}%)
{colors.BLUE}E::::::::zt33L {colors.YELLOW}@EEEtttt::::z3F {colorama.Fore.GREEN}Disks{colorama.Fore.WHITE}: {disks}
{colors.BLUE}(3=*^```"*4E3) {colors.YELLOW};EEEtttt:::::tZ` {colorama.Fore.GREEN}Python{colorama.Fore.WHITE}: {pyver}
{colors.BLUE}` {colors.YELLOW}:EEEEtttt::::z7 {colorama.Fore.GREEN}IP{colorama.Fore.WHITE}: {myip}, {countryname} ({countrynamecode}), {isproxy}
{colors.YELLOW}"VEzjt:;;z>*` {colorama.Fore.GREEN}Battery{colorama.Fore.WHITE}: {barforpercent} {batterpercent}%, {charging}
''')
if release == '10':
w10nf()
elif release == '11':
w11nf()
elif release == '7':
w7nf()
elif release == '8' or '8.1':
w8nf()
else:
genericwinnf()