Exemple #1
0
def main(taskID, target, thread_num, load_config_file):
    """
    main fuction of dirmap 
    """

    # set paths of project
    paths.ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
    setPaths()

    scan_param = {
        'thread_num': thread_num,
        'target_input': target,  # single or range or mask
        'target_file': '',
        'load_config_file': load_config_file,
        'debug': False
    }
    # received command >> cmdLineOptions
    cmdLineOptions.update(scan_param)

    # loader script,target,working way(threads? gevent?),output_file from cmdLineOptions
    # and send it to conf
    initOptions(cmdLineOptions)  # 扫描中的全部参数放到conf中
    # run!
    run()
    print(result)
    _ = MongoDB()
    _.add_web_dir(taskID, result)
    return result
Exemple #2
0
def main():
    try:
        check_python_version()
        check_environment()

        # set paths of project
        set_paths(module_path())

        # output banner information
        banner() 

        # received command >> cmdLineOptions
        cmdLineOptions.update(cmdLineParser().__dict__)

        # loader script,target,working way(threads? gevent?),output_file from cmdLineOptions
        # and send it to conf
        init_options(cmdLineOptions)

        # load poc module and target --> tasks
        load()

        # run!
        run()
    except Exception as e:
        print(e)

    finally:
        print("\n\n[*] shutting down at {0}\n".format(time.strftime("%X")))
Exemple #3
0
def main():
    """
    Main function of POC-T when running from command line.
    """
    try:
        paths.ROOT_PATH = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
        try:
            os.path.isdir(paths.ROOT_PATH)
        except UnicodeEncodeError:
            errMsg = "your system does not properly handle non-ASCII paths. "
            errMsg += "Please move the project root directory to another location"
            logger.error(errMsg)
            raise SystemExit
        setPaths()

        cmdLineOptions.update(cmdLineParser().__dict__)
        initOptions(cmdLineOptions)

        if IS_WIN:
            winowsColorInit()
        banner()

        loadModule()
        loadPayloads()

        run()

        if conf.OPEN_BROWSER:
            openBrowser()

        systemQuit(EXIT_STATUS.SYSETM_EXIT)

    except ToolkitMissingPrivileges as e:
        logger.error(e)
        systemQuit(EXIT_STATUS.ERROR_EXIT)

    except ToolkitSystemException as e:
        logger.error(e)
        systemQuit(EXIT_STATUS.ERROR_EXIT)

    except ToolkitUserQuitException:
        systemQuit(EXIT_STATUS.USER_QUIT)
    except KeyboardInterrupt:
        systemQuit(EXIT_STATUS.USER_QUIT)

    except Exception:
        print(traceback.format_exc())
        logger.warning('It seems like you reached a unhandled exception, please report it to author\'s mail:<*****@*****.**>.')
Exemple #4
0
def main():
    """"
    Main function of AWIScan when running from command line.
    """

    banner()

    # Set paths of project.
    CONF.ROOT_PATH = os.getcwd()
    setPaths()

    # received command >> parse_args
    base_targets, level = parse_args()
    initOptions(level)

    run(base_targets)
    logger.info("[AWIScan] All target is end")
Exemple #5
0
def main():
    """
    main fuction of saucerframe 
    """
    # set paths of project
    paths.ROOT_PATH = os.getcwd()
    setpaths()

    # received command >> cmdLineOptions
    cmdLineOptions.update(cmdLineParser().__dict__)

    # loader script,target,threads,output_file from cmdLineOptions
    # and send it to conf
    initOptions(cmdLineOptions)

    # run!
    run()
Exemple #6
0
def main():
    try:
        paths.ROOT_PATH = os.path.dirname(
            os.path.dirname(os.path.realpath(__file__)))
        #得到当前py文件所在文件夹上一个文件夹目录赋值给paths.ROOT_PATH,也就是Sepia的根目录
        try:
            os.path.isdir(paths.ROOT_PATH)  #此处判断path.ROOT_PATH得到的路径编码是否正常
        except UnicodeEncodeError:  #出现编码错误就退出
            errMsg = "Your system does not properly handle non-ASCII paths. "
            errMsg += "Please move the project root directory to another location"
            logger.error(errMsg)
            raise SystemExit
        setPaths()  #设置Sepia的文件路径和目录
        banner()  #打印Sepia的logo
        '''
        print "########以下为paths字典#########"
        print paths
        '''
        #存储原始命令行选项,以备恢复
        '''
        print "########以下为原始命令行参数#########"
        print cmdLineParser().__dict__
        '''
        #cmdLineParser().__dict__获得命令行参数数据字典并赋值给cmdLineOptions字典对象
        cmdLineOptions.update(cmdLineParser().__dict__)
        initOptions(cmdLineOptions)
        '''
        print "########以下为cmdLineOption字典#########"
        print cmdLineOptions
        '''

        if IS_WIN:  #如果是Windows使用Colorama插件并初始化
            winowsColorInit()

        loadModule()  #加载poc脚本
        loadPayloads()  #配置扫描模式

        run()  #开始扫描

        systemQuit(EXIT_STATUS.SYSETM_EXIT)

    except ToolkitMissingPrivileges, e:
        logger.error(e)
        systemQuit(EXIT_STATUS.ERROR_EXIT)
Exemple #7
0
def main():
    """
    main fuction of dirmap 
    """

    # anyway output thr banner information
    banner()

    # set paths of project
    paths.ROOT_PATH = os.getcwd()
    setPaths()

    # received command >> cmdLineOptions
    cmdLineOptions.update(cmdLineParser().__dict__)

    # loader script,target,working way(threads? gevent?),output_file from cmdLineOptions
    # and send it to conf
    initOptions(cmdLineOptions)

    # run!
    run()
Exemple #8
0
def main():
    """
    Main function of POC-T when running from command line.
    """
    try:
        paths.ROOT_PATH = os.path.dirname(
            os.path.dirname(os.path.realpath(__file__)))
        try:
            os.path.isdir(paths.ROOT_PATH)
        except UnicodeEncodeError:
            errMsg = "your system does not properly handle non-ASCII paths. "
            errMsg += "Please move the project root directory to another location"
            logger.error(errMsg)
            raise SystemExit
        setPaths()

        cmdLineOptions.update(cmdLineParser().__dict__)
        initOptions(cmdLineOptions)

        if IS_WIN:
            winowsColorInit()
        banner()

        if conf.DEBUG:
            showDebugData()

        loadModule()
        loadPayloads()

        run()

        if conf.OPEN_BROWSER:
            openBrowser()

        systemQuit(EXIT_STATUS.SYSETM_EXIT)

    except ToolkitMissingPrivileges, e:
        logger.error(e)
        systemQuit(EXIT_STATUS.ERROR_EXIT)
Exemple #9
0
def main():
    """
    Main function of POC-T when running from command line.
    """
    try:
        paths.ROOT_PATH = os.path.dirname(
            os.path.dirname(os.path.realpath(__file__)))
        try:
            os.path.isdir(paths.ROOT_PATH)
        except UnicodeEncodeError:
            errMsg = "your system does not properly handle non-ASCII paths. "
            errMsg += "Please move the project root directory to another location"
            logger.error(errMsg)
            raise SystemExit
        # 设置全局路径paths
        setPaths()
        # 解析參數到cmdLineOptions字典
        cmdLineOptions.update(cmdLineParser().__dict__)
        initOptions(cmdLineOptions)

        if IS_WIN:
            winowsColorInit()
        banner()
        # 遍历所有conf.MODULE_USE,根据模块名动态加载到conf.MODULE_PLUGIN字典
        loadModule(cmdLineOptions.script_name, cmdLineOptions.batch)
        # 加载target到队列
        loadPayloads()
        # 多线程运行
        run()

        if conf.OPEN_BROWSER:
            openBrowser()

        systemQuit(EXIT_STATUS.SYSETM_EXIT)

    except ToolkitMissingPrivileges, e:
        logger.error(e)
        systemQuit(EXIT_STATUS.ERROR_EXIT)
Exemple #10
0
def main():
    """
    Main function of POC-T when running from command line.
    """
    try:
        paths.ROOT_PATH = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
        try:
            os.path.isdir(paths.ROOT_PATH)
        except UnicodeEncodeError:
            errMsg = "your system does not properly handle non-ASCII paths. "
            errMsg += "Please move the project root directory to another location"
            logger.error(errMsg)
            raise SystemExit
        setPaths()

        cmdLineOptions.update(cmdLineParser().__dict__)
        initOptions(cmdLineOptions)

        if IS_WIN:
            winowsColorInit()
        banner()

        if conf.DEBUG:
            showDebugData()

        loadModule()
        loadPayloads()

        run()

        if conf.OPEN_BROWSER:
            openBrowser()

        systemQuit(EXIT_STATUS.SYSETM_EXIT)

    except ToolkitMissingPrivileges, e:
        logger.error(e)
        systemQuit(EXIT_STATUS.ERROR_EXIT)
Exemple #11
0
 def run(self):
     run()
     self.stop.emit()  # 循环完毕后发出信号