Debug Enhancement: Replace silent exception handling with informative warnings

So in this I have  improved debugging capabilities by replacing silent exception
handlers that were hiding potential issues during development.

Changes:
- Replace 'except Exception: pass' with informative warning messages
- Show specific error details when response code extraction fails
- Show specific error details when response text extraction fails

Impact:
- Developers can now see what's going wrong in debug mode
- Fixes Bandit security warning B110 (try_except_pass)
- Improves troubleshooting when --dump-response flag is used
- Maintains backward compatibility while providing better visibility

This only affects debug output when using --dump-response, so it won't
impact normal user experience..
This commit is contained in:
dollaransh17 2025-10-03 13:46:44 +05:30
parent 1d2c4b134f
commit 0ec8827063
1 changed files with 4 additions and 4 deletions

View File

@ -491,8 +491,8 @@ def sherlock(
print("Results...")
try:
print(f"RESPONSE CODE : {r.status_code}")
except Exception:
pass
except Exception as e:
print(f"WARNING: Could not retrieve response code: {e}")
try:
print(f"ERROR TEXT : {net_info['errorMsg']}")
except KeyError:
@ -500,8 +500,8 @@ def sherlock(
print(">>>>> BEGIN RESPONSE TEXT")
try:
print(r.text)
except Exception:
pass
except Exception as e:
print(f"WARNING: Could not retrieve response text: {e}")
print("<<<<< END RESPONSE TEXT")
print("VERDICT : " + str(query_status))
print("+++++++++++++++++++++")