def usage(): config.morph_signals() print('Morph usage:') print(' -b,--browser: Select which browser,contains IE FF CM etc.') print(' -f,--fuzzer: Select which fuzzer to use.') print(' -h,--help: help message.') print('For example:') print(' morph --browser=IE --fuzzer=nduja.html')
def morph(): config.morph_signals() config.InitFuzzArgs() config.logging_info('S', "Morph fuzzer started at %s..." % time.strftime('%Y-%m-%d %X', time.localtime())) # 开启WebSocket服务器 config.logging_info('S', "WebSocket server running on %s..." % config.MOR_WEBSOCKET_SERVER) ws_s = config.MOR_WEBSOCKET_SERVER.split(':') t_s = threading.Thread(target=server.Run, args=(ws_s[0], ws_s[1],)) t_s.setDaemon(True) # 主线程结束时子线程也结束 t_s.start() config.logging_info('L', "Morph Fuzzing loop is running...") while 1: pre_fuzz()
def morph(): config.morph_signals() config.InitFuzzArgs() config.logging_info( 'S', "Morph fuzzer started at %s..." % time.strftime('%Y-%m-%d %X', time.localtime())) # 开启WebSocket服务器 config.logging_info( 'S', "WebSocket server running on %s..." % config.MOR_WEBSOCKET_SERVER) ws_s = config.MOR_WEBSOCKET_SERVER.split(':') t_s = threading.Thread(target=server.Run, args=( ws_s[0], ws_s[1], )) t_s.setDaemon(True) # 主线程结束时子线程也结束 t_s.start() config.logging_info('L', "Morph Fuzzing loop is running...") while 1: pre_fuzz()
# 1.获取运行参数 for name, value in opts: if name in ('-b', '--browser'): browser = value elif name in ('-f', '--fuzzer'): fuzzer = value elif name in ('-d', '--debugger'): debugger = value else: config.morph_usage() sys.exit() # 2.若参数中没有Debugger则设置为默认的 dbg_keys = list(config.MOR_DEBUGGERS[config.MOR_SYSTEM].keys()) browser_keys = list(config.MOR_BROWSERS[config.MOR_SYSTEM].keys()) if len(dbg_keys) <= 0 or len(browser_keys) <= 0: config.morph_signals() config.logging_exception( 'C', "MOR_BROWSER or MOR_DEBUGGER is not found in config.py.") sys.exit() if len(debugger) <= 0: for dbg_i in dbg_keys: if config.MOR_DEBUGGERS[ config.MOR_SYSTEM][dbg_i]['property'] == "default": debugger = dbg_i break # 3.判断运行参数是否合理 fuzzer_path = os.path.join(config.MOR_FUZZERS_FOLDER, fuzzer) fuzzer_exist = os.path.exists(fuzzer_path) if browser not in browser_keys or debugger not in dbg_keys or len( fuzzer) <= 0 or fuzzer_exist is False: config.morph_usage()
# 1.获取运行参数 for name, value in opts: if name in ('-b', '--browser'): browser = value elif name in ('-f', '--fuzzer'): fuzzer = value elif name in ('-d', '--debugger'): debugger = value else: config.morph_usage() sys.exit() # 2.若参数中没有Debugger则设置为默认的 dbg_keys = list(config.MOR_DEBUGGERS[config.MOR_SYSTEM].keys()) browser_keys = list(config.MOR_BROWSERS[config.MOR_SYSTEM].keys()) if len(dbg_keys) <= 0 or len(browser_keys) <= 0: config.morph_signals() config.logging_exception('C', "MOR_BROWSER or MOR_DEBUGGER is not found in config.py.") sys.exit() if len(debugger) <= 0: for dbg_i in dbg_keys: if config.MOR_DEBUGGERS[config.MOR_SYSTEM][dbg_i]['property'] == "default": debugger = dbg_i break # 3.判断运行参数是否合理 fuzzer_path = os.path.join(config.MOR_FUZZERS_FOLDER, fuzzer) fuzzer_exist = os.path.exists(fuzzer_path) if browser not in browser_keys or debugger not in dbg_keys or len(fuzzer) <= 0 or fuzzer_exist is False : config.morph_usage() sys.exit() # 4.运行Fuzz主进程 config.MOR_BROWSER_NICK = browser