mirror of
https://github.com/smittix/intercept.git
synced 2026-07-25 01:08:11 -07:00
Support /usr/sbin paths for aircrack-ng on Debian and add hcxtools
- Add get_tool_path() to check /usr/sbin and /sbin for tools - Update wifi.py to use full paths for airmon-ng, airodump-ng, aireplay-ng, aircrack-ng - Add hcxdumptool and hcxtools to setup.sh for Debian and macOS - Update check_cmd() in setup.sh to also check /usr/sbin and /sbin 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+22
-15
@@ -16,7 +16,7 @@ from typing import Any, Generator
|
|||||||
from flask import Blueprint, jsonify, request, Response
|
from flask import Blueprint, jsonify, request, Response
|
||||||
|
|
||||||
import app as app_module
|
import app as app_module
|
||||||
from utils.dependencies import check_tool
|
from utils.dependencies import check_tool, get_tool_path
|
||||||
from utils.logging import wifi_logger as logger
|
from utils.logging import wifi_logger as logger
|
||||||
from utils.process import is_valid_mac, is_valid_channel
|
from utils.process import is_valid_mac, is_valid_channel
|
||||||
from utils.validation import validate_wifi_channel, validate_mac_address
|
from utils.validation import validate_wifi_channel, validate_mac_address
|
||||||
@@ -345,10 +345,11 @@ def toggle_monitor_mode():
|
|||||||
interfaces_before = get_wireless_interfaces()
|
interfaces_before = get_wireless_interfaces()
|
||||||
|
|
||||||
kill_processes = data.get('kill_processes', False)
|
kill_processes = data.get('kill_processes', False)
|
||||||
|
airmon_path = get_tool_path('airmon-ng')
|
||||||
if kill_processes:
|
if kill_processes:
|
||||||
subprocess.run(['airmon-ng', 'check', 'kill'], capture_output=True, timeout=10)
|
subprocess.run([airmon_path, 'check', 'kill'], capture_output=True, timeout=10)
|
||||||
|
|
||||||
result = subprocess.run(['airmon-ng', 'start', interface],
|
result = subprocess.run([airmon_path, 'start', interface],
|
||||||
capture_output=True, text=True, timeout=15)
|
capture_output=True, text=True, timeout=15)
|
||||||
|
|
||||||
output = result.stdout + result.stderr
|
output = result.stdout + result.stderr
|
||||||
@@ -429,7 +430,8 @@ def toggle_monitor_mode():
|
|||||||
else: # stop
|
else: # stop
|
||||||
if check_tool('airmon-ng'):
|
if check_tool('airmon-ng'):
|
||||||
try:
|
try:
|
||||||
subprocess.run(['airmon-ng', 'stop', app_module.wifi_monitor_interface or interface],
|
airmon_path = get_tool_path('airmon-ng')
|
||||||
|
subprocess.run([airmon_path, 'stop', app_module.wifi_monitor_interface or interface],
|
||||||
capture_output=True, text=True, timeout=15)
|
capture_output=True, text=True, timeout=15)
|
||||||
app_module.wifi_monitor_interface = None
|
app_module.wifi_monitor_interface = None
|
||||||
return jsonify({'status': 'success', 'message': 'Monitor mode disabled'})
|
return jsonify({'status': 'success', 'message': 'Monitor mode disabled'})
|
||||||
@@ -480,8 +482,9 @@ def start_wifi_scan():
|
|||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
airodump_path = get_tool_path('airodump-ng')
|
||||||
cmd = [
|
cmd = [
|
||||||
'airodump-ng',
|
airodump_path,
|
||||||
'-w', csv_path,
|
'-w', csv_path,
|
||||||
'--output-format', 'csv,pcap',
|
'--output-format', 'csv,pcap',
|
||||||
'--band', band,
|
'--band', band,
|
||||||
@@ -579,8 +582,9 @@ def send_deauth():
|
|||||||
return jsonify({'status': 'error', 'message': 'aireplay-ng not found'})
|
return jsonify({'status': 'error', 'message': 'aireplay-ng not found'})
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
aireplay_path = get_tool_path('aireplay-ng')
|
||||||
cmd = [
|
cmd = [
|
||||||
'aireplay-ng',
|
aireplay_path,
|
||||||
'--deauth', str(count),
|
'--deauth', str(count),
|
||||||
'-a', target_bssid,
|
'-a', target_bssid,
|
||||||
'-c', target_client,
|
'-c', target_client,
|
||||||
@@ -625,8 +629,9 @@ def capture_handshake():
|
|||||||
|
|
||||||
capture_path = f'/tmp/intercept_handshake_{target_bssid.replace(":", "")}'
|
capture_path = f'/tmp/intercept_handshake_{target_bssid.replace(":", "")}'
|
||||||
|
|
||||||
|
airodump_path = get_tool_path('airodump-ng')
|
||||||
cmd = [
|
cmd = [
|
||||||
'airodump-ng',
|
airodump_path,
|
||||||
'-c', str(channel),
|
'-c', str(channel),
|
||||||
'--bssid', target_bssid,
|
'--bssid', target_bssid,
|
||||||
'-w', capture_path,
|
'-w', capture_path,
|
||||||
@@ -664,14 +669,16 @@ def check_handshake_status():
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
if target_bssid and is_valid_mac(target_bssid):
|
if target_bssid and is_valid_mac(target_bssid):
|
||||||
result = subprocess.run(
|
aircrack_path = get_tool_path('aircrack-ng')
|
||||||
['aircrack-ng', '-a', '2', '-b', target_bssid, capture_file],
|
if aircrack_path:
|
||||||
capture_output=True, text=True, timeout=10
|
result = subprocess.run(
|
||||||
)
|
[aircrack_path, '-a', '2', '-b', target_bssid, capture_file],
|
||||||
output = result.stdout + result.stderr
|
capture_output=True, text=True, timeout=10
|
||||||
if '1 handshake' in output or ('handshake' in output.lower() and 'wpa' in output.lower()):
|
)
|
||||||
if '0 handshake' not in output:
|
output = result.stdout + result.stderr
|
||||||
handshake_found = True
|
if '1 handshake' in output or ('handshake' in output.lower() and 'wpa' in output.lower()):
|
||||||
|
if '0 handshake' not in output:
|
||||||
|
handshake_found = True
|
||||||
except subprocess.TimeoutExpired:
|
except subprocess.TimeoutExpired:
|
||||||
pass
|
pass
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -47,9 +47,9 @@ detect_os() {
|
|||||||
echo -e "${BLUE}Detected OS:${NC} $OS"
|
echo -e "${BLUE}Detected OS:${NC} $OS"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if a command exists
|
# Check if a command exists (also check /usr/sbin for Debian)
|
||||||
check_cmd() {
|
check_cmd() {
|
||||||
command -v "$1" &> /dev/null
|
command -v "$1" &> /dev/null || [ -x "/usr/sbin/$1" ] || [ -x "/sbin/$1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if a package is installable (Debian)
|
# Check if a package is installable (Debian)
|
||||||
@@ -200,6 +200,17 @@ check_tools() {
|
|||||||
if check_cmd aireplay-ng; then
|
if check_cmd aireplay-ng; then
|
||||||
echo -e " ${GREEN}✓${NC} aireplay-ng - Deauthentication (optional)"
|
echo -e " ${GREEN}✓${NC} aireplay-ng - Deauthentication (optional)"
|
||||||
fi
|
fi
|
||||||
|
# PMKID tools are optional
|
||||||
|
if check_cmd hcxdumptool; then
|
||||||
|
echo -e " ${GREEN}✓${NC} hcxdumptool - PMKID capture (optional)"
|
||||||
|
else
|
||||||
|
echo -e " ${YELLOW}-${NC} hcxdumptool - PMKID capture (optional)"
|
||||||
|
fi
|
||||||
|
if check_cmd hcxpcapngtool; then
|
||||||
|
echo -e " ${GREEN}✓${NC} hcxpcapngtool - Hash extraction (optional)"
|
||||||
|
else
|
||||||
|
echo -e " ${YELLOW}-${NC} hcxpcapngtool - Hash extraction (optional)"
|
||||||
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Bluetooth Tools:"
|
echo "Bluetooth Tools:"
|
||||||
@@ -296,6 +307,8 @@ install_macos_tools() {
|
|||||||
echo -e "${BLUE}Installing WiFi tools...${NC}"
|
echo -e "${BLUE}Installing WiFi tools...${NC}"
|
||||||
echo " Installing aircrack-ng..."
|
echo " Installing aircrack-ng..."
|
||||||
brew install aircrack-ng || echo -e "${YELLOW} Warning: aircrack-ng installation failed${NC}"
|
brew install aircrack-ng || echo -e "${YELLOW} Warning: aircrack-ng installation failed${NC}"
|
||||||
|
echo " Installing hcxtools (PMKID capture)..."
|
||||||
|
brew install hcxtools || echo -e "${YELLOW} Warning: hcxtools installation failed${NC}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
@@ -313,7 +326,7 @@ show_macos_manual() {
|
|||||||
echo "brew install dump1090-mutability"
|
echo "brew install dump1090-mutability"
|
||||||
echo ""
|
echo ""
|
||||||
echo "# WiFi scanning (optional)"
|
echo "# WiFi scanning (optional)"
|
||||||
echo "brew install aircrack-ng"
|
echo "brew install aircrack-ng hcxtools"
|
||||||
}
|
}
|
||||||
|
|
||||||
# ============================================
|
# ============================================
|
||||||
@@ -452,6 +465,23 @@ install_debian_tools() {
|
|||||||
fi
|
fi
|
||||||
pause
|
pause
|
||||||
|
|
||||||
|
# PMKID capture tools
|
||||||
|
echo " Installing hcxdumptool (PMKID capture)..."
|
||||||
|
if $SUDO apt-get install -y hcxdumptool; then
|
||||||
|
echo -e "${GREEN} hcxdumptool installed${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${YELLOW} Warning: hcxdumptool installation failed${NC}"
|
||||||
|
fi
|
||||||
|
pause
|
||||||
|
|
||||||
|
echo " Installing hcxtools (hash extraction)..."
|
||||||
|
if $SUDO apt-get install -y hcxtools; then
|
||||||
|
echo -e "${GREEN} hcxtools installed${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${YELLOW} Warning: hcxtools installation failed${NC}"
|
||||||
|
fi
|
||||||
|
pause
|
||||||
|
|
||||||
# Bluetooth tools
|
# Bluetooth tools
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${BLUE}Installing Bluetooth tools...${NC}"
|
echo -e "${BLUE}Installing Bluetooth tools...${NC}"
|
||||||
@@ -487,7 +517,7 @@ show_debian_manual() {
|
|||||||
echo "sudo apt install dump1090-mutability # or dump1090-fa"
|
echo "sudo apt install dump1090-mutability # or dump1090-fa"
|
||||||
echo ""
|
echo ""
|
||||||
echo "# WiFi scanning (optional)"
|
echo "# WiFi scanning (optional)"
|
||||||
echo "sudo apt install aircrack-ng"
|
echo "sudo apt install aircrack-ng hcxdumptool hcxtools"
|
||||||
echo ""
|
echo ""
|
||||||
echo "# Bluetooth scanning (optional)"
|
echo "# Bluetooth scanning (optional)"
|
||||||
echo "sudo apt install bluez bluetooth"
|
echo "sudo apt install bluez bluetooth"
|
||||||
|
|||||||
+21
-1
@@ -1,15 +1,35 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
logger = logging.getLogger('intercept.dependencies')
|
logger = logging.getLogger('intercept.dependencies')
|
||||||
|
|
||||||
|
# Additional paths to search for tools (e.g., /usr/sbin on Debian)
|
||||||
|
EXTRA_TOOL_PATHS = ['/usr/sbin', '/sbin']
|
||||||
|
|
||||||
|
|
||||||
def check_tool(name: str) -> bool:
|
def check_tool(name: str) -> bool:
|
||||||
"""Check if a tool is installed."""
|
"""Check if a tool is installed."""
|
||||||
return shutil.which(name) is not None
|
return get_tool_path(name) is not None
|
||||||
|
|
||||||
|
|
||||||
|
def get_tool_path(name: str) -> str | None:
|
||||||
|
"""Get the full path to a tool, checking standard PATH and extra locations."""
|
||||||
|
# First check standard PATH
|
||||||
|
path = shutil.which(name)
|
||||||
|
if path:
|
||||||
|
return path
|
||||||
|
|
||||||
|
# Check additional paths (e.g., /usr/sbin for aircrack-ng on Debian)
|
||||||
|
for extra_path in EXTRA_TOOL_PATHS:
|
||||||
|
full_path = os.path.join(extra_path, name)
|
||||||
|
if os.path.isfile(full_path) and os.access(full_path, os.X_OK):
|
||||||
|
return full_path
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
# Comprehensive tool dependency definitions
|
# Comprehensive tool dependency definitions
|
||||||
|
|||||||
Reference in New Issue
Block a user