diff --git a/lib/linux/__pycache__/get_browsers.cpython-37.pyc b/lib/linux/__pycache__/get_browsers.cpython-37.pyc deleted file mode 100644 index a5fec44..0000000 Binary files a/lib/linux/__pycache__/get_browsers.cpython-37.pyc and /dev/null differ diff --git a/lib/linux/__pycache__/get_drives.cpython-37.pyc b/lib/linux/__pycache__/get_drives.cpython-37.pyc deleted file mode 100644 index d2c7ec4..0000000 Binary files a/lib/linux/__pycache__/get_drives.cpython-37.pyc and /dev/null differ diff --git a/lib/linux/__pycache__/get_hw_info.cpython-37.pyc b/lib/linux/__pycache__/get_hw_info.cpython-37.pyc deleted file mode 100644 index 28ac958..0000000 Binary files a/lib/linux/__pycache__/get_hw_info.cpython-37.pyc and /dev/null differ diff --git a/lib/linux/__pycache__/get_network_info.cpython-37.pyc b/lib/linux/__pycache__/get_network_info.cpython-37.pyc deleted file mode 100644 index 0b34c43..0000000 Binary files a/lib/linux/__pycache__/get_network_info.cpython-37.pyc and /dev/null differ diff --git a/lib/linux/__pycache__/get_os_info.cpython-37.pyc b/lib/linux/__pycache__/get_os_info.cpython-37.pyc deleted file mode 100644 index 3027c13..0000000 Binary files a/lib/linux/__pycache__/get_os_info.cpython-37.pyc and /dev/null differ diff --git a/lib/linux/__pycache__/get_package_list.cpython-37.pyc b/lib/linux/__pycache__/get_package_list.cpython-37.pyc deleted file mode 100644 index 6943d3b..0000000 Binary files a/lib/linux/__pycache__/get_package_list.cpython-37.pyc and /dev/null differ diff --git a/lib/linux/__pycache__/get_ports.cpython-37.pyc b/lib/linux/__pycache__/get_ports.cpython-37.pyc deleted file mode 100644 index f95c7e6..0000000 Binary files a/lib/linux/__pycache__/get_ports.cpython-37.pyc and /dev/null differ diff --git a/lib/linux/__pycache__/get_startup_list.cpython-37.pyc b/lib/linux/__pycache__/get_startup_list.cpython-37.pyc deleted file mode 100644 index 089429f..0000000 Binary files a/lib/linux/__pycache__/get_startup_list.cpython-37.pyc and /dev/null differ diff --git a/lib/linux/__pycache__/list_files.cpython-37.pyc b/lib/linux/__pycache__/list_files.cpython-37.pyc deleted file mode 100644 index c558b6f..0000000 Binary files a/lib/linux/__pycache__/list_files.cpython-37.pyc and /dev/null differ diff --git a/lib/windows/HardwareInfo.py b/lib/windows/HardwareInfo.py index f190510..cf6be8a 100644 --- a/lib/windows/HardwareInfo.py +++ b/lib/windows/HardwareInfo.py @@ -73,7 +73,7 @@ def getHardwareinfo(self): Return bios,cpu,usb information ''' hardwarinfo={ - 'usb':self.usbPortInfo() + 'usb':[self.usbPortInfo()] } Hardware_parameter=['onboarddevice','bios','cpu','BASEBOARD','CSPRODUCT','PORTCONNECTOR','SYSTEMSLOT'] for part in Hardware_parameter: diff --git a/lib/windows/NetworkInfo.py b/lib/windows/NetworkInfo.py index 6575eda..802de63 100644 --- a/lib/windows/NetworkInfo.py +++ b/lib/windows/NetworkInfo.py @@ -80,10 +80,11 @@ def networkinfo(self): objectName.networkinfo() ''' network_info={} - network_info['ip']=self.getIpConfig() - network_info['HostNodeName']=self.getNetworkName() - network_info['IpAddress']=self.getIpAddress() - network_info['MacAddress']=self.getMacAddress() + ipandmacAddress={} + ipandmacAddress['HostNodeName']=self.getNetworkName() + ipandmacAddress['IpAddress']=self.getIpAddress() + ipandmacAddress['MacAddress']=self.getMacAddress() + network_info['ipandmacAddress']=[ipandmacAddress] network_categories=['netclient','NETPROTOCOL','nic','RDNIC','NICCONFIG'] for part in network_categories: network_info[part]=self.Preprocess(part) diff --git a/lib/windows/SoftwareInfo.py b/lib/windows/SoftwareInfo.py index 9e9bea2..9130ea0 100644 --- a/lib/windows/SoftwareInfo.py +++ b/lib/windows/SoftwareInfo.py @@ -52,7 +52,10 @@ def getSoftwareList(self): Get All installed Softwae in th list format with name,version,publisher ''' try: - return self.getReg_keys(reg.KEY_WOW64_32KEY)+self.getReg_keys(reg.KEY_WOW64_64KEY) + all_installed_apps={} + all_installed_apps["installedPrograms"]=self.getReg_keys(reg.KEY_WOW64_32KEY)+(self.getReg_keys(reg.KEY_WOW64_64KEY)) + all_installed_apps["WebBrowsers"]=self.GetInstalledBrowsers() + return all_installed_apps except Exception as ex: return ex @@ -68,13 +71,15 @@ def GetInstalledBrowsers(self): Regkey = reg.ConnectRegistry(None, Hkeys) key = reg.OpenKey(Regkey, path,0, reg.KEY_READ | reg.KEY_WOW64_32KEY) key_count = reg.QueryInfoKey(key)[0] + browser={} browser_list=[] for i in range(key_count): singsoft={} try: keyname=reg.EnumKey(key, i) - browser_list.append(keyname) + singsoft['id']=i + singsoft['Name']=keyname + browser_list.append(singsoft) except Exception as ex: continue return browser_list - diff --git a/lib/windows/StorageInfo.py b/lib/windows/StorageInfo.py index 455ba97..a7286b8 100644 --- a/lib/windows/StorageInfo.py +++ b/lib/windows/StorageInfo.py @@ -95,7 +95,7 @@ def getStorageinfo(self): sinfo['Ram']=self.getRamSize() sinfo['DiskSize']=self.getDiskSize() - storage_catgories=['memoryphiscial','logicaldisk','CDROM','DEVICEMEMORYADDRESS','DISKDRIVE','DISKQUOTA','DMACHANNEL','LOGICALDISK','MEMCACHE','MEMORYCHIP','MEMPHYSICAL','PAGEFILE','PARTITION','VOLUME'] + storage_catgories=['logicaldisk','CDROM','DEVICEMEMORYADDRESS','DISKDRIVE','DISKQUOTA','DMACHANNEL','LOGICALDISK','MEMCACHE','MEMORYCHIP','MEMPHYSICAL','PAGEFILE','PARTITION','VOLUME'] for part in storage_catgories: sinfo[part]=self.Preprocess(part) return sinfo diff --git a/lib/windows/SystemInfo.py b/lib/windows/SystemInfo.py index cf1af73..ef48a3f 100644 --- a/lib/windows/SystemInfo.py +++ b/lib/windows/SystemInfo.py @@ -92,7 +92,9 @@ class this method names=platform_name[idx] system_data[names]=value system_categories=['OS','TIMEZONE','BOOTCONFIG','COMPUTERSYSTEM','STARTUP'] + Final_result={} + Final_result['SystemData']=[system_data] for part in system_categories: - system_data[part]=self.Preprocess(part) - return system_data + Final_result[part]=self.Preprocess(part) + return Final_result diff --git a/lib/windows/common/Utility.py b/lib/windows/common/Utility.py index be967fc..3ccf9aa 100644 --- a/lib/windows/common/Utility.py +++ b/lib/windows/common/Utility.py @@ -1,4 +1,5 @@ import time +import json def CsvTextToDict(text): lines = text.strip().splitlines() @@ -12,11 +13,12 @@ def CsvTextToDict(text): def ExportTOJson(data): timestr = time.strftime("%Y%m%d-%H%M%S") filename=f'output/{timestr}.json' - with open(filename,'wt') as file: - file.write(data) - print(f"Successfully Exported Result in to {filename} file") - -## key,value = [line.split(',') for line in lines if len(line)>0] -## final_dict = dict(zip(key,value)) -## clean_dict = {key:value for key,value in final_dict.items() if value!=""} - + try: + with open(filename, 'w') as fp: + json.dump(data,fp) + return True,f"successfully saved fille in {filename}" + except Exception as ex: + return False,ex + + +