Example #1
0
def type_15_system_log():
    if __verbose:
        print("Gathering system log information...")
    __type = 15
    if __verbose:
        print(dmidecode.get_by_type(__type)[0])
    clean = list()
    out = dmidecode.get_by_type(__type)[0]
    for k in out:
        clean.append(out[k])

    write(out)
    return clean
Example #2
0
 def getHardwareInfo(self):
     ## onely run once dmidecode to get all info
     hardware_info = dmidecode.get_by_type(1)[0]
     hardware_id = re.sub('-', '', hardware_info['UUID'])
     hardware_type = hardware_info['Product Name']
     result = [hardware_id, hardware_type]
     return (result)
Example #3
0
def type_9_system_slots():
    if __verbose:
        print("Gathering sytem slots information...")
    l = ["Bus Address"]
    data = list()
    __type = 9
    if __verbose:
        print(dmidecode.get_by_type(__type)[0])
    for elm in l:
        piece = dmidecode.get_by_type(__type)[0][elm]
        if __verbose:
            print(piece)
        data.append(piece)

    write(dmidecode.get_by_type(__type)[0])
    return data
Example #4
0
def type_3_chassis_information():
    if __verbose:
        print("Gathering chassis information... ")
    # potentially unique or can be different for some reason
    l = ["Manufacturer", "Serial Number", "Number Of Power Cords", "SKU Number"]
    data = list()
    __type = 3
    if __verbose:
        print(dmidecode.get_by_type(__type)[0])
    for elm in l:
        piece = dmidecode.get_by_type(__type)[0][elm]
        if __verbose:
            print(piece)    
        data.append(piece)
    write(dmidecode.get_by_type(__type)[0])
    return data
Example #5
0
def type_2_base_board_information():
    if __verbose:
        print("Gathering base board information...")

    # potentially unique or can be different for some reason
    l = ["Serial Number", "Product Name", "Version"]
    data = list()
    __type = 2
    if __verbose:
        print(dmidecode.get_by_type(__type)[0])
    for elm in l:
        piece = dmidecode.get_by_type(__type)[0][elm]
        if __verbose:
            print(piece)
        data.append(piece)
    write(dmidecode.get_by_type(__type)[0])
    return data
Example #6
0
def type_1_system_information():
    if __verbose:
        print("Gathering system information... ")

    # potentially unique or can be different for some reason
    l = ["Serial Number", "UUID", "SKU Number"]
    data = list()
    __type = 1
    if __verbose:
        print(dmidecode.get_by_type(__type)[0])
    for elm in l:
        piece = dmidecode.get_by_type(__type)[0][elm]
        if __verbose:
            print(piece)
        data.append(piece)
    write(dmidecode.get_by_type(__type)[0])
    return data
Example #7
0
def type_4_processor_information():
    if __verbose:
        print("Gathering processor information")
    core ="Core"
    # potentially unique or can be different for some reason
    l = ["Signature", "Upgrade", "Version", "External Clock", "Core Enabled", "Thread Count", "ID"]
    data = list()
    __type = 4
    if __verbose:
        print(dmidecode.get_by_type(__type)[0])
    for elm in l:
        piece = dmidecode.get_by_type(__type)[0][elm]
        if __verbose:
            print(piece)    
        data.append(piece)

    write(dmidecode.get_by_type(__type)[0])
    return data
Example #8
0
def type_11_OEM_strings():
    if __verbose:
        print("Gathering OEM strings...")
    l = ["Bus Address"]
    data = list()
    __type = 11
    count = len(
        dmidecode.get_by_type(__type)[0]) - 2  # 8 can be used for simplicity
    if __verbose:
        print(dmidecode.get_by_type(__type)[0])
        print("Count: ", count)
    for elm in range(count):
        str_x = f"String {elm}"
        if str_x in dmidecode.get_by_type(__type)[0]:
            piece = dmidecode.get_by_type(__type)[0][str_x]
            if __verbose:
                print(piece)
            data.append(piece)
    write(dmidecode.get_by_type(__type)[0])
    return data
      print('[WARNING] Dependencies are missing, please verify that you have installed: ', dep)
      exit()

print('[*] Creating VirtualBox modifications ..')

# Randomize serial
def serial_randomize(start=0, string_length=10):
    rand = str(uuid.uuid4())
    rand = rand.upper()
    rand = re.sub('-', '', rand)
    return rand[start:string_length]

dmi_info = {}

try:
   for v in dmidecode.get_by_type(0):
     if type(v) == dict and v['DMIType'] == 0:
        dmi_info['DmiBIOSVendor'] =  "string:" + v['Vendor']
        dmi_info['DmiBIOSVersion'] =  "string:" + v['Version'].replace(" ", "")
        biosversion = v['BIOS Revision']
        dmi_info['DmiBIOSReleaseDate'] =  "string:" + v['Release Date']
except:
   # This typo is deliberate, as a previous version of py-dmidecode contained a typo 
   dmi_info['DmiBIOSReleaseDate'] =  "string:" + v['Relase Date']

try:
    dmi_info['DmiBIOSReleaseMajor'], dmi_info['DmiBIOSReleaseMinor'] = biosversion.split('.', 1)
except:
    dmi_info['DmiBIOSReleaseMajor'] = '** No value to retrieve **'
    dmi_info['DmiBIOSReleaseMinor'] = '** No value to retrieve **'
Example #10
0
 def getOSId(self):
     hardware_info = dmidecode.get_by_type(1)[0]
     hardware_id = re.sub('-', '', hardware_info['UUID'])
     result = '{}{}'.format(hardware_id, self.container_id)
     return (result)
Example #11
0
 def getOSId(self):
     hardware_info = dmidecode.get_by_type(1)[0]
     hardware_id = re.sub('-', '',hardware_info['UUID'])
     result = hardware_id
     return(result)
Example #12
0
def check_for_new():
    args = len(sys.argv)
    for i in range(args):
        if i == 0:
            continue
        print(dmidecode.get_by_type(int(sys.argv[i])))