Пример #1
0
    def init_spider(self):
        for k, v in self.hash_pycode_Lists.iteritems():
            pluginObj = self._load_module(v)
            pluginObj.task_push = self.task_push
            pluginObj.curl = miniCurl.Curl()
            pluginObj.security_note = self._security_note
            pluginObj.security_info = self._security_info
            pluginObj.security_warning = self._security_warning
            pluginObj.security_hole = self._security_hole
            pluginObj.security_set = self._security_set
            pluginObj.debug = self._debug
            pluginObj.util = until
            pluginObj._G = self._TargetScanAnge
            pluginObj.hackhttp = hackhttp.hackhttp()
            pluginObj.ThreadPool = w8_threadpool

            try:
                pluginObj_tuple = pluginObj.assign("spider_file", "")
                if not isinstance(pluginObj_tuple, tuple):  # 判断是否是元组
                    pluginObj_tuple = pluginObj.assign("spider_end", "")
                    if not isinstance(pluginObj_tuple, tuple):
                        continue
                bool_value, agrs = pluginObj_tuple[0], pluginObj_tuple[1]
                if bool_value:
                    pconf = {}
                    pconf["pluginObj"] = pluginObj
                    pconf["service"] = "spider_file"
                    w9_hash_pycode.setdefault(k, pconf)
            except Exception as err_info:
                raise ToolkitMissingPrivileges("load spider plugins error! " +
                                               err_info)
Пример #2
0
    def init_spider(self):
        for k, v in self.hash_pycode_Lists.iteritems():
            pluginObj = self._load_module(v)
            for each in ESSENTIAL_MODULE_METHODS:
                if not hasattr(pluginObj, each):
                    errorMsg = "Can't find essential method:'{}' in current script,Please modify your {}.".format(
                        each, k)
                    logger.error(errorMsg)
                    continue
            pluginObj.task_push = self.task_push
            pluginObj.curl = miniCurl.Curl()
            pluginObj.security_note = self._security_note
            pluginObj.security_info = self._security_info
            pluginObj.security_warning = self._security_warning
            pluginObj.security_hole = self._security_hole
            pluginObj.security_set = self._security_set
            pluginObj.debug = self._debug
            pluginObj.util = until
            pluginObj._G = self._TargetScanAnge
            pluginObj.hackhttp = hackhttp.hackhttp()
            pluginObj.ThreadPool = w8_threadpool

            try:
                pluginObj_tuple = pluginObj.assign("spider_file", "")
                if not isinstance(pluginObj_tuple, tuple):  # 判断是否是元组
                    pluginObj_tuple = pluginObj.assign("spider_end", "")
                    if not isinstance(pluginObj_tuple, tuple):
                        continue
                bool_value, agrs = pluginObj_tuple[0], pluginObj_tuple[1]
                if bool_value:
                    pconf = {}
                    pconf["pluginObj"] = pluginObj
                    pconf["service"] = "spider_file"
                    w9_hash_pycode.setdefault(k, pconf)
            except Exception as err_info:
                raise ToolkitMissingPrivileges("load spider plugins error! " +
                                               err_info)