def main(): """ Main function of w9scan when running from command line. """ checkEnvironment() # 检测环境 setPaths(modulePath()) # 为一些目录和文件设置了绝对路径 parser = argparse.ArgumentParser(description="w9scan scanner") parser.add_argument("--update", help="update w9scan", action="store_true") parser.add_argument("--guide", help="w9scan to guide", action="store_true") parser.add_argument( "--banner", help="output the banner", action="store_true") parser.add_argument("-u", help="url") parser.add_argument("-p", "--plugin", help="plugins") parser.add_argument("-s", "--search", help="find infomation of plugin") parser.add_argument("--debug", help="output debug info", action="store_true", default=False) args = parser.parse_args() if IS_WIN: winowsColorInit() Banner() try: configFileParser(os.path.join(paths.w9scan_ROOT_PATH, "config.conf")) initOption(args) pluginScan() webScan() 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() 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(): banner() try: paths.ROOT_PATH = module_path() 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 cmdLineOptions.update(cmdline_parse().__dict__) init_options(cmdLineOptions) set_paths(paths.ROOT_PATH) if IS_WIN: winowsColorInit() start() except Exception, e: logger.error(e.message) logger.error(traceback.format_exc())
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(): #主函数 checkEnvironment() #检测环境 setPaths(modulePath()) #初始化一些绝对路径,参数为根目录 #参数设置 args = parser() if IS_WIN == 'win32': #win 初始化 winowsColorInit() #Banner() try: configFileParser(os.path.join(paths.Ajatar_ROOT_PATH, "config.conf")) #配置文件参数处理 initOption(args) #初始化参数 #pluginScan() #插件函数 webScan() #扫描函数 except Exception as e: raise e
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)