Blame view

modules/info.py 822 Bytes
Imanol-Mikel Barba Sabariego authored
1
2
import os
3
4
5
import tomb
from modules.module import Module
from runcmd import runProcess
root authored
6
import time
7
8
Imanol-Mikel Barba Sabariego authored
9
10
11
12
13
14
15
16
17
18
19
def getInstance():
    return INFOModule()

class INFOModule(Module):

    def __init__(self):
        self.name = "info"
        self.description = "Extracts information about this machine"
        self.requiredVars = []
        self.vars = {}
Imanol-Mikel Barba Sabariego authored
20
    def execute(self):
Imanol-Mikel Barba Sabariego authored
21
        path = tomb.getPath() + self.name + "/"
22
23
24
        if(not os.path.exists(path)):
            os.mkdir(path)
        output,code = runProcess("lshw")
root authored
25
        lshw = open(path + "lshw_" + str(int(time.time())) + ".txt", 'wb')
26
27
28
29
        lshw.write(output)
        lshw.close()

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