mirror of
https://github.com/smittix/intercept.git
synced 2026-07-15 04:58:10 -07:00
Add gr-gsm and tshark as auto-installed dependencies
GSM Spy was failing with FileNotFoundError because grgsm_scanner wasn't installed. These tools are now installed automatically by setup.sh (both Debian and macOS) and included in the Dockerfile, matching how other tools like multimon-ng and ffmpeg are handled. - setup.sh: Remove ask_yes_no prompts for gr-gsm and tshark, install unconditionally; add check_recommended tier for final summary - Dockerfile: Add tshark to apt layer, add gr-gsm RUN layer with apt-then-source-build fallback, preseed debconf for tshark - gsm_spy.py: Add shutil.which pre-check in start_scanner route, catch FileNotFoundError in scanner_thread to stop retry loop Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+31
@@ -9,6 +9,9 @@ LABEL description="Signal Intelligence Platform for SDR monitoring"
|
|||||||
# Set working directory
|
# Set working directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Pre-accept tshark non-root capture prompt for non-interactive install
|
||||||
|
RUN echo 'wireshark-common wireshark-common/install-setuid boolean true' | debconf-set-selections
|
||||||
|
|
||||||
# Install system dependencies for SDR tools
|
# Install system dependencies for SDR tools
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
# RTL-SDR tools
|
# RTL-SDR tools
|
||||||
@@ -45,11 +48,39 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
airspy \
|
airspy \
|
||||||
limesuite \
|
limesuite \
|
||||||
hackrf \
|
hackrf \
|
||||||
|
# GSM Intelligence (tshark for packet parsing)
|
||||||
|
tshark \
|
||||||
# Utilities
|
# Utilities
|
||||||
curl \
|
curl \
|
||||||
procps \
|
procps \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# GSM Intelligence: gr-gsm (grgsm_scanner, grgsm_livemon)
|
||||||
|
# Install from apt if available, otherwise build from source
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends \
|
||||||
|
gnuradio gr-osmosdr gr-gsm 2>/dev/null \
|
||||||
|
|| ( \
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
gnuradio gnuradio-dev gr-osmosdr \
|
||||||
|
git cmake libboost-all-dev libcppunit-dev swig \
|
||||||
|
doxygen liblog4cpp5-dev python3-scipy python3-numpy \
|
||||||
|
libvolk-dev libfftw3-dev build-essential \
|
||||||
|
&& cd /tmp \
|
||||||
|
&& git clone --depth 1 https://github.com/ptrkrysik/gr-gsm.git \
|
||||||
|
&& cd gr-gsm \
|
||||||
|
&& mkdir build && cd build \
|
||||||
|
&& cmake .. \
|
||||||
|
&& make -j$(nproc) \
|
||||||
|
&& make install \
|
||||||
|
&& ldconfig \
|
||||||
|
&& rm -rf /tmp/gr-gsm \
|
||||||
|
&& apt-get remove -y gnuradio-dev libcppunit-dev swig doxygen \
|
||||||
|
liblog4cpp5-dev libvolk-dev build-essential git cmake \
|
||||||
|
&& apt-get autoremove -y \
|
||||||
|
) \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Build dump1090-fa and acarsdec from source (packages not available in slim repos)
|
# Build dump1090-fa and acarsdec from source (packages not available in slim repos)
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
build-essential \
|
build-essential \
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import queue
|
import queue
|
||||||
import re
|
import re
|
||||||
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
@@ -361,6 +362,11 @@ def start_scanner():
|
|||||||
|
|
||||||
# Build grgsm_scanner command
|
# Build grgsm_scanner command
|
||||||
# Example: grgsm_scanner --args="rtl=0" -b GSM900
|
# Example: grgsm_scanner --args="rtl=0" -b GSM900
|
||||||
|
if not shutil.which('grgsm_scanner'):
|
||||||
|
from app import release_sdr_device
|
||||||
|
release_sdr_device(device_index)
|
||||||
|
return jsonify({'error': 'grgsm_scanner not found. Please install gr-gsm.'}), 500
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cmd = ['grgsm_scanner']
|
cmd = ['grgsm_scanner']
|
||||||
|
|
||||||
@@ -1325,6 +1331,22 @@ def scanner_thread(cmd, device_index):
|
|||||||
|
|
||||||
logger.info(f"Scan #{scan_count} complete")
|
logger.info(f"Scan #{scan_count} complete")
|
||||||
|
|
||||||
|
except FileNotFoundError:
|
||||||
|
logger.error(
|
||||||
|
"grgsm_scanner not found. Please install gr-gsm: "
|
||||||
|
"https://github.com/ptrkrysik/gr-gsm"
|
||||||
|
)
|
||||||
|
# Send error to SSE stream so the UI knows
|
||||||
|
try:
|
||||||
|
app_module.gsm_spy_queue.put({
|
||||||
|
'type': 'error',
|
||||||
|
'message': 'grgsm_scanner not found. Please install gr-gsm.',
|
||||||
|
'timestamp': time.strftime('%Y-%m-%dT%H:%M:%S')
|
||||||
|
})
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
break # Don't retry - binary won't appear
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Scanner scan error: {e}", exc_info=True)
|
logger.error(f"Scanner scan error: {e}", exc_info=True)
|
||||||
if process and process.poll() is None:
|
if process and process.poll() is None:
|
||||||
|
|||||||
@@ -165,6 +165,7 @@ detect_dragonos() {
|
|||||||
# Required tool checks (with alternates)
|
# Required tool checks (with alternates)
|
||||||
# ----------------------------
|
# ----------------------------
|
||||||
missing_required=()
|
missing_required=()
|
||||||
|
missing_recommended=()
|
||||||
|
|
||||||
check_required() {
|
check_required() {
|
||||||
local label="$1"; shift
|
local label="$1"; shift
|
||||||
@@ -178,6 +179,18 @@ check_required() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_recommended() {
|
||||||
|
local label="$1"; shift
|
||||||
|
local desc="$1"; shift
|
||||||
|
|
||||||
|
if have_any "$@"; then
|
||||||
|
ok "${label} - ${desc}"
|
||||||
|
else
|
||||||
|
warn "${label} - ${desc} (missing, recommended)"
|
||||||
|
missing_recommended+=("$label")
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
check_optional() {
|
check_optional() {
|
||||||
local label="$1"; shift
|
local label="$1"; shift
|
||||||
local desc="$1"; shift
|
local desc="$1"; shift
|
||||||
@@ -230,6 +243,12 @@ check_tools() {
|
|||||||
check_required "hcitool" "Bluetooth scan utility" hcitool
|
check_required "hcitool" "Bluetooth scan utility" hcitool
|
||||||
check_required "hciconfig" "Bluetooth adapter config" hciconfig
|
check_required "hciconfig" "Bluetooth adapter config" hciconfig
|
||||||
|
|
||||||
|
echo
|
||||||
|
info "GSM Intelligence:"
|
||||||
|
check_recommended "grgsm_scanner" "GSM tower scanner (gr-gsm)" grgsm_scanner
|
||||||
|
check_recommended "grgsm_livemon" "GSM live monitor (gr-gsm)" grgsm_livemon
|
||||||
|
check_recommended "tshark" "Packet analysis (Wireshark)" tshark
|
||||||
|
|
||||||
echo
|
echo
|
||||||
info "SoapySDR:"
|
info "SoapySDR:"
|
||||||
check_required "SoapySDRUtil" "SoapySDR CLI utility" SoapySDRUtil
|
check_required "SoapySDRUtil" "SoapySDR CLI utility" SoapySDRUtil
|
||||||
@@ -605,7 +624,7 @@ install_aiscatcher_from_source_macos() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
install_macos_packages() {
|
install_macos_packages() {
|
||||||
TOTAL_STEPS=17
|
TOTAL_STEPS=18
|
||||||
CURRENT_STEP=0
|
CURRENT_STEP=0
|
||||||
|
|
||||||
progress "Checking Homebrew"
|
progress "Checking Homebrew"
|
||||||
@@ -695,47 +714,42 @@ install_macos_packages() {
|
|||||||
brew_install gpsd
|
brew_install gpsd
|
||||||
|
|
||||||
# gr-gsm for GSM Intelligence
|
# gr-gsm for GSM Intelligence
|
||||||
|
progress "Installing gr-gsm"
|
||||||
if ! cmd_exists grgsm_scanner; then
|
if ! cmd_exists grgsm_scanner; then
|
||||||
echo
|
brew_install gnuradio
|
||||||
info "gr-gsm provides GSM cellular signal decoding..."
|
(brew_install gr-gsm) || {
|
||||||
if ask_yes_no "Do you want to install gr-gsm?"; then
|
warn "gr-gsm not available in Homebrew, building from source..."
|
||||||
progress "Installing gr-gsm"
|
(
|
||||||
brew_install gnuradio
|
tmp_dir="$(mktemp -d)"
|
||||||
(brew_install gr-gsm) || {
|
trap 'rm -rf "$tmp_dir"' EXIT
|
||||||
warn "gr-gsm not available in Homebrew, attempting manual build..."
|
|
||||||
# Manual build instructions
|
info "Cloning gr-gsm repository..."
|
||||||
if ask_yes_no "Attempt to build gr-gsm from source? (requires CMake and build tools)"; then
|
git clone --depth 1 https://github.com/ptrkrysik/gr-gsm.git "$tmp_dir/gr-gsm" >/dev/null 2>&1 \
|
||||||
info "Cloning gr-gsm repository..."
|
|| { warn "Failed to clone gr-gsm. GSM Spy feature will not work."; exit 1; }
|
||||||
git clone https://github.com/ptrkrysik/gr-gsm.git /tmp/gr-gsm
|
|
||||||
cd /tmp/gr-gsm
|
cd "$tmp_dir/gr-gsm"
|
||||||
mkdir build && cd build
|
mkdir -p build && cd build
|
||||||
cmake ..
|
info "Compiling gr-gsm (this may take several minutes)..."
|
||||||
make -j$(sysctl -n hw.ncpu)
|
if cmake .. >/dev/null 2>&1 && make -j$(sysctl -n hw.ncpu) >/dev/null 2>&1; then
|
||||||
sudo make install
|
if [[ -w /usr/local/lib ]]; then
|
||||||
cd ~
|
make install >/dev/null 2>&1
|
||||||
rm -rf /tmp/gr-gsm
|
else
|
||||||
ok "gr-gsm installed successfully"
|
sudo make install >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
ok "gr-gsm installed successfully from source"
|
||||||
else
|
else
|
||||||
warn "Skipping gr-gsm source build. GSM Spy feature will not work."
|
warn "Failed to build gr-gsm. GSM Spy feature will not work."
|
||||||
fi
|
fi
|
||||||
}
|
)
|
||||||
else
|
}
|
||||||
warn "Skipping gr-gsm installation. GSM Spy feature will not work."
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
ok "gr-gsm already installed"
|
ok "gr-gsm already installed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Wireshark (tshark) for packet analysis
|
# Wireshark (tshark) for GSM packet analysis
|
||||||
|
progress "Installing tshark"
|
||||||
if ! cmd_exists tshark; then
|
if ! cmd_exists tshark; then
|
||||||
echo
|
brew_install wireshark
|
||||||
info "tshark is used for GSM packet parsing..."
|
|
||||||
if ask_yes_no "Do you want to install tshark?"; then
|
|
||||||
progress "Installing Wireshark (tshark)"
|
|
||||||
brew_install wireshark
|
|
||||||
else
|
|
||||||
warn "Skipping tshark installation."
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
ok "tshark already installed"
|
ok "tshark already installed"
|
||||||
fi
|
fi
|
||||||
@@ -1025,7 +1039,7 @@ install_debian_packages() {
|
|||||||
export NEEDRESTART_MODE=a
|
export NEEDRESTART_MODE=a
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TOTAL_STEPS=22
|
TOTAL_STEPS=25
|
||||||
CURRENT_STEP=0
|
CURRENT_STEP=0
|
||||||
|
|
||||||
progress "Updating APT package lists"
|
progress "Updating APT package lists"
|
||||||
@@ -1151,77 +1165,72 @@ install_debian_packages() {
|
|||||||
apt_install gpsd gpsd-clients || true
|
apt_install gpsd gpsd-clients || true
|
||||||
|
|
||||||
# gr-gsm for GSM Intelligence
|
# gr-gsm for GSM Intelligence
|
||||||
|
progress "Installing GNU Radio and gr-gsm"
|
||||||
if ! cmd_exists grgsm_scanner; then
|
if ! cmd_exists grgsm_scanner; then
|
||||||
echo
|
# Try to install gr-gsm directly from package repositories
|
||||||
info "gr-gsm provides GSM cellular signal decoding..."
|
apt_install gnuradio gnuradio-dev gr-osmosdr gr-gsm || {
|
||||||
if ask_yes_no "Do you want to install gr-gsm?"; then
|
warn "gr-gsm package not available in repositories. Attempting source build..."
|
||||||
progress "Installing GNU Radio and gr-gsm"
|
|
||||||
# Try to install gr-gsm directly from package repositories
|
|
||||||
apt_install gnuradio gnuradio-dev gr-osmosdr gr-gsm || {
|
|
||||||
warn "gr-gsm package not available in repositories. Attempting source build..."
|
|
||||||
|
|
||||||
# Fallback: Build from source
|
# Fallback: Build from source
|
||||||
progress "Building gr-gsm from source"
|
progress "Building gr-gsm from source"
|
||||||
apt_install git cmake libboost-all-dev libcppunit-dev swig \
|
apt_install git cmake libboost-all-dev libcppunit-dev swig \
|
||||||
doxygen liblog4cpp5-dev python3-scipy python3-numpy \
|
doxygen liblog4cpp5-dev python3-scipy python3-numpy \
|
||||||
libvolk-dev libuhd-dev libfftw3-dev || true
|
libvolk-dev libuhd-dev libfftw3-dev || true
|
||||||
|
|
||||||
info "Cloning gr-gsm repository..."
|
info "Cloning gr-gsm repository..."
|
||||||
if [ -d /tmp/gr-gsm ]; then
|
if [ -d /tmp/gr-gsm ]; then
|
||||||
|
rm -rf /tmp/gr-gsm
|
||||||
|
fi
|
||||||
|
|
||||||
|
git clone https://github.com/ptrkrysik/gr-gsm.git /tmp/gr-gsm || {
|
||||||
|
warn "Failed to clone gr-gsm repository. GSM Spy will not be available."
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
cd /tmp/gr-gsm
|
||||||
|
mkdir -p build && cd build
|
||||||
|
|
||||||
|
# Try to find GNU Radio cmake files
|
||||||
|
if [ -d /usr/lib/x86_64-linux-gnu/cmake/gnuradio ]; then
|
||||||
|
export CMAKE_PREFIX_PATH="/usr/lib/x86_64-linux-gnu/cmake/gnuradio:$CMAKE_PREFIX_PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
info "Running CMake configuration..."
|
||||||
|
if cmake .. 2>/dev/null; then
|
||||||
|
info "Compiling gr-gsm (this may take several minutes)..."
|
||||||
|
if make -j$(nproc) 2>/dev/null; then
|
||||||
|
$SUDO make install
|
||||||
|
$SUDO ldconfig
|
||||||
|
cd ~
|
||||||
rm -rf /tmp/gr-gsm
|
rm -rf /tmp/gr-gsm
|
||||||
fi
|
ok "gr-gsm built and installed successfully"
|
||||||
|
|
||||||
git clone https://github.com/ptrkrysik/gr-gsm.git /tmp/gr-gsm || {
|
|
||||||
warn "Failed to clone gr-gsm repository. GSM Spy will not be available."
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
cd /tmp/gr-gsm
|
|
||||||
mkdir -p build && cd build
|
|
||||||
|
|
||||||
# Try to find GNU Radio cmake files
|
|
||||||
if [ -d /usr/lib/x86_64-linux-gnu/cmake/gnuradio ]; then
|
|
||||||
export CMAKE_PREFIX_PATH="/usr/lib/x86_64-linux-gnu/cmake/gnuradio:$CMAKE_PREFIX_PATH"
|
|
||||||
fi
|
|
||||||
|
|
||||||
info "Running CMake configuration..."
|
|
||||||
if cmake .. 2>/dev/null; then
|
|
||||||
info "Compiling gr-gsm (this may take several minutes)..."
|
|
||||||
if make -j$(nproc) 2>/dev/null; then
|
|
||||||
$SUDO make install
|
|
||||||
$SUDO ldconfig
|
|
||||||
cd ~
|
|
||||||
rm -rf /tmp/gr-gsm
|
|
||||||
ok "gr-gsm built and installed successfully"
|
|
||||||
else
|
|
||||||
warn "gr-gsm compilation failed. GSM Spy feature will not work."
|
|
||||||
cd ~
|
|
||||||
rm -rf /tmp/gr-gsm
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
warn "gr-gsm CMake configuration failed. GNU Radio 3.8+ may not be available."
|
warn "gr-gsm compilation failed. GSM Spy feature will not work."
|
||||||
cd ~
|
cd ~
|
||||||
rm -rf /tmp/gr-gsm
|
rm -rf /tmp/gr-gsm
|
||||||
fi
|
fi
|
||||||
}
|
|
||||||
|
|
||||||
# Verify installation
|
|
||||||
if cmd_exists grgsm_scanner; then
|
|
||||||
ok "gr-gsm installed successfully"
|
|
||||||
else
|
else
|
||||||
warn "gr-gsm installation incomplete. GSM Spy feature will not work."
|
warn "gr-gsm CMake configuration failed. GNU Radio 3.8+ may not be available."
|
||||||
|
cd ~
|
||||||
|
rm -rf /tmp/gr-gsm
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Verify installation
|
||||||
|
if cmd_exists grgsm_scanner; then
|
||||||
|
ok "gr-gsm installed successfully"
|
||||||
else
|
else
|
||||||
warn "Skipping gr-gsm installation."
|
warn "gr-gsm installation incomplete. GSM Spy feature will not work."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
ok "gr-gsm already installed"
|
ok "gr-gsm already installed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Wireshark (tshark)
|
# Wireshark (tshark) for GSM packet analysis
|
||||||
|
progress "Installing tshark"
|
||||||
if ! cmd_exists tshark; then
|
if ! cmd_exists tshark; then
|
||||||
echo
|
# Pre-accept non-root capture prompt for non-interactive install
|
||||||
info "Installing tshark for GSM packet analysis..."
|
echo 'wireshark-common wireshark-common/install-setuid boolean true' | $SUDO debconf-set-selections
|
||||||
apt_install tshark || true
|
apt_install tshark || true
|
||||||
# Allow non-root capture
|
# Allow non-root capture
|
||||||
$SUDO dpkg-reconfigure wireshark-common 2>/dev/null || true
|
$SUDO dpkg-reconfigure wireshark-common 2>/dev/null || true
|
||||||
@@ -1312,6 +1321,14 @@ final_summary_and_hard_fail() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "${#missing_recommended[@]}" -gt 0 ]]; then
|
||||||
|
echo
|
||||||
|
warn "Missing RECOMMENDED tools (some features will not work):"
|
||||||
|
for t in "${missing_recommended[@]}"; do echo " - $t"; done
|
||||||
|
echo
|
||||||
|
warn "Install these for full functionality (GSM Intelligence, etc.)"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# ----------------------------
|
# ----------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user