Skip to content

feat: MITM transparent proxy server mode - #2

Draft
Secret297-CODER-SOURCE with Copilot wants to merge 3 commits into
mainfrom
copilot/setup-traffic-proxy-server
Draft

feat: MITM transparent proxy server mode#2
Secret297-CODER-SOURCE with Copilot wants to merge 3 commits into
mainfrom
copilot/setup-traffic-proxy-server

Conversation

Copilot AI commented Apr 11, 2026

Copy link
Copy Markdown

Adds an end-to-end MITM interception mode so the host can act as a transparent traffic proxy — combining ARP spoofing, IP forwarding, iptables redirect, and mitmproxy into a single TUI-driven workflow.

New: proxy_server.py

Wraps mitmdump in transparent mode. Manages the subprocess lifecycle and log file handle cleanly.

proxy_server.start_mitmproxy(port=8080, log_file="/tmp/sniff-ng-traffic.log")
proxy_server.stop_mitmproxy()
proxy_server.is_running()

arp_spoof.py — background threading

arp_spoof_attack previously blocked forever (while True). Replaced with a threading.Event-based stop mechanism and new thread management API:

start_arp_spoof_thread(target_ips, gateway_ip)
stop_arp_spoof_thread()
is_arp_spoofing()

console_ui.py — new "MITM-прокси" menu entry

New mitm_proxy_ui() orchestrates the full attack chain in order:

  1. Network scan + target selection
  2. sysctl IP forwarding on
  3. iptables redirect 80/443 → 8080
  4. ARP spoof (background thread)
  5. mitmdump transparent proxy

S starts, X tears everything down (stops proxy, joins spoof thread, restores ARP tables, clears iptables, disables forwarding). ARP restore failures are surfaced to the user rather than silently swallowed.

dependency_manager.py

Added netifaces to the auto-install list — it was used in console_ui.py but never installed automatically.

Copilot AI and others added 2 commits April 11, 2026 10:42
- arp_spoof.py: run ARP spoofing in a background daemon thread
  (start_arp_spoof_thread / stop_arp_spoof_thread / is_arp_spoofing)
- proxy_server.py: launch/stop mitmdump in transparent mode,
  log intercepted traffic to /tmp/sniff-ng-traffic.log
- dependency_manager.py: auto-install netifaces Python package
- console_ui.py: new "MITM-прокси (перехват трафика)" menu item
  with mitm_proxy_ui() that orchestrates select-targets →
  IP-forwarding → iptables → ARP spoof → mitmproxy start/stop

Agent-Logs-Url: https://github.com/Secret297-CODER-SOURCE/Sniff-NG/sessions/ddb9bb68-e0b5-44a9-816c-9b1236bca438

Co-authored-by: Secret297-CODER-SOURCE <73541046+Secret297-CODER-SOURCE@users.noreply.github.com>
- proxy_server.py: store and close log file handle in stop_mitmproxy()
- arp_spoof.py: remove duplicate _stop_event.clear() inside arp_spoof_attack
- console_ui.py: extract _device_ip() helper for consistent IP extraction;
  log ARP restore errors via restore_errors list displayed to user

Agent-Logs-Url: https://github.com/Secret297-CODER-SOURCE/Sniff-NG/sessions/ddb9bb68-e0b5-44a9-816c-9b1236bca438

Co-authored-by: Secret297-CODER-SOURCE <73541046+Secret297-CODER-SOURCE@users.noreply.github.com>
- Updated arp_spoof_attack to accept multiple target IPs.
- Added functions to detect default gateway and local IP for target.
- Improved device selection UI for network scanning.
- Enhanced error handling and user feedback in the UI.
- Updated README to reflect support for macOS and new features.
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