Beispiel #1
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:<*****@*****.**>.')
Beispiel #2
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()

        if conf.ENGINE is 't':
            from lib.controller.threads import ThreadsEngine
            ThreadsEngine().run()
        elif conf.ENGINE is 'c':
            from lib.controller.coroutine import CoroutineEngine
            CoroutineEngine().run()

        if conf.OPEN_BROWSER:
            openBrowser()

        systemQuit(EXIT_STATUS.SYSETM_EXIT)

    except ToolkitMissingPrivileges, e:
        logger.error(e)
        systemQuit(EXIT_STATUS.ERROR_EXIT)
Beispiel #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()

        parseArgs()

        if IS_WIN:
            winowsColorInit()
        banner()

        if conf['DEBUG']:
            showDebugData()

        loadModule()
        loadPayloads()

        if conf['ENGINE'] is 't':
            from lib.controller.threads import ThreadsEngine
            ThreadsEngine().run()
        elif conf['ENGINE'] is 'c':
            from lib.controller.coroutine import CoroutineEngine
            CoroutineEngine().run()

        if conf['OPEN_BROWSER']:
            openBrowser()

        systemQuit(EXIT_STATUS.SYSETM_EXIT)

    except KeyboardInterrupt, e:
        systemQuit(EXIT_STATUS.USER_QUIT)
Beispiel #4
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()

        parseArgs()

        if IS_WIN:
            winowsColorInit()
        banner()

        if conf['DEBUG']:
            showDebugData()

        loadModule()
        loadPayloads()

        if conf['ENGINE'] is 't':
            from lib.controller.threads import ThreadsEngine
            ThreadsEngine().run()
        elif conf['ENGINE'] is 'c':
            from lib.controller.coroutine import CoroutineEngine
            CoroutineEngine().run()

        if conf['OPEN_BROWSER']:
            openBrowser()

        systemQuit(EXIT_STATUS.SYSETM_EXIT)

    except KeyboardInterrupt, e:
        systemQuit(EXIT_STATUS.USER_QUIT)
Beispiel #5
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)