info.py 749 Bytes
import os

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


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.txt", 'wb')
        lshw.write(output)
        lshw.close()

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