From 4719e298e590889251da86e9e347cce7a74de40c Mon Sep 17 00:00:00 2001 From: 4shen0ne <4shen.01@gmail.com> Date: Wed, 13 Nov 2024 21:09:55 +0800 Subject: [PATCH] fix bug in #1430 --- lib/controller/controller.py | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/lib/controller/controller.py b/lib/controller/controller.py index 88be4dc5..3517b789 100755 --- a/lib/controller/controller.py +++ b/lib/controller/controller.py @@ -205,12 +205,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] @@ -514,18 +511,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"""