mirror of
https://github.com/smittix/intercept.git
synced 2026-06-08 06:01:56 -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
|
||||
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
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
# RTL-SDR tools
|
||||
@@ -45,11 +48,39 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
airspy \
|
||||
limesuite \
|
||||
hackrf \
|
||||
# GSM Intelligence (tshark for packet parsing)
|
||||
tshark \
|
||||
# Utilities
|
||||
curl \
|
||||
procps \
|
||||
&& 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)
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
|
||||
@@ -6,6 +6,7 @@ import json
|
||||
import logging
|
||||
import queue
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import threading
|
||||
import time
|
||||
@@ -361,6 +362,11 @@ def start_scanner():
|
||||
|
||||
# Build grgsm_scanner command
|
||||
# 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:
|
||||
cmd = ['grgsm_scanner']
|
||||
|
||||
@@ -1325,6 +1331,22 @@ def scanner_thread(cmd, device_index):
|
||||
|
||||
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:
|
||||
logger.error(f"Scanner scan error: {e}", exc_info=True)
|
||||
if process and process.poll() is None:
|
||||
|
||||
@@ -165,6 +165,7 @@ detect_dragonos() {
|
||||
# Required tool checks (with alternates)
|
||||
# ----------------------------
|
||||
missing_required=()
|
||||
missing_recommended=()
|
||||
|
||||
check_required() {
|
||||
local label="$1"; shift
|
||||
@@ -178,6 +179,18 @@ check_required() {
|
||||
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() {
|
||||
local label="$1"; shift
|
||||
local desc="$1"; shift
|
||||
@@ -230,6 +243,12 @@ check_tools() {
|
||||
check_required "hcitool" "Bluetooth scan utility" hcitool
|
||||
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
|
||||
info "SoapySDR:"
|
||||
check_required "SoapySDRUtil" "SoapySDR CLI utility" SoapySDRUtil
|
||||
@@ -605,7 +624,7 @@ install_aiscatcher_from_source_macos() {
|
||||
}
|
||||
|
||||
install_macos_packages() {
|
||||
TOTAL_STEPS=17
|
||||
TOTAL_STEPS=18
|
||||
CURRENT_STEP=0
|
||||
|
||||
progress "Checking Homebrew"
|
||||
@@ -695,47 +714,42 @@ install_macos_packages() {
|
||||
brew_install gpsd
|
||||
|
||||
# gr-gsm for GSM Intelligence
|
||||
progress "Installing gr-gsm"
|
||||
if ! cmd_exists grgsm_scanner; then
|
||||
echo
|
||||
info "gr-gsm provides GSM cellular signal decoding..."
|
||||
if ask_yes_no "Do you want to install gr-gsm?"; then
|
||||
progress "Installing gr-gsm"
|
||||
brew_install gnuradio
|
||||
(brew_install gr-gsm) || {
|
||||
warn "gr-gsm not available in Homebrew, attempting manual build..."
|
||||
# Manual build instructions
|
||||
if ask_yes_no "Attempt to build gr-gsm from source? (requires CMake and build tools)"; then
|
||||
info "Cloning gr-gsm repository..."
|
||||
git clone https://github.com/ptrkrysik/gr-gsm.git /tmp/gr-gsm
|
||||
cd /tmp/gr-gsm
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
make -j$(sysctl -n hw.ncpu)
|
||||
sudo make install
|
||||
cd ~
|
||||
rm -rf /tmp/gr-gsm
|
||||
ok "gr-gsm installed successfully"
|
||||
brew_install gnuradio
|
||||
(brew_install gr-gsm) || {
|
||||
warn "gr-gsm not available in Homebrew, building from source..."
|
||||
(
|
||||
tmp_dir="$(mktemp -d)"
|
||||
trap 'rm -rf "$tmp_dir"' EXIT
|
||||
|
||||
info "Cloning gr-gsm repository..."
|
||||
git clone --depth 1 https://github.com/ptrkrysik/gr-gsm.git "$tmp_dir/gr-gsm" >/dev/null 2>&1 \
|
||||
|| { warn "Failed to clone gr-gsm. GSM Spy feature will not work."; exit 1; }
|
||||
|
||||
cd "$tmp_dir/gr-gsm"
|
||||
mkdir -p build && cd build
|
||||
info "Compiling gr-gsm (this may take several minutes)..."
|
||||
if cmake .. >/dev/null 2>&1 && make -j$(sysctl -n hw.ncpu) >/dev/null 2>&1; then
|
||||
if [[ -w /usr/local/lib ]]; then
|
||||
make install >/dev/null 2>&1
|
||||
else
|
||||
sudo make install >/dev/null 2>&1
|
||||
fi
|
||||
ok "gr-gsm installed successfully from source"
|
||||
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
|
||||
}
|
||||
else
|
||||
warn "Skipping gr-gsm installation. GSM Spy feature will not work."
|
||||
fi
|
||||
)
|
||||
}
|
||||
else
|
||||
ok "gr-gsm already installed"
|
||||
fi
|
||||
|
||||
# Wireshark (tshark) for packet analysis
|
||||
# Wireshark (tshark) for GSM packet analysis
|
||||
progress "Installing tshark"
|
||||
if ! cmd_exists tshark; then
|
||||
echo
|
||||
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
|
||||
brew_install wireshark
|
||||
else
|
||||
ok "tshark already installed"
|
||||
fi
|
||||
@@ -1025,7 +1039,7 @@ install_debian_packages() {
|
||||
export NEEDRESTART_MODE=a
|
||||
fi
|
||||
|
||||
TOTAL_STEPS=22
|
||||
TOTAL_STEPS=25
|
||||
CURRENT_STEP=0
|
||||
|
||||
progress "Updating APT package lists"
|
||||
@@ -1151,77 +1165,72 @@ install_debian_packages() {
|
||||
apt_install gpsd gpsd-clients || true
|
||||
|
||||
# gr-gsm for GSM Intelligence
|
||||
progress "Installing GNU Radio and gr-gsm"
|
||||
if ! cmd_exists grgsm_scanner; then
|
||||
echo
|
||||
info "gr-gsm provides GSM cellular signal decoding..."
|
||||
if ask_yes_no "Do you want to install gr-gsm?"; then
|
||||
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..."
|
||||
# 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
|
||||
progress "Building gr-gsm from source"
|
||||
apt_install git cmake libboost-all-dev libcppunit-dev swig \
|
||||
doxygen liblog4cpp5-dev python3-scipy python3-numpy \
|
||||
libvolk-dev libuhd-dev libfftw3-dev || true
|
||||
# Fallback: Build from source
|
||||
progress "Building gr-gsm from source"
|
||||
apt_install git cmake libboost-all-dev libcppunit-dev swig \
|
||||
doxygen liblog4cpp5-dev python3-scipy python3-numpy \
|
||||
libvolk-dev libuhd-dev libfftw3-dev || true
|
||||
|
||||
info "Cloning gr-gsm repository..."
|
||||
if [ -d /tmp/gr-gsm ]; then
|
||||
info "Cloning gr-gsm repository..."
|
||||
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
|
||||
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
|
||||
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
|
||||
ok "gr-gsm built and installed successfully"
|
||||
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 ~
|
||||
rm -rf /tmp/gr-gsm
|
||||
fi
|
||||
}
|
||||
|
||||
# Verify installation
|
||||
if cmd_exists grgsm_scanner; then
|
||||
ok "gr-gsm installed successfully"
|
||||
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
|
||||
}
|
||||
|
||||
# Verify installation
|
||||
if cmd_exists grgsm_scanner; then
|
||||
ok "gr-gsm installed successfully"
|
||||
else
|
||||
warn "Skipping gr-gsm installation."
|
||||
warn "gr-gsm installation incomplete. GSM Spy feature will not work."
|
||||
fi
|
||||
else
|
||||
ok "gr-gsm already installed"
|
||||
fi
|
||||
|
||||
# Wireshark (tshark)
|
||||
# Wireshark (tshark) for GSM packet analysis
|
||||
progress "Installing tshark"
|
||||
if ! cmd_exists tshark; then
|
||||
echo
|
||||
info "Installing tshark for GSM packet analysis..."
|
||||
# Pre-accept non-root capture prompt for non-interactive install
|
||||
echo 'wireshark-common wireshark-common/install-setuid boolean true' | $SUDO debconf-set-selections
|
||||
apt_install tshark || true
|
||||
# Allow non-root capture
|
||||
$SUDO dpkg-reconfigure wireshark-common 2>/dev/null || true
|
||||
@@ -1312,6 +1321,14 @@ final_summary_and_hard_fail() {
|
||||
exit 1
|
||||
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