-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
170 lines (137 loc) · 5.31 KB
/
main.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
import os
import platform
import psutil
import wmi
import winreg
from clear import clear
from time import time
import sys
start_time = time()
clear()
yep = ["Yes", "yes", "Y", "y", "Да", "да", "1"]
wmix = wmi.WMI()
user_name = os.getlogin()
user_folder = os.path.expanduser('~')
print("User data collected!")
rel = platform.platform(aliased=True)
pc_name = platform.node()
pc_pid = os.getpid()
print("OS data collected!")
total_free_space = 0
for partition in psutil.disk_partitions():
mount_point = partition.mountpoint
try:
usage = psutil.disk_usage(mount_point)
total_free_space += usage.free
except PermissionError:
continue
space = total_free_space // (1024**3)
print("Free space collected!")
system = platform.system()
platform = platform.platform()
if system == "Windows":
cpudata = ""
regpath = r"HARDWARE\DESCRIPTION\System\CentralProcessor\0"
valuename = "ProcessorNameString"
try:
keyval = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, regpath)
cpudata = winreg.QueryValueEx(keyval, valuename)[0]
except WindowsError:
cpudata = "N/A"
from subprocess import Popen, PIPE
videodata = ""
cmd = "wmic path win32_VideoController get name"
p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
output, error = p.communicate()
if not error:
videodata = output.strip().decode('utf-8').split('\n')[1].strip()
else:
videodata = "N/A"
else:
print("Windows OS supported only!")
process = psutil.Process()
ram_total = psutil.virtual_memory().total
print("RAM data collected!")
cpu_cores = psutil.cpu_count(logical=True)
cpu_load = round(psutil.cpu_percent())
print("CPU data collected!")
print('\033[37m')
clear()
def print_all():
print("----------------------------------------------------------")
print("User:", user_name)
print("User Dir:", user_folder)
print(f"PC Name: {pc_name}")
print(f"PID: {pc_pid}")
print("OS:", rel)
print("----------------------------------------------------------")
print("Free Space: ~", space, "GB")
for item in wmix.Win32_BaseBoard():
print("Motherboard: {} ".format(item.Product))
print("CPU: {}".format(cpudata))
print("CPU Cores:", cpu_cores)
print(f"CPU Load: {cpu_load} %")
print("----------------------------------------------------------")
i_gpu = 0
try:
from gpuinfo.nvidia import get_gpus
for gpu in get_gpus():
gpu_name = gpu.__dict__["name"]
gpu_video = gpu.__dict__["total_memory"]
gpu_clock_max = gpu.get_max_clock_speeds()["max_core_clock_speed"]
gpu_vram_clock_max = gpu.get_max_clock_speeds()["max_memory_clock_speed"]
gpu_clock = gpu.get_clock_speeds()["core_clock_speed"]
gpu_vram_clock = gpu.get_clock_speeds()["memory_clock_speed"]
gpu_used_memory = gpu.get_memory_details()["used_memory"]
gpu_free_memory = gpu.get_memory_details()["free_memory"]
print(f"GPU {i_gpu}: {gpu_name}")
print(f"GPU {i_gpu} VRAM: {gpu_video} MB")
print(f"GPU {i_gpu} Used VRAM: {gpu_used_memory} MB")
print(f"GPU {i_gpu} Free VRAM: {gpu_free_memory} MB")
print(f"GPU {i_gpu} Clock Speed: {gpu_clock} MHz")
print(f"GPU {i_gpu} VRAM Clock Speed: {gpu_vram_clock} MHz")
print(f"GPU {i_gpu} Max Clock Speed: {gpu_clock_max} MHz")
print(f"GPU {i_gpu} Max VRAM Clock Speed: {gpu_vram_clock_max} MHz")
print("----------------------------------------------------------")
i_gpu += 1
except Exception:
from gpuinfo.windows import get_gpus
for gpu in get_gpus():
gpu_name = gpu.__dict__["name"]
gpu_video = gpu.__dict__["total_memory"]
print(f"GPU {i_gpu}: {gpu_name}")
print(f"GPU {i_gpu} VRAM: {gpu_video}")
i_gpu += 1
print("----------------------------------------------------------")
for monitor in wmix.Win32_PnPEntity():
if 'monitor' in str(monitor.caption).lower():
model_info = monitor.caption.split('(')[-1].replace(')', '')
print(f"Monitor Model: {model_info}")
print("----------------------------------------------------------")
ram_slots = -1
for item in wmix.Win32_PhysicalMemory():
if item == item:
ram_slots += 1
print(f"RAM {ram_slots}: {{}}".format(item.PartNumber))
else:
print("RAM: {} ".format(item.PartNumber))
print("RAM Capacity:", ram_total//1024//1024//1024, "GB")
for item in wmix.Win32_PhysicalMemory():
print(f"RAM Frequency: {item.Speed} Hz")
break
print("----------------------------------------------------------")
print("")
file_name = pc_name + ".txt"
with open(file_name, "w") as f:
sys.stdout = f
print_all()
sys.stdout = sys.__stdout__
print_all()
end_time = time()
total_time = round(end_time - start_time, 2)
print('\033[33m')
print(f"Information search time: ~{total_time} seconds")
print(f"All your PC specs. writen in {pc_name}.txt!")
print("Bye!")
print("\(★ω★)/")
input()