mirror of
https://gitlab.com/Nils_Kasulke/spectre_project.git
synced 2026-04-03 23:37:25 +00:00
e480 specs test
This commit is contained in:
34
add_system.py
Normal file
34
add_system.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from subprocess import check_output
|
||||
from os import name as os_name
|
||||
|
||||
|
||||
def os_info():
|
||||
if os_name == 'nt':
|
||||
return command_to_string(['ver'])
|
||||
else:
|
||||
return command_to_string(['uname', '-a'])
|
||||
def cpu_info():
|
||||
if os_name == 'nt':
|
||||
return command_to_string(['powershell', 'Get-WmiObject', '-class', 'win32_processor'])
|
||||
else:
|
||||
return read_file("/proc/cpuinfo")
|
||||
|
||||
def mem_info():
|
||||
if os_name == 'nt':
|
||||
return command_to_string(['powershell', 'Get-WmiObject', '-class', 'win32_Physicalmemory'])
|
||||
else:
|
||||
return read_file("/proc/mem")
|
||||
|
||||
def command_to_string(command):
|
||||
return check_output(command, shell=True).decode("UTF-8")
|
||||
|
||||
def read_file(fileName):
|
||||
with open(fileName) as f:
|
||||
return f.read()
|
||||
|
||||
cpu = cpu_info()
|
||||
os = os_info()
|
||||
mem = mem_info()
|
||||
print(os)
|
||||
print(cpu)
|
||||
print(mem)
|
||||
Reference in New Issue
Block a user