info.py 822 Bytes
import os

import tomb
from modules.module import Module
from runcmd import runProcess
import time


def getInstance():
    return INFOModule()

class INFOModule(Module):

    def __init__(self):
        self.name = "info"
        self.description = "Extracts information about this machine"
        self.requiredVars = []
        self.vars = {}

    def execute(self):
        path = tomb.getPath() + self.name + "/"
        if(not os.path.exists(path)):
            os.mkdir(path)
        output,code = runProcess("lshw")
        lshw = open(path + "lshw_" + str(int(time.time())) + ".txt", 'wb')
        lshw.write(output)
        lshw.close()

        output,code = runProcess("dmidecode")
        lshw = open(path + "dmidecode_" + str(int(time.time())) + ".txt", 'wb')
        lshw.write(output)
        lshw.close()