Refactor: Split monolithic config.py into focused config/ package#469
Merged
Refactor: Split monolithic config.py into focused config/ package#469
config.py into focused config/ package#469Conversation
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Create wifite/config/__init__.py (434 lines, down from 1444) with slim Configuration class that delegates to sub-modules - Create wifite/config/defaults.py for default value initialization - Create wifite/config/validators.py for validation logic - Create wifite/config/manufacturers.py for OUI lazy-loading - Create wifite/config/parsers/ with 9 focused parser modules: settings, wep, wpa, wps, pmkid, eviltwin, attack_monitor, dual_interface, wpasec - Remove the now-dead wifite/config.py (superseded by package) - Add tests/test_config_refactor.py with 31 tests for the new structure All existing imports (from wifite.config import Configuration) continue to work unchanged. All 601 tests pass." Co-authored-by: kimocoder <4252297+kimocoder@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor the monolithic configuration module for maintainability
Refactor: Split monolithic Mar 19, 2026
config.py into focused config/ package
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.
wifite/config.pywas a 1,444-line god-class mixing default values, argument parsing for 10+ feature areas, validation logic, and OUI loading. This PR extracts those responsibilities into a proper package while keeping all call-sites unchanged.New structure
Compatibility
wifite/config.pyis replaced by the package; Python prefers the package directory, so every existing import continues to work with zero call-site changes:Configuration.versionis still accessible at import time (required bysetup.py). All public methods retain their original signatures —__init__.pymethods are thin delegates that lazy-import from the relevant sub-module.What changed
wifite/config.py; replaced bywifite/config/__init__.py+ 13 sub-modulesparse_*method inConfigurationnow calls the corresponding standalone function inparsers/_validate_eviltwin_config,_validate_wpasec_config, etc.) moved tovalidators.py;Configurationkeeps the_validate_*classmethods as pass-throughs for backward compatInterfaceManagerandTsharktests/test_config_refactor.py— 31 tests covering imports, initialization, validation, and temp-dir helpersOriginal prompt
Refactor the monolithic configuration module in
kimocoder/wifite2into a more maintainable internal structure while preserving backward compatibility and behavior.Repository
kimocoder/wifite2masterGoal
Reduce the size and complexity of
wifite/config.pyby splitting responsibilities into focused modules, while keeping the public API stable for the rest of the codebase.Requirements
from wifite.config import Configurationfrom ..config import Configurationfrom .config import ConfigurationThese must continue to work without requiring broad call-site changes.
Suggested refactor shape
Create a new internal package structure under
wifite/config/and move logic out of the current monolithic file into focused modules, for example:wifite/config/defaults.py— default values and initialization helperswifite/config/validators.py— validation helpers and configuration validation routineswifite/config/manufacturers.py— manufacturer/OUI loading logicwifite/config/parsers/— split argument parsing logic into focused modules such as:settings.pywep.pywpa.pywps.pypmkid.pyeviltwin.pyattack_monitor.pydual_interface.pywpasec.pyYou do not have to use exactly these filenames if a better structure emerges, but the end state should clearly separate responsibilities.
Compatibility constraints
wifite/config.pyas the compatibility entrypoint exposingConfiguration.Configurationclass should remain the primary interface used by the rest of the project.Configurationmethods may delegate to helper modules rather than contain all logic inline.Scope guidance
Focus on extracting and reorganizing logic rather than redesigning the entire config system.
A good outcome is:
wifite/config.pybecomes much smaller and easier to understand.Validation
Please run or update relevant tests for the refactor. At minimum, ensure imports and key configuration flows still work, especially:
Notes from repo inspection
wifite/config.pyis currently a large monolithic module (~1400+ lines) with many class attributes and manyparse_*methods.Configurationwidely, so preserving the public interface is critical.setup.pyimportsConfiguration.version, so import-time compatibility matters.Deliverable
Open a PR implementing the minimal safe config refactor with backward compatibility preserved.
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Scan the project for issues, problems or improvements to add. Summary me the findings
Assistant:
I'll scan the repository to understand its structure, current issues, and code quality. Let me gather information from multiple angles.
Assistant: Now let me scan the codebase for potential issues, code quality problems, and improvement opportunities.
Assistant: Now let me also look at the existing TODO items and check for test coverage:
Assistant: Here's a comprehensive summary of my findings after scanning the kimocoder/wifite2 project:
📋 Project Scan Summary
📊 Overview
🐛 Open Issues
--simd=genericinstead ofneon, resulting in ~13x slower hash rates (210 k/s vs 2800 k/s). Wifite may need to detect SIMD capabilities and pass--simd=neonto aircrack-ng explicitly.🔧 Code-Level Findings
1. Acknowledged TODOs & HACKs in Code 🟡
Multiple
TODO,FIXME,XXX, andHACKmarkers exist throughout the codebase:wifite/model/handshake.py— `HA...This pull request was created from Copilot chat.
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.