-
Notifications
You must be signed in to change notification settings - Fork 1
/
sysinfo.py
executable file
·39 lines (34 loc) · 1.69 KB
/
sysinfo.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
#!/usr/bin/env python3
import distro # https://distro.readthedocs.io/en/latest/
import platform # https://docs.python.org/3/library/platform.html
import subprocess
import re
print("\n **Motherboard**")
mb_manufacturer = open('/sys/devices/virtual/dmi/id/board_vendor', 'r').readline().rstrip()
mb_model = open('/sys/devices/virtual/dmi/id/board_name', 'r').readline().rstrip()
mb_board_version = open('/sys/devices/virtual/dmi/id/board_version', 'r').readline().rstrip()
mb_bios_date = open('/sys/devices/virtual/dmi/id/bios_date', 'r').readline().rstrip()
mb_bios_version = open('/sys/devices/virtual/dmi/id/bios_version', 'r').readline().rstrip()
print(f"Board Vender: {mb_manufacturer}")
print(f"Board Model: {mb_model}")
print(f"Board Version: {mb_board_version}")
print(f"BIOS Date: {mb_bios_date}")
print(f"BIOS Version: {mb_bios_version}")
print("\n **CPU Hardware**")
with open("/proc/cpuinfo") as f:
cpuinfo = f.read()
cpu_model_name = re.search(r'model name.+', cpuinfo)[0].split(': ')[1]
cpu_core_count = re.search(r'cpu cores.+', cpuinfo)[0].split(': ')[1]
print(cpu_model_name)
print(cpu_core_count, "cores")
print("\n **GPU Hardware**")
subprocess.run('glxinfo 2>&1 | grep "OpenGL renderer string"', shell=True, check=False).stdout
subprocess.run('lspci -d ::0300 -nn', shell=True, check=False).stdout
print("\n **Software**")
# subprocess.run('uname -r', shell=True, check=False).stdout
arch = platform.uname().machine
distro_name = distro.name(pretty=True) + ' - ' + distro.version(pretty=True)
kernel_version = platform.uname().release
print(f"{distro_name} {arch}")
print(f"Linux kernel {kernel_version}")
subprocess.run('glxinfo 2>&1 | grep "OpenGL version string"', shell=True, check=False).stdout