Fix bare except clauses (44 instances across 12 files)#1
Open
MichaelMVS wants to merge 1 commit intoaw-junaid:mainfrom
Open
Fix bare except clauses (44 instances across 12 files)#1MichaelMVS wants to merge 1 commit intoaw-junaid:mainfrom
MichaelMVS wants to merge 1 commit intoaw-junaid:mainfrom
Conversation
Fixed 44 bare except clauses across 12 Python files: - Raw Scripts/802.11 Wi-Fi.py (4 instances) - Raw Scripts/DHCP Starvation Attack.py (2 instances) - Raw Scripts/DNS Enumeration.py (3 instances) - Raw Scripts/FTP Brute Force Tool.py (8 instances) - Raw Scripts/Google Dorking.py (2 instances) - Raw Scripts/ICMP Tunneling Network.py (1 instance) - Raw Scripts/SMB Brute Force Tool.py (8 instances) - Raw Scripts/SSH Brute Force Tool.py (6 instances) - Raw Scripts/SYN Flood.py (4 instances) - Raw Scripts/TLS Stripping.py (4 instances) - Raw Scripts/VLAN Hopping Tool.py (1 instance) - Raw Scripts/WHOIS Lookup.py (1 instance) Bare except clauses can catch unexpected system-exit exceptions (KeyboardInterrupt, SystemExit) and make debugging harder. Using 'except Exception:' ensures only actual program exceptions are caught.
There was a problem hiding this comment.
Pull request overview
This PR updates multiple Python security/utility scripts to replace bare except: clauses with except Exception: so that non-program exceptions (notably KeyboardInterrupt and SystemExit) are not accidentally swallowed.
Changes:
- Replaced bare
except:withexcept Exception:across 12 scripts (44 instances total). - Preserved existing control flow (mostly
pass/fallback behavior) while narrowing exception handling away fromBaseException.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
Raw Scripts/WHOIS Lookup.py |
Narrows IP parsing guards from bare except to except Exception during query-type detection. |
Raw Scripts/VLAN Hopping Tool.py |
Updates exception handling around interface detection, MAC lookup, and VLAN probe logic. |
Raw Scripts/TLS Stripping.py |
Updates exception handling for default interface detection and ARP MAC lookup. |
Raw Scripts/SYN Flood.py |
Updates exception handling for default interface detection, source IP derivation, and flood loops. |
Raw Scripts/SSH Brute Force Tool.py |
Updates exception handling for command verification, cleanup, banner retrieval, and password mutation loop. |
Raw Scripts/SMB Brute Force Tool.py |
Updates exception handling for SMB dialect negotiation, logoff cleanup, and null session checks. |
Raw Scripts/ICMP Tunneling Network.py |
Updates exception handling for optional payload decryption during packet handling. |
Raw Scripts/Google Dorking.py |
Updates exception handling while parsing/analyzing result URLs for domain statistics. |
Raw Scripts/FTP Brute Force Tool.py |
Updates exception handling for banner grabbing, directory listing verification, cleanup, and system info queries. |
Raw Scripts/DNS Enumeration.py |
Updates exception handling for wildcard test, reverse lookup, and async DNS query. |
Raw Scripts/DHCP Starvation Attack.py |
Updates exception handling for default interface detection fallbacks. |
Raw Scripts/802.11 Wi-Fi.py |
Updates exception handling for wireless interface detection, mode checks, and beacon stats parsing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed 44 bare except clauses across 12 Python files. Using except Exception: instead of bare except: ensures only program exceptions are caught while allowing KeyboardInterrupt and SystemExit to propagate normally.