Skip to content

Scripts

GlomarGadaffi edited this page Jun 4, 2026 · 1 revision

Scripts

The Scripts/ directory contains standalone Python tooling that complements the browser dashboard.

cc_hunter.py

Path: Scripts/cc_hunter.py Language: Python Added: March 15, 2026 (commit db5c3a9)

Purpose

cc_hunter.py is a standalone P25 control channel scanner. It operates independently of the browser dashboard and communicates with the BCD325P2 directly over serial to hunt for, qualify, and lock onto P25 control channels. Discovered data is written to a SQLite database for offline analysis.

It is part of the "BearSentinel RF telemetry stack" and is designed for persistent, headless data collection without keeping a browser open.

How It Works

The script runs a three-phase state machine:

Phase 1: Sweeping Scans configured frequency ranges and measures signal strength (RSSI) across candidates.

Phase 2: Qualifying Tests promising frequency candidates for two characteristics of P25 control channels:

  • Stable P25 Network Access Code (NAC)
  • High duty cycle — control channels transmit near-continuously

Scoring weights:

Factor Weight
NAC consistency 55%
Duty cycle 30%
Signal strength (RSSI) 15%

Phase 3: Monitoring Locks onto the best qualifying candidate and tracks talkgroup IDs (TGIDs) and signal health continuously. Triggers callbacks on state changes, new talkgroup discoveries, and channel loss events.

Command-Line Arguments

Argument Default Description
--port /dev/ttyUSB0 Serial device path
--baud 115200 Baud rate
--db (required) Path to SQLite output database file
--rssi-min (see code) Minimum signal strength threshold
--duty-threshold 0.0–1.0 Minimum duty cycle for qualification
--nac-threshold 0.0–1.0 Minimum NAC consistency for qualification
--qualify-duration (see code) Seconds a candidate must sustain thresholds
--loss-timeout (see code) Seconds of silence before falling back to sweep
--log-level (see code) Logging verbosity (DEBUG, INFO, WARNING)

Usage Example

python Scripts/cc_hunter.py \
  --port /dev/ttyUSB0 \
  --baud 115200 \
  --db ./hunt_results.db \
  --rssi-min 30 \
  --duty-threshold 0.6 \
  --nac-threshold 0.7 \
  --qualify-duration 10 \
  --loss-timeout 30 \
  --log-level INFO

Outputs

SQLite database:

  • Control channel lock events (frequency, NAC, lock timestamp)
  • TGID events (talkgroup ID, timestamp, associated control channel)
  • RSSI samples over time

Requirements

Python 3.x with pyserial. sqlite3 is standard library (no install needed).

Integration with the Dashboard

cc_hunter.py operates independently — it does not feed data into the browser dashboard in real time. It is a complementary offline collection tool. You can build a historical TGID database from SQLite and cross-reference with dashboard exports.

Clone this wiki locally