Skip to content

Commit

Permalink
Fix exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
shelld3v committed Nov 7, 2024
1 parent f1a1d30 commit 2416110
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ exclude-subdirs = %%ff/,.;/,..;/,;/,./,../,%%2e/,%%2e%%2e/
random-user-agents = False
max-time = 0
exit-on-error = False
skip-on-status=429
#subdirs = /,api/
#include-status = 200-299,401
#exclude-status = 400,500-999
Expand All @@ -25,7 +26,6 @@ exit-on-error = False
#exclude-regex = "^403$"
#exclude-redirect = "*/error.html"
#exclude-response = 404.html
#skip-on-status = 429,999

[dictionary]
default-extensions = php,asp,aspx,jsp,html,htm
Expand Down
21 changes: 10 additions & 11 deletions lib/core/fuzzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,12 @@ def quit(self) -> None:

def scan(self, path: str) -> None:
scanners = self.get_scanners_for(path)
response = self._requester.request(path)
try:
response = self._requester.request(path)
except RequestException as e:
for callback in self.error_callbacks:
callback(e)
return

if self.is_excluded(response):
for callback in self.not_found_callbacks:
Expand All @@ -246,11 +251,8 @@ def scan(self, path: str) -> None:
callback(response)
return

try:
for callback in self.match_callbacks:
callback(response)
except Exception as e:
self.exc = e
for callback in self.match_callbacks:
callback(response)

def thread_proc(self) -> None:
logger.info(f'THREAD-{threading.get_ident()} started"')
Expand All @@ -263,11 +265,8 @@ def thread_proc(self) -> None:
except StopIteration:
break

except RequestException as e:
for callback in self.error_callbacks:
callback(e)

continue
except Exception as e:
self.exc = e

finally:
time.sleep(options["delay"])
Expand Down

0 comments on commit 2416110

Please sign in to comment.