def main(): paths.MARIMO_ROOT_PATH = os.path.dirname(os.path.realpath(__file__)) setPath() cmdLineOptions.update(cmdLineParser().__dict__) #cmdLineParser()获得命令行参数,以字典返回给cmdLineOptions对象 initOptions(cmdLineOptions) loadModule() loadTarget() run()
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:<*****@*****.**>.')
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)
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)
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)
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)
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)