Blame view

modules/info.py 745 Bytes
Imanol-Mikel Barba Sabariego authored
1
2
import os
3
4
5
6
7
import tomb
from modules.module import Module
from runcmd import runProcess
Imanol-Mikel Barba Sabariego authored
8
9
10
11
12
13
14
15
16
17
18
19
20
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 run(self):
        path = tomb.getPath() + self.name + "/"
21
22
23
24
25
26
27
28
29
30
31
        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()