Example #1
0
    def __init__(self,threadNum = 15):
        self.hash_pycode_Lists = {}
        self.lock_result = threading.Lock()
        self.task_result = []
        self.lock_output = threading.Lock()

        filter_func = lambda file: (True, False)['__init__' in file or 'pyc' in file]
        def getExp():
            direxp = []
            for dirpath, dirnames, filenames in os.walk(paths.w9scan_Plugin_Path):
                for filename in filenames:
                    direxp.append(os.path.join(dirpath,filename))
            return direxp
        dir_exploit = filter(filter_func,getExp())

        self._TargetScanAnge = {'target': urlconfig.url,
                                'scanport': urlconfig.scanport}

        try:
            for exp in dir_exploit:
                with open(exp, 'rb') as f:
                    reads = str(f.read())
                    f.close()
                    self.hash_pycode_Lists.setdefault(os.path.basename(exp), reads)
        except Exception as error_info:
            raise ReadPluginsException

        self.buildHtml = buildHtml()
        self._print('[***] Fetch %d new plugins' % len(self.hash_pycode_Lists))
        self.th = w8_threadpool(threadNum,self._work)
        self._print('[***] Set threadnum:%d'%threadNum)
Example #2
0
    def __init__(self, threadNum=15):
        self.hash_pycode_Lists = {}  #python代码字典 文件路径:代码
        self.lock_result = threading.Lock()  #
        self.task_result = []
        self.lock_output = threading.Lock()
        self.table_exception = set()

        #定义移除不用的插件
        remove_plugins = list(
            set(LIST_PLUGINS).difference(set(urlconfig.diyPlugin)))

        #过滤除exp文件外pyc init DS 文件
        def filter_func(file):
            return (True, False)['__init__' in file or ".pyc" in file
                                 or '.DS_Store' in file]

        #getExp
        def getExp():
            direxp = []
            #在目录树中游走输出在目录中的文件名 返回的是一个三元组(root,dirs,files)。
            for dirpath, _, filenames in os.walk(paths.Ajatar_Plugin_PATH):
                for filename in filenames:
                    #移除不用的插件
                    if filename.strip('.py') not in remove_plugins:
                        direxp.append(os.path.join(dirpath, filename))
            return direxp

        #过滤文件后的完整exp字典
        dir_exploit = filter(filter_func, getExp())
        #目标信息
        self._TargetScanAnge = {
            'target': urlconfig.url,
            'scanport': urlconfig.scanport,
            'find_service': urlconfig.find_service
        }

        try:
            for exp in dir_exploit:
                #读取python代码
                with open(exp, 'rb') as f:
                    reads = str(f.read())
                    f.close()
                    #保存文件:code
                    self.hash_pycode_Lists.setdefault(os.path.basename(exp),
                                                      reads)
        except Exception as error_info:
            raise ToolkitMissingPrivileges(error_info)

        self.buildHtml = buildHtml()  #生成网页报告
        self._print('Fetch %d new plugins' % len(self.hash_pycode_Lists))
        self.th = Ajatar_threadpool(threadNum, self._work,
                                    urlconfig.mutiurl)  #调用work函数进入线程池
        logger.info('Set threadnum:%d' % threadNum)
        self.url = ""
Example #3
0
    def __init__(self, threadNum=15):
        self.hash_pycode_Lists = {}
        self.lock_result = threading.Lock()
        self.task_result = []
        self.lock_output = threading.Lock()
        self.table_exception = set()

        remove_plugins = list(
            set(LIST_PLUGINS).difference(set(urlconfig.diyPlugin)))

        def filter_func(file):
            return (True, False)['__init__' in file or ".pyc" in file
                                 or '.DS_Store' in file]

        def getExp():
            direxp = []
            for dirpath, _, filenames in os.walk(paths.w9scan_Plugin_Path):
                for filename in filenames:
                    if filename.strip('.py') not in remove_plugins:
                        direxp.append(os.path.join(dirpath, filename))
            return direxp

        dir_exploit = filter(filter_func, getExp())

        self._TargetScanAnge = {
            'target': urlconfig.url,
            'scanport': urlconfig.scanport,
            'find_service': urlconfig.find_service
        }

        try:
            for exp in dir_exploit:
                with open(exp, 'rb') as f:
                    reads = str(f.read())
                    f.close()
                    self.hash_pycode_Lists.setdefault(os.path.basename(exp),
                                                      reads)
        except Exception as error_info:
            raise ToolkitMissingPrivileges(error_info)

        self.buildHtml = buildHtml()
        self._print('Fetch %d new plugins' % len(self.hash_pycode_Lists))
        self.th = w8_threadpool(threadNum, self._work, urlconfig.mutiurl)
        logger.info('Set threadnum:%d' % threadNum)
        self.url = ""