mirror of
https://github.com/smittix/intercept.git
synced 2026-04-24 06:40:00 -07:00
Add Listening Post, improve setup and documentation
- Add Listening Post mode with frequency scanner and audio monitoring - Add dependency warning for aircraft dashboard listen feature - Auto-restart audio when switching frequencies - Fix toolbar overflow on aircraft dashboard custom frequency - Update setup script with full macOS/Debian support - Clean up README and documentation for clarity - Add sox and dump1090 to Dockerfile - Add comprehensive tool reference to HARDWARE.md - Add correlation, settings, and database utilities - Add new test files for routes, validation, correlation, database 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
213
utils/constants.py
Normal file
213
utils/constants.py
Normal file
@@ -0,0 +1,213 @@
|
||||
"""
|
||||
INTERCEPT - Constants and Magic Numbers
|
||||
|
||||
Centralized location for all hardcoded values used throughout the application.
|
||||
This improves maintainability and makes the codebase self-documenting.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
# =============================================================================
|
||||
# NETWORK PORTS
|
||||
# =============================================================================
|
||||
|
||||
# ADS-B SBS data output port (dump1090 default)
|
||||
ADSB_SBS_PORT = 30003
|
||||
|
||||
# GPS daemon port (gpsd default)
|
||||
GPSD_PORT = 2947
|
||||
|
||||
# RTL-TCP server port (rtl_tcp default)
|
||||
RTL_TCP_PORT = 1234
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# PROCESS TIMEOUTS (seconds)
|
||||
# =============================================================================
|
||||
|
||||
# General process termination timeout
|
||||
PROCESS_TERMINATE_TIMEOUT = 2
|
||||
|
||||
# ADS-B process termination (dump1090 needs longer)
|
||||
ADSB_TERMINATE_TIMEOUT = 5
|
||||
|
||||
# WiFi process termination (airodump-ng)
|
||||
WIFI_TERMINATE_TIMEOUT = 3
|
||||
|
||||
# Bluetooth process termination
|
||||
BT_TERMINATE_TIMEOUT = 3
|
||||
|
||||
# PMKID process termination
|
||||
PMKID_TERMINATE_TIMEOUT = 5
|
||||
|
||||
# Socket connection timeout
|
||||
SOCKET_CONNECT_TIMEOUT = 2
|
||||
|
||||
# SBS stream socket timeout
|
||||
SBS_SOCKET_TIMEOUT = 5
|
||||
|
||||
# Subprocess command timeout (short operations)
|
||||
SUBPROCESS_TIMEOUT_SHORT = 5
|
||||
|
||||
# Subprocess command timeout (medium operations)
|
||||
SUBPROCESS_TIMEOUT_MEDIUM = 10
|
||||
|
||||
# Subprocess command timeout (long operations like airmon-ng)
|
||||
SUBPROCESS_TIMEOUT_LONG = 15
|
||||
|
||||
# External HTTP request timeout (TLE fetching, etc.)
|
||||
HTTP_REQUEST_TIMEOUT = 10
|
||||
|
||||
# Deauth command timeout
|
||||
DEAUTH_TIMEOUT = 30
|
||||
|
||||
# Service enumeration timeout (sdptool browse)
|
||||
SERVICE_ENUM_TIMEOUT = 30
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# SSE (Server-Sent Events) SETTINGS
|
||||
# =============================================================================
|
||||
|
||||
# Keepalive interval for SSE streams (seconds)
|
||||
SSE_KEEPALIVE_INTERVAL = 30.0
|
||||
|
||||
# Queue get timeout for SSE generators (seconds)
|
||||
SSE_QUEUE_TIMEOUT = 1.0
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# DATA RETENTION / CLEANUP (seconds)
|
||||
# =============================================================================
|
||||
|
||||
# Maximum age for aircraft data before cleanup
|
||||
MAX_AIRCRAFT_AGE_SECONDS = 300 # 5 minutes
|
||||
|
||||
# Maximum age for WiFi network data before cleanup
|
||||
MAX_WIFI_NETWORK_AGE_SECONDS = 600 # 10 minutes
|
||||
|
||||
# Maximum age for Bluetooth device data before cleanup
|
||||
MAX_BT_DEVICE_AGE_SECONDS = 300 # 5 minutes
|
||||
|
||||
# ADS-B queue batch update interval
|
||||
ADSB_UPDATE_INTERVAL = 1.0 # seconds
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# QUEUE LIMITS
|
||||
# =============================================================================
|
||||
|
||||
# Maximum queue size for all data queues
|
||||
QUEUE_MAX_SIZE = 1000
|
||||
|
||||
# GPS queue size (smaller, more frequent updates)
|
||||
GPS_QUEUE_MAX_SIZE = 100
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# DATA PARSING
|
||||
# =============================================================================
|
||||
|
||||
# WiFi CSV parse interval (seconds)
|
||||
WIFI_CSV_PARSE_INTERVAL = 2.0
|
||||
|
||||
# Minimum time before warning about no CSV data
|
||||
WIFI_CSV_TIMEOUT_WARNING = 5.0
|
||||
|
||||
# Socket receive buffer size
|
||||
SOCKET_BUFFER_SIZE = 4096
|
||||
|
||||
# PTY read buffer size
|
||||
PTY_BUFFER_SIZE = 1024
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# EXTERNAL SERVICE LIMITS
|
||||
# =============================================================================
|
||||
|
||||
# Maximum response size for external HTTP requests (bytes)
|
||||
MAX_HTTP_RESPONSE_SIZE = 1024 * 1024 # 1 MB
|
||||
|
||||
# Deauth packet count limits
|
||||
MIN_DEAUTH_COUNT = 1
|
||||
MAX_DEAUTH_COUNT = 100
|
||||
DEFAULT_DEAUTH_COUNT = 5
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# VALIDATION LIMITS
|
||||
# =============================================================================
|
||||
|
||||
# Squelch range
|
||||
MIN_SQUELCH = 0
|
||||
MAX_SQUELCH = 1000
|
||||
|
||||
# Valid GPS baudrates
|
||||
VALID_GPS_BAUDRATES = [4800, 9600, 19200, 38400, 57600, 115200]
|
||||
|
||||
# Port range
|
||||
MIN_PORT = 1
|
||||
MAX_PORT = 65535
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# SATELLITE TRACKING
|
||||
# =============================================================================
|
||||
|
||||
# Default observer location (London)
|
||||
DEFAULT_LATITUDE = 51.5074
|
||||
DEFAULT_LONGITUDE = -0.1278
|
||||
|
||||
# Allowed TLE hosts for security
|
||||
ALLOWED_TLE_HOSTS = [
|
||||
'celestrak.org',
|
||||
'celestrak.com',
|
||||
'www.celestrak.org',
|
||||
'www.celestrak.com'
|
||||
]
|
||||
|
||||
# Earth radius (km) - WGS84 mean
|
||||
EARTH_RADIUS_KM = 6371
|
||||
|
||||
# Trajectory calculation points
|
||||
TRAJECTORY_POINTS = 30
|
||||
GROUND_TRACK_POINTS = 60
|
||||
ORBIT_TRACK_RANGE_MINUTES = 45
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# SLEEP/DELAY TIMES (seconds)
|
||||
# =============================================================================
|
||||
|
||||
# Wait after starting process before checking status
|
||||
PROCESS_START_WAIT = 0.5
|
||||
|
||||
# Wait after dump1090 start before connecting
|
||||
DUMP1090_START_WAIT = 3.0
|
||||
|
||||
# Delay between monitor mode operations
|
||||
MONITOR_MODE_DELAY = 1.0
|
||||
|
||||
# Bluetooth adapter reset delays
|
||||
BT_RESET_DELAY = 0.5
|
||||
BT_ADAPTER_DOWN_WAIT = 1.0
|
||||
|
||||
# SBS reconnection delay on error
|
||||
SBS_RECONNECT_DELAY = 2.0
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# FILE PATHS
|
||||
# =============================================================================
|
||||
|
||||
# Default pager log file
|
||||
DEFAULT_PAGER_LOG_FILE = 'pager_messages.log'
|
||||
|
||||
# WiFi capture temp path prefix
|
||||
WIFI_CAPTURE_PATH_PREFIX = '/tmp/intercept_wifi'
|
||||
|
||||
# Handshake capture path prefix
|
||||
HANDSHAKE_CAPTURE_PATH_PREFIX = '/tmp/intercept_handshake_'
|
||||
|
||||
# PMKID capture path prefix
|
||||
PMKID_CAPTURE_PATH_PREFIX = '/tmp/intercept_pmkid_'
|
||||
Reference in New Issue
Block a user