-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGather_sysinfo.py
More file actions
63 lines (53 loc) · 2.53 KB
/
Gather_sysinfo.py
File metadata and controls
63 lines (53 loc) · 2.53 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
import wmi
from colorama import init, Fore, Style
def run_system_feed():
init(autoreset=True)
def format_bytes_to_gb(bytes_kb):
"""Convert KB to GB and format to 2 decimal places"""
return f"{(int(bytes_kb) / 1024 / 1024):.2f} GB"
def print_section(title):
"""Print a formatted section header"""
print()
print(Fore.CYAN + "=" * 60)
print(Fore.CYAN + f"{title:^60}")
print(Fore.CYAN + "=" * 60)
def print_subsection(title):
"""Print a subsection header"""
print()
print(Fore.YELLOW + f" → {title}")
print(Fore.YELLOW + "-" * 40)
try:
connection = wmi.WMI()
print_section("OPERATING SYSTEM INFORMATION")
for os in connection.Win32_OperatingSystem():
print(f"OS Edition : {os.Caption.strip()}")
print(f"Architecture : {os.OSArchitecture}")
print(f"Build Number : {os.BuildNumber}")
print(f"Build Type : {os.BuildType}")
print(f"Organization : {os.Organization or 'N/A'}")
print(f"Total Memory : {format_bytes_to_gb(os.TotalVisibleMemorySize)}")
print(f"Free Memory : {format_bytes_to_gb(os.FreePhysicalMemory)}")
print_section("COMPUTER SYSTEM INFORMATION")
for system in connection.Win32_ComputerSystem():
print(f"System Name : {system.Name}")
print(f"System Type : {system.SystemType}")
print(f"Status : {system.Status}")
print(f"Physical Processors: {system.NumberOfProcessors}")
print(f"Logical Processors : {system.NumberOfLogicalProcessors}")
print_section("NETWORK ADAPTER INFORMATION")
found_adapters = False
for network in connection.Win32_NetworkAdapterConfiguration():
if network.MACAddress:
found_adapters = True
print_subsection("Network Adapter")
print(f"Adapter : {network.Description or 'Unknown'}")
print(f"Caption : {network.Caption}")
print(f"MAC Address : {network.MACAddress}")
if network.IPAddress:
print(f"IP Addresses : {', '.join(network.IPAddress)}")
else:
print(f"IP Addresses : N/A")
if not found_adapters:
print("No active network adapters with MAC address found.")
except Exception as e:
print(Fore.RED + " An error occurred: " + str(e))