from subprocess import Popen, PIPE
def hostname():
hostname = Popen(["hostname"], stdout=PIPE)
hostname = hostname.stdout.read()
return hostname
def osversion():
with open("/etc/issue") as f:
osversion = f.read()
return osversion
def oscoreversion():
oscoreversion = Popen(["uname", "-r"], stdout=PIPE)
oscoreversion = oscoreversion.stdout.read()
return oscoreversion
def cpuinfo():
corenumber = []
with open("/proc/cpuinfo") as cpuinfo:
for i in cpuinfo:
if i.startswith("processor"):
corenumber.append(i)
if i.startswith("model name"):
cpumode = i.split(":")[1]
return corenumber, cpumode
def meminfo():
with open("/proc/meminfo") as meminfo:
for i in meminfo:
if i.startswith("MemTotal"):
totalmem = i.split(":")[1]
return totalmem