diff --git a/lib/controller/controller.py b/lib/controller/controller.py index bef0c744..a98e0683 100755 --- a/lib/controller/controller.py +++ b/lib/controller/controller.py @@ -200,12 +200,9 @@ def run(self) -> None: self.requester = Requester() if options["async_mode"]: self.loop = asyncio.new_event_loop() - try: - self.loop.add_signal_handler(signal.SIGINT, self.handle_pause) - except NotImplementedError: - # Windows - signal.signal(signal.SIGINT, self.handle_pause) - signal.signal(signal.SIGTERM, self.handle_pause) + + signal.signal(signal.SIGINT, lambda *_: self.handle_pause()) + signal.signal(signal.SIGTERM, lambda *_: self.handle_pause()) while options["urls"]: url = options["urls"][0] @@ -509,18 +506,14 @@ def is_timed_out(self) -> bool: def process(self) -> None: while True: - try: - while not self.fuzzer.is_finished(): - if self.is_timed_out(): - raise SkipTargetInterrupt( - "Runtime exceeded the maximum set by the user" - ) - time.sleep(0.5) - - break + while not self.fuzzer.is_finished(): + if self.is_timed_out(): + raise SkipTargetInterrupt( + "Runtime exceeded the maximum set by the user" + ) + time.sleep(0.5) - except KeyboardInterrupt: - self.handle_pause() + break def add_directory(self, path: str) -> None: """Add directory to the recursion queue""" diff --git a/lib/core/fuzzer.py b/lib/core/fuzzer.py index a4688ebd..e7d71763 100755 --- a/lib/core/fuzzer.py +++ b/lib/core/fuzzer.py @@ -202,6 +202,7 @@ def start(self) -> None: self.setup_scanners() self.setup_threads() self.play() + self._quit_event.clear() for thread in self._threads: thread.start()