def execute(args=None, parser=None): parser = build_parser(parent=parser) parser.add_argument( '--max-cycles', metavar='N', default=None, type=int, help= 'limit number of fuzz job cycles to %(metavar)s (default: no limit)') arguments = parser.parse_args(args) logger = logging.getLogger('fuzzinator') logger.addHandler(RainbowLoggingHandler(sys.stdout)) logger.setLevel(arguments.log_level) config = configparser.ConfigParser( interpolation=configparser.ExtendedInterpolation()) config.read(arguments.config) controller = Controller(config=config) controller.listener = CliListener() try: controller.run(max_cycles=arguments.max_cycles) except KeyboardInterrupt: pass
def execute(args=None, parser=None): parser = arg_parser.build_parser(parent=parser) parser.add_argument( '--force-encoding', default=None, choices=['utf-8', 'ascii'], help='force text encoding used for TUI widgets (instead of autodetect)' ) parser.add_argument( '--log-file', metavar='FILE', help='redirect stderr (instead of /dev/null; for debugging purposes)') parser.add_argument('-s', '--style', metavar='FILE', help='alternative style file for TUI') arguments = parser.parse_args(args) config = configparser.ConfigParser( interpolation=configparser.ExtendedInterpolation()) config.read(arguments.config) # Redirect or suppress errors to spare tui from superfluous messages. if arguments.log_file: sys.stdout = open(os.devnull, 'w') sys.stderr = open(arguments.log_file, 'w') else: sys.stdout = open(os.devnull, 'w') sys.stderr = open(os.devnull, 'w') if arguments.style: raw_style = json.load(arguments.style) else: raw_style = json.loads( pkgutil.get_data( __package__, os.path.join('resources', 'default_style.json')).decode(encoding='utf-8')) style = load_style(raw_style) if arguments.force_encoding: util.set_encoding(arguments.force_encoding) controller = Controller(config=config) tui = Tui(controller, style=style) controller.listener = TuiListener(tui.pipe, tui.events, tui.lock) fuzz_process = Process(target=controller.run, args=()) try: fuzz_process.start() tui.loop.run() finally: controller.kill_child_processes() fuzz_process.terminate() raise ExitMainLoop()
def execute(args=None, parser=None): parser = build_parser(parent=parser) arguments = parser.parse_args(args) logger = logging.getLogger('fuzzinator') logger.addHandler(RainbowLoggingHandler(sys.stdout)) logger.setLevel(arguments.log_level) config = configparser.ConfigParser(interpolation=configparser.ExtendedInterpolation()) config.read(arguments.config) controller = Controller(config=config) controller.listener = CliListener() try: controller.run() except KeyboardInterrupt: pass