-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmain.py
More file actions
215 lines (192 loc) · 9.39 KB
/
Copy pathmain.py
File metadata and controls
215 lines (192 loc) · 9.39 KB
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
import platform
import psutil
import os
import socket
import time
import hashlib
from colorama import Fore, Style, init
import pyfiglet
import webbrowser
init(autoreset=True)
def get_hwid():
try:
hostname = socket.gethostname()
mac_addresses = []
for interface, addrs in psutil.net_if_addrs().items():
for addr in addrs:
if addr.family == psutil.AF_LINK:
mac_addresses.append(addr.address)
hwid_str = f"{hostname}{''.join(mac_addresses)}"
hwid_hash = hashlib.md5(hwid_str.encode()).hexdigest()
return hwid_hash
except Exception as e:
return str(e)
def open_link(link):
try:
webbrowser.open(link)
except Exception as e:
print(f"{Fore.RED}An error occurred while opening the link: {str(e)}{Style.RESET_ALL}")
def get_system_info():
try:
while True:
system_info = {}
# Operating System Information
system_info['Operating System'] = platform.system()
system_info['OS Version'] = platform.version()
system_info['Architecture'] = platform.architecture()
# CPU Information
system_info['Processor'] = platform.processor()
system_info['CPU Cores'] = os.cpu_count()
system_info['CPU Usage'] = f"{psutil.cpu_percent(interval=1)}%"
# Memory Information
virtual_memory = psutil.virtual_memory()
swap_memory = psutil.swap_memory()
system_info['Total Memory (RAM)'] = f"{virtual_memory.total / (1024 ** 3):.2f} GB"
system_info['Available Memory'] = f"{virtual_memory.available / (1024 ** 3):.2f} GB"
system_info['Memory Usage'] = f"{virtual_memory.percent}%"
system_info['Swap Memory'] = f"{swap_memory.total / (1024 ** 3):.2f} GB"
# GPU Information (if NVIDIA GPU is available)
try:
import py3nvml
py3nvml.py3nvml.nvmlInit()
device_count = py3nvml.py3nvml.nvmlDeviceGetCount()
gpu_info = []
for i in range(device_count):
handle = py3nvml.py3nvml.nvmlDeviceGetHandleByIndex(i)
gpu_name = py3nvml.py3nvml.nvmlDeviceGetName(handle)
gpu_memory_info = py3nvml.py3nvml.nvmlDeviceGetMemoryInfo(handle)
gpu_info.append({
'GPU Name': gpu_name,
'GPU Memory Total': f"{gpu_memory_info.total / (1024 ** 3):.2f} GB",
'GPU Memory Used': f"{gpu_memory_info.used / (1024 ** 3):.2f} GB",
'GPU Memory Free': f"{gpu_memory_info.free / (1024 ** 3):.2f} GB",
'GPU Memory Usage': f"{(gpu_memory_info.used / gpu_memory_info.total) * 100:.2f}%"
})
system_info['GPU Information'] = gpu_info
except Exception as e:
system_info['GPU Information'] = f"No NVIDIA GPU found"
# Disk Information
partitions = psutil.disk_partitions()
disk_info = []
for partition in partitions:
usage = psutil.disk_usage(partition.mountpoint)
disk_info.append({
'Device': partition.device,
'Mount Point': partition.mountpoint,
'File System Type': partition.fstype,
'Total Size': f"{usage.total / (1024 ** 3):.2f} GB",
'Used Space': f"{usage.used / (1024 ** 3):.2f} GB",
'Free Space': f"{usage.free / (1024 ** 3):.2f} GB",
'Disk Usage Percentage': f"{usage.percent}%"
})
system_info['Disk Information'] = disk_info
# Network Information
network_info = []
network_counters = psutil.net_if_addrs()
for interface, addrs in network_counters.items():
interface_info = {'Interface': interface}
for addr in addrs:
if addr.family == socket.AF_INET:
interface_info['IPv4 Address'] = addr.address
interface_info['Subnet Mask'] = addr.netmask
elif addr.family == socket.AF_INET6:
interface_info['IPv6 Address'] = addr.address
network_info.append(interface_info)
system_info['Network Information'] = network_info
# Additional Information
system_info['Hostname'] = socket.gethostname()
system_info['Current User'] = os.getlogin()
system_info['HWID'] = get_hwid()
yield system_info
time.sleep(10) # Update every 10 seconds
except Exception as e:
yield f"{Fore.RED}An error occurred: {str(e)}{Style.RESET_ALL}"
def get_process_info():
try:
while True:
process_info = []
for process in psutil.process_iter(attrs=['pid', 'name', 'cpu_percent', 'memory_percent']):
try:
process_info.append({
'Process ID': process.info['pid'],
'Name': process.info['name'],
'CPU Usage': f"{process.info['cpu_percent']:.2f}%",
'Memory Usage': f"{process.info['memory_percent']:.2f}%"
})
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
pass
yield process_info
except Exception as e:
yield f"{Fore.RED}An error occurred: {str(e)}{Style.RESET_ALL}"
def display_colored_system_info(system_info):
os.system('cls' if os.name == 'nt' else 'clear')
ascii_banner = pyfiglet.figlet_format("WICK TOOL", font="slant")
print(f"{Fore.CYAN}{ascii_banner}{Style.RESET_ALL}")
for category, info in system_info.items():
print(f"{Fore.YELLOW}{category}:{Style.RESET_ALL}")
if isinstance(info, list):
for item in info:
for key, value in item.items():
print(f" {key}: {Fore.CYAN}{value}{Style.RESET_ALL}")
else:
print(f" {info}")
def display_colored_process_info(process_info):
os.system('cls' if os.name == 'nt' else 'clear')
ascii_banner = pyfiglet.figlet_format("WICK TOOL", font="slant")
print(f"{Fore.CYAN}{ascii_banner}{Style.RESET_ALL}")
print(f"{Fore.YELLOW}Process Information:{Style.RESET_ALL}")
if not process_info:
print(f" No running processes")
else:
for process in process_info:
for key, value in process.items():
print(f" {key}: {Fore.CYAN}{value}{Style.RESET_ALL}")
def main():
while True:
os.system('cls' if os.name == 'nt' else 'clear')
ascii_banner = pyfiglet.figlet_format("WICK TOOL", font="slant")
print(f"{Fore.CYAN}{ascii_banner}{Style.RESET_ALL}")
print(f"{Fore.GREEN}Main Menu:{Style.RESET_ALL}")
print(f" {Fore.MAGENTA}1. Display System Information{Style.RESET_ALL}")
print(f" {Fore.MAGENTA}2. Display Process Information{Style.RESET_ALL}")
print(f" {Fore.MAGENTA}3. Contact Info{Style.RESET_ALL}")
print(f" {Fore.MAGENTA}4. Exit{Style.RESET_ALL}")
choice = input(f"{Fore.YELLOW}Enter your choice: {Style.RESET_ALL}")
if choice == '1':
system_info_generator = get_system_info()
system_info = next(system_info_generator)
display_colored_system_info(system_info)
input("Press Enter to go back to main menu...")
elif choice == '2':
process_info_generator = get_process_info()
while True:
process_info = next(process_info_generator)
display_colored_process_info(process_info)
option = input(f"{Fore.YELLOW}Enter '1' to go back to the main menu : {Style.RESET_ALL}")
if option == '1':
break
elif choice == '3':
while True:
os.system('cls' if os.name == 'nt' else 'clear')
ascii_banner = pyfiglet.figlet_format("WICK TOOL", font="slant")
print(f"{Fore.CYAN}{ascii_banner}{Style.RESET_ALL}")
print(f"{Fore.GREEN}Contact Info:{Style.RESET_ALL}")
print(f" {Fore.MAGENTA}1. My Website{Style.RESET_ALL}")
print(f" {Fore.MAGENTA}2. My GitHub{Style.RESET_ALL}")
print(f" {Fore.MAGENTA}3. My Instagram{Style.RESET_ALL}")
print(f" {Fore.MAGENTA}4. Go Back to Main Menu{Style.RESET_ALL}")
contact_choice = input(f"{Fore.YELLOW}Enter a number : {Style.RESET_ALL}")
if contact_choice == '1':
open_link("https://wickdev.xyz/")
elif contact_choice == '2':
open_link("https://github.com/Wickdev077")
elif contact_choice == '3':
open_link("https://www.instagram.com/mik__subhi/")
elif contact_choice == '4':
break
else:
print(f"{Fore.RED}Invalid choice. Please enter a valid option.{Style.RESET_ALL}")
elif choice == '4':
break
if __name__ == "__main__":
main()