1
2
import os
3
4
5
import tomb
from modules.module import Module
from runcmd import runProcess
root
authored
2016-12-24 06:15:13 +0100
6
import time
7
8
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 = {}
20
def execute ( self ):
21
path = tomb . getPath () + self . name + "/"
22
23
24
if ( not os . path . exists ( path )):
os . mkdir ( path )
output , code = runProcess ( "lshw" )
root
authored
2016-12-24 06:15:13 +0100
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
2016-12-24 06:15:13 +0100
30
lshw = open ( path + "dmidecode_" + str ( int ( time . time ())) + ".txt" , 'wb' )
31
lshw . write ( output )
root
authored
2016-12-24 06:15:13 +0100
32
lshw . close ()