From b74167178f012f52f4d4dd51d4c54e5c913d00ab Mon Sep 17 00:00:00 2001 From: Oran Nadler Date: Tue, 17 Apr 2018 12:29:28 +0300 Subject: [PATCH] add installed services to report --- monkey_island/cc/resources/pthmap.py | 40 +++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/monkey_island/cc/resources/pthmap.py b/monkey_island/cc/resources/pthmap.py index e33bd4870..2df94a190 100644 --- a/monkey_island/cc/resources/pthmap.py +++ b/monkey_island/cc/resources/pthmap.py @@ -205,8 +205,37 @@ class Machine(object): @cache def GetInstalledServices(self): - "IIS-WebServer" + def IsNameOfCriticalService(name): + services = ("iis", "exchange", "active directory", "domain controller", "mssql") + name = name.lower() + + for ser in services: + if ser in name: + return True + + return False + doc = self.latest_system_info + found = [] + + for product in doc["data"]["Win32_Product"]: + service_name = eval(product["Name"]) + + if not IsNameOfCriticalService(service_name): + continue + + found.append(service_name) + + for service in doc["data"]["Win32_Service"]: + service_name = eval(service["Name"]) + + if not IsNameOfCriticalService(service_name): + continue + + found.append(service_name) + + return found + @cache def GetUsernamesBySecret(self, secret): sam = self.GetLocalSecrets() @@ -878,6 +907,15 @@ def main(): for sid in m.GetAdmins(): print """
  • {username} ({sid})
  • """.format(username=m.GetUsernameBySid(sid), sid=sid) print """""" + + print """

    Installed Critical Services

    """ + print """

    List of crtical services found installed on machine

    """ + print """""" + + print "
    "