Пример #1
0
    def parseOutputString(self, output, debug=False):

        host_info = re.search(
            r"(\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b)",
            output)

        if host_info is None:
            api.log("No hosts detected")
        else:
            for host in output.splitlines():
                if host != "":
                    h_id = self.createAndAddHost(host)
                    i_id = self.createAndAddInterface(h_id,
                                                      host,
                                                      ipv4_address=host)
                    s_id = self.createAndAddServiceToInterface(
                        h_id,
                        i_id,
                        str(self._port),
                        "tcp",
                        ports=[self._port],
                        status="open",
                        version="",
                        description="")
        if debug is True:
            api.devlog("Debug is active")

        return True
Пример #2
0
 def resolve(self, host):
     try:
         return socket.gethostbyname(host)
     except:
         api.log('[ERROR] Acunetix XML Plugin: Ip of host unknown ' + host,
                 level='ERROR')
         return None
     return host
Пример #3
0
 def _dispatchActionWithLock(self, action_callback, *args):
     res = False
     self.__acquire_host_lock()
     try:
         res = action_callback(*args)
     except Exception:
         api.log(
             "An exception occurred while dispatching an action (%r(%r)\n%s"
             % (action_callback, args, traceback.format_exc()), "ERROR")
     finally:
         self.__release_host_lock()
     return res
Пример #4
0
 def _log(self, msg, *args, **kwargs):
     # I have no idea what I am doing
     api.log(msg, *args[:-1])
     return True