forked from p15670423/monkey
Merge pull request #1033 from shreyamalviya/bugfix-unicode-decode-error
Handle UnicodeDecodeError in Windows info collector
This commit is contained in:
commit
4b1a8d59be
|
@ -252,9 +252,12 @@ class InfectionMonkey(object):
|
||||||
|
|
||||||
def collect_system_info_if_configured(self):
|
def collect_system_info_if_configured(self):
|
||||||
LOG.debug("Calling for system info collection")
|
LOG.debug("Calling for system info collection")
|
||||||
system_info_collector = SystemInfoCollector()
|
try:
|
||||||
system_info = system_info_collector.get_info()
|
system_info_collector = SystemInfoCollector()
|
||||||
SystemInfoTelem(system_info).send()
|
system_info = system_info_collector.get_info()
|
||||||
|
SystemInfoTelem(system_info).send()
|
||||||
|
except Exception as e:
|
||||||
|
LOG.exception(f"Exception encountered during system info collection: {str(e)}")
|
||||||
|
|
||||||
def shutdown_by_not_alive_config(self):
|
def shutdown_by_not_alive_config(self):
|
||||||
if not WormConfiguration.alive:
|
if not WormConfiguration.alive:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import logging
|
import logging
|
||||||
import os
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from common.common_consts.system_info_collectors_names import MIMIKATZ_COLLECTOR
|
from common.common_consts.system_info_collectors_names import MIMIKATZ_COLLECTOR
|
||||||
|
@ -46,16 +46,21 @@ class WindowsInfoCollector(InfoCollector):
|
||||||
return self.info
|
return self.info
|
||||||
|
|
||||||
def get_installed_packages(self):
|
def get_installed_packages(self):
|
||||||
LOG.info('getting installed packages')
|
LOG.info('Getting installed packages')
|
||||||
self.info["installed_packages"] = os.popen("dism /online /get-packages").read()
|
|
||||||
self.info["installed_features"] = os.popen("dism /online /get-features").read()
|
packages = subprocess.check_output("dism /online /get-packages", shell=True)
|
||||||
|
self.info["installed_packages"] = packages.decode('utf-8', errors='ignore')
|
||||||
|
|
||||||
|
features = subprocess.check_output("dism /online /get-features", shell=True)
|
||||||
|
self.info["installed_features"] = features.decode('utf-8', errors='ignore')
|
||||||
|
|
||||||
LOG.debug('Got installed packages')
|
LOG.debug('Got installed packages')
|
||||||
|
|
||||||
def get_wmi_info(self):
|
def get_wmi_info(self):
|
||||||
LOG.info('getting wmi info')
|
LOG.info('Getting wmi info')
|
||||||
for wmi_class_name in WMI_CLASSES:
|
for wmi_class_name in WMI_CLASSES:
|
||||||
self.info['wmi'][wmi_class_name] = WMIUtils.get_wmi_class(wmi_class_name)
|
self.info['wmi'][wmi_class_name] = WMIUtils.get_wmi_class(wmi_class_name)
|
||||||
LOG.debug('finished get_wmi_info')
|
LOG.debug('Finished get_wmi_info')
|
||||||
|
|
||||||
def get_mimikatz_info(self):
|
def get_mimikatz_info(self):
|
||||||
LOG.info("Gathering mimikatz info")
|
LOG.info("Gathering mimikatz info")
|
||||||
|
|
Loading…
Reference in New Issue