Skip to content

Fix/latent nameerror bugs#537

Merged
kimocoder merged 2 commits into
masterfrom
fix/latent-nameerror-bugs
Jun 22, 2026
Merged

Fix/latent nameerror bugs#537
kimocoder merged 2 commits into
masterfrom
fix/latent-nameerror-bugs

Conversation

@kimocoder

Copy link
Copy Markdown
Owner

No description provided.

kimocoder and others added 2 commits June 22, 2026 02:04
Four undefined-name bugs that would raise NameError at runtime, all in
error/edge paths where they'd mask the real failure:

- wpa.py: subprocess used in two except clauses but never imported
- interface_assignment.py: log_error used in handlers but not imported
- wpa3_tools.py: f-strings used {C}/{W}/{O} as variable interpolation
  instead of literal color codes, breaking the tool-status report
- system_check.py: InterfaceManager referenced without import (chipset
  detection silently failed)

Also make EvilTwinAttackState a TYPE_CHECKING import so the forward-ref
annotations resolve cleanly.

Test fixes:
- test_cleanup: patch subprocess at its real call site
  (wifite.util.process) instead of a dead import in wifite.util.cleanup
- test_wpa3_detection_performance: replace three wall-clock ratio
  assertions (intermittently failing, e.g. 1.57x < 2x) with
  deterministic behavioural checks of the cache / early-return logic

Plus ruff safe autofixes: remove unused imports (incl. the ambiguous
HcxDumpTool import from hashcat, leaving the hcxdumptool one), drop
placeholder-less f-strings, and remove redundant local re-imports.

All 629 tests pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 22, 2026 00:06
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@kimocoder kimocoder merged commit cab79ac into master Jun 22, 2026
9 of 10 checks passed
@kimocoder kimocoder deleted the fix/latent-nameerror-bugs branch June 22, 2026 00:06
Comment thread wifite/attack/wpa.py
import time
import os
import re
import subprocess

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR focuses on eliminating latent NameError issues caused by unnecessary f-strings (notably around {C}/{W} color tokens), cleaning up unused imports, and introducing a new --kalidroid output mode that makes CLI output readable in Kalidroid’s MiniTerminal (append-only scrollback).

Changes:

  • Fixed latent NameError hazards by removing/adjusting f-strings that contained {C}, {W}, etc. as literal color tokens.
  • Added --kalidroid flag plus a Color.kalidroid rendering path to flatten carriage-return progress redraws into newline-terminated lines and disable clear-line behavior.
  • Reworked WPA3 “performance” tests to deterministic behavioral tests (cache short-circuiting / early-return) instead of wall-clock timing.

Reviewed changes

Copilot reviewed 52 out of 52 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
wifite/wifite.py Removes unused imports tied to session/target conversion paths.
wifite/util/wpasec_uploader.py Cleans up constant f-strings / logging call formatting.
wifite/util/wpa3_tools.py Escapes literal color tokens inside f-strings to avoid NameError.
wifite/util/tui_logger.py Removes unused time import.
wifite/util/system_check.py Removes unused typing imports; fixes color-token printing and adds chipset mapping fallback.
wifite/util/session.py Removes unused import; replaces constant f-strings with plain strings.
wifite/util/scanner.py Removes unused imports and narrows logger imports in native scan path.
wifite/util/sae_crack.py Removes unused imports/types and narrows tool imports.
wifite/util/retry.py Removes unused typing imports.
wifite/util/process.py Normalizes a constant f-string to a plain string in an error log call.
wifite/util/logger.py Removes unused time import.
wifite/util/interface_manager.py Removes unused typing imports and redundant tool import; normalizes constant f-strings.
wifite/util/interface_exceptions.py Removes constant f-string to avoid latent formatting/name issues.
wifite/util/interface_assignment.py Adds missing log_error import and removes constant f-strings.
wifite/util/dragonblood.py Removes unused typing import.
wifite/util/dragonblood_timing.py Removes unused typing import.
wifite/util/credential_validator.py Removes unused Color import.
wifite/util/color.py Implements Kalidroid MiniTerminal mode (Color.kalidroid) with throttled flattened progress lines and no-op clear-line behavior.
wifite/util/client_monitor.py Removes unused datetime import.
wifite/util/cleanup.py Removes unused imports (shifts toward Process.run_simple usage).
wifite/util/adaptive_deauth.py Removes unused logger imports.
wifite/ui/scanner_view.py Replaces constant f-strings in header rendering.
wifite/ui/components.py Removes unused Rich imports and replaces constant f-strings.
wifite/ui/attack_view.py Replaces constant f-strings in status/metrics strings.
wifite/tools/wlancap2wpasec.py Removes unused Color import.
wifite/tools/hostapd.py Removes unused typing import.
wifite/tools/hashcat.py Removes redundant inner imports.
wifite/tools/airodump.py Removes redundant inner import (module already imports csv).
wifite/native/wps.py Removes unused imports/types.
wifite/native/scanner.py Removes unused imports/types.
wifite/native/pmkid.py Removes unused imports/types.
wifite/native/mac.py Removes unused os import.
wifite/native/interface.py Removes unused typing import(s).
wifite/native/deauth.py Removes unused imports/types.
wifite/native/beacon.py Removes unused typing import(s).
wifite/model/sae_handshake.py Removes unused re import.
wifite/model/result.py Removes unused glob import.
wifite/config/parsers/settings.py Hooks --kalidroid into configuration parsing and keeps Color.kalidroid in sync.
wifite/config/init.py Adds Configuration.kalidroid flag.
wifite/attack/wpa3.py Removes unused import(s) in WPA3 attack flow.
wifite/attack/wpa.py Cleans unused imports and adjusts local logger imports; adds subprocess import.
wifite/attack/wep.py Removes unused logger imports.
wifite/attack/portal/templates.py Removes unused typing/log imports.
wifite/attack/portal/server.py Removes unused HTTPServer import.
wifite/attack/portal/credential_handler.py Removes unused datetime import.
wifite/attack/pmkid.py Removes unused native result alias and replaces constant f-strings.
wifite/attack/eviltwin.py Removes unused imports and uses TYPE_CHECKING to avoid runtime import cycles.
wifite/attack/attack_monitor.py Removes unused imports.
wifite/attack/all.py Removes unused log_debug import.
wifite/args.py Adds early activation + argparse support for --kalidroid.
tests/test_wpa3_detection_performance.py Replaces timing benchmarks with deterministic cache/early-return behavioral tests.
tests/test_cleanup.py Updates patch targets for subprocess calls (but needs additional patching for Process._resolve_tool).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test_cleanup.py
self.assertIn('error2', errors)

@patch('wifite.util.cleanup.subprocess.run')
@patch('wifite.util.process.subprocess.run')
Comment thread tests/test_cleanup.py
mock_run.assert_called_once()

@patch('wifite.util.cleanup.subprocess.run')
@patch('wifite.util.process.subprocess.run')
Comment thread tests/test_cleanup.py
self.assertIsInstance(conflicting, list)

@patch('wifite.util.cleanup.subprocess.run')
@patch('wifite.util.process.subprocess.run')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants