diff --git a/infection_monkey/requirements.txt b/infection_monkey/requirements.txt index 60656280b..9e9adc97f 100644 --- a/infection_monkey/requirements.txt +++ b/infection_monkey/requirements.txt @@ -13,7 +13,6 @@ PyInstaller six ecdsa netifaces -mock nos ipaddress wmi diff --git a/infection_monkey/system_info/mimikatz_collector.py b/infection_monkey/system_info/mimikatz_collector.py index 89222c2e2..4d994c6ab 100644 --- a/infection_monkey/system_info/mimikatz_collector.py +++ b/infection_monkey/system_info/mimikatz_collector.py @@ -21,10 +21,10 @@ class MimikatzCollector(object): self._dll = ctypes.WinDLL(self._config.mimikatz_dll_name) collect_proto = ctypes.WINFUNCTYPE(ctypes.c_int) get_proto = ctypes.WINFUNCTYPE(MimikatzCollector.LogonData) - getTextOutput = ctypes.WINFUNCTYPE(ctypes.c_wchar_p) + get_text_output_proto = ctypes.WINFUNCTYPE(ctypes.c_wchar_p) self._collect = collect_proto(("collect", self._dll)) self._get = get_proto(("get", self._dll)) - self._getTextOutput = getTextOutput(("getTextOutput", self._dll)) + self._get_text_output_proto = get_text_output_proto(("getTextOutput", self._dll)) self._isInit = True except Exception: LOG.exception("Error initializing mimikatz collector") @@ -44,7 +44,7 @@ class MimikatzCollector(object): logon_data_dictionary = {} hostname = socket.gethostname() - self.mimikatz_text = self._getTextOutput() + self.mimikatz_text = self._get_text_output_proto() for i in range(entry_count): entry = self._get() diff --git a/infection_monkey/system_info/windows_info_collector.py b/infection_monkey/system_info/windows_info_collector.py index 30685569b..d63553b8f 100644 --- a/infection_monkey/system_info/windows_info_collector.py +++ b/infection_monkey/system_info/windows_info_collector.py @@ -113,12 +113,11 @@ def fix_wmi_obj_for_mongo(o): row[method_name[3:]] = value except wmi.x_wmi: - #LOG.error("Error running wmi method '%s'" % (method_name, )) - #LOG.error(traceback.format_exc()) continue return row + class WindowsInfoCollector(InfoCollector): """ System information collecting module for Windows operating systems @@ -126,6 +125,7 @@ class WindowsInfoCollector(InfoCollector): def __init__(self): super(WindowsInfoCollector, self).__init__() + self.info['reg'] = {} def get_info(self): """ @@ -162,9 +162,6 @@ class WindowsInfoCollector(InfoCollector): for wmi_class_name in WMI_CLASSES: self.info[wmi_class_name] = self.get_wmi_class(wmi_class_name) - # for wmi_class_name, props in WMI_LDAP_CLASSES.iteritems(): - # self.info[wmi_class_name] = self.get_wmi_class(wmi_class_name, "//./root/directory/ldap", props) - def get_wmi_class(self, class_name, moniker="//./root/cimv2", properties=None): _wmi = wmi.WMI(moniker=moniker) @@ -175,8 +172,6 @@ class WindowsInfoCollector(InfoCollector): wmi_class = getattr(_wmi, class_name)(properties) except wmi.x_wmi: - #LOG.error("Error getting wmi class '%s'" % (class_name, )) - #LOG.error(traceback.format_exc()) return return fix_obj_for_mongo(wmi_class) @@ -188,7 +183,7 @@ class WindowsInfoCollector(InfoCollector): d = dict([_winreg.EnumValue(subkey, i)[:2] for i in xrange(_winreg.QueryInfoKey(subkey)[0])]) d = fix_obj_for_mongo(d) - self.info[subkey_path] = d + self.info['reg'][subkey_path] = d subkey.Close() - key.Close() \ No newline at end of file + key.Close() diff --git a/monkey_island/cc/app.py b/monkey_island/cc/app.py index 0f0754ed3..6b9ac1154 100644 --- a/monkey_island/cc/app.py +++ b/monkey_island/cc/app.py @@ -19,8 +19,6 @@ from cc.resources.monkey import Monkey from cc.resources.monkey_configuration import MonkeyConfiguration from cc.resources.monkey_download import MonkeyDownload from cc.resources.netmap import NetMap -from cc.resources.pthmap import PthMap -from cc.resources.pthreport import PTHReport from cc.resources.node import Node from cc.resources.report import Report from cc.resources.root import Root @@ -108,7 +106,5 @@ def init_app(mongo_url): api.add_resource(TelemetryFeed, '/api/telemetry-feed', '/api/telemetry-feed/') api.add_resource(Log, '/api/log', '/api/log/') api.add_resource(IslandLog, '/api/log/island/download', '/api/log/island/download/') - api.add_resource(PthMap, '/api/pthmap', '/api/pthmap/') - api.add_resource(PTHReport, '/api/pthreport', '/api/pthreport/') return app diff --git a/monkey_island/cc/resources/pthmap.py b/monkey_island/cc/resources/pthmap.py deleted file mode 100644 index d19afd56f..000000000 --- a/monkey_island/cc/resources/pthmap.py +++ /dev/null @@ -1,21 +0,0 @@ -import copy -import flask_restful - - -from cc.auth import jwt_required -from cc.services.pth_report_utils import PassTheHashReport, Machine - - -class PthMap(flask_restful.Resource): - @jwt_required() - def get(self, **kw): - pth = PassTheHashReport() - - v = copy.deepcopy(pth.vertices) - e = copy.deepcopy(pth.edges) - - return \ - { - "nodes": [{"id": x, "label": Machine(x).GetIp()} for x in v], - "edges": [{"id": str(s) + str(t), "from": s, "to": t, "label": label} for s, t, label in e] - } diff --git a/monkey_island/cc/resources/pthreport.py b/monkey_island/cc/resources/pthreport.py deleted file mode 100644 index 7c4046694..000000000 --- a/monkey_island/cc/resources/pthreport.py +++ /dev/null @@ -1,13 +0,0 @@ -import flask_restful - -from cc.auth import jwt_required -from cc.services.pth_report import PTHReportService - -__author__ = "maor.rayzin" - - -class PTHReport(flask_restful.Resource): - - @jwt_required() - def get(self): - return PTHReportService.get_report() diff --git a/monkey_island/cc/services/pth_report.py b/monkey_island/cc/services/pth_report.py index 03167f81a..512a80a14 100644 --- a/monkey_island/cc/services/pth_report.py +++ b/monkey_island/cc/services/pth_report.py @@ -257,178 +257,4 @@ class PTHReportService(object): 'edges': pth.edges } } - return report - - # print """