Skip to content

Fix console_ui.py: module-level NameErrors from deferred imports, restore_arp_ui crash - #3

Draft
Secret297-CODER-SOURCE with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-proxy-server-error
Draft

Secret297-CODER-SOURCE with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-proxy-server-error

Conversation

Copilot AI commented Apr 11, 2026

Copy link
Copy Markdown

console_ui.py defined functions before their dependencies were imported, causing NameError at module level (line 725, in <module>). Additionally, restore_arp_ui passed stdscr.getmaxyx (a method object) as IP string arguments to restore_arp(), crashing on every invocation.

Changes

  • Restructured import order — all imports (curses, netifaces, arp_spoof, proxy_server, etc.) moved to the top of the file; logo_art constant and all function definitions follow in a clean, linear order
  • Removed broken import retry loop — eliminated the while True: try/except: block with bare except that could spin forever if dependencies never resolved
  • Fixed restore_arp_ui — replaced the incorrect call:
    # Before (crashes: passes method object, not IP strings)
    restore_arp(stdscr.getmaxyx, stdscr.getmaxyx)
    
    # After: scan network → user selects target → detect gateway → restore
    restore_arp(target_ip, gateway_ip)
    UI now scans the network, lets the user pick target devices, resolves the gateway per target, and calls restore_arp with correct IP string arguments, reporting per-host success/failure.

Copilot AI and others added 2 commits April 11, 2026 11:16
Agent-Logs-Url: https://github.com/Secret297-CODER-SOURCE/Sniff-NG/sessions/081505f9-4b2b-4233-8752-f39a6bd91fa3

Co-authored-by: Secret297-CODER-SOURCE <73541046+Secret297-CODER-SOURCE@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Secret297-CODER-SOURCE/Sniff-NG/sessions/2e21637a-1cee-459e-ad56-5dbb7cf313b2

Co-authored-by: Secret297-CODER-SOURCE <73541046+Secret297-CODER-SOURCE@users.noreply.github.com>
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.

2 participants