mirror of
https://github.com/colonelpanichacks/flock-you.git
synced 2026-06-14 07:53:34 -07:00
Add files via upload
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
## Overview
|
||||
|
||||
Flock You is an advanced detection system designed to identify Flock Safety surveillance cameras and similar surveillance devices using multiple detection methodologies. Built for the Xiao ESP32 S3 microcontroller, it provides real-time monitoring with audio alerts and comprehensive JSON output.
|
||||
Flock You is an advanced detection system designed to identify Flock Safety surveillance cameras, Raven gunshot detectors, and similar surveillance devices using multiple detection methodologies. Built for the Xiao ESP32 S3 microcontroller, it provides real-time monitoring with audio alerts and comprehensive JSON output. The system now includes specialized BLE service UUID fingerprinting for detecting SoundThinking/ShotSpotter Raven acoustic surveillance devices.
|
||||
|
||||
## Features
|
||||
|
||||
@@ -16,6 +16,7 @@ Flock You is an advanced detection system designed to identify Flock Safety surv
|
||||
- **MAC Address Filtering**: Detects devices by known MAC prefixes
|
||||
- **SSID Pattern Matching**: Identifies networks by specific names
|
||||
- **Device Name Pattern Matching**: Detects BLE devices by advertised names
|
||||
- **BLE Service UUID Detection**: Identifies Raven gunshot detectors by service UUIDs (NEW)
|
||||
|
||||
### Audio Alert System
|
||||
- **Boot Sequence**: 2 beeps (low pitch → high pitch) on startup
|
||||
@@ -111,6 +112,8 @@ GND ---> Negative (-)
|
||||
- **Advertisement Scanning**: Monitors BLE device broadcasts
|
||||
- **Device Names**: Matches against known surveillance device names
|
||||
- **MAC Address Filtering**: Detects devices by BLE MAC prefixes
|
||||
- **Service UUID Detection**: Identifies Raven devices by advertised service UUIDs
|
||||
- **Firmware Version Estimation**: Automatically determines Raven firmware version (1.1.x, 1.2.x, 1.3.x)
|
||||
- **Active Scanning**: Continuous monitoring with 100ms intervals
|
||||
|
||||
### Real-World Database Integration
|
||||
@@ -118,10 +121,40 @@ Detection patterns are derived from actual field data including:
|
||||
- Flock Safety camera signatures
|
||||
- Penguin surveillance device patterns
|
||||
- Pigvision system identifiers
|
||||
- Raven acoustic gunshot detection devices (SoundThinking/ShotSpotter)
|
||||
- Extended battery and external antenna configurations
|
||||
|
||||
**Datasets from deflock.me are included in the `datasets/` folder of this repository**, providing comprehensive device signatures and detection patterns for enhanced accuracy.
|
||||
|
||||
### Raven Gunshot Detection System
|
||||
Flock You now includes specialized detection for **Raven acoustic gunshot detection devices** (by SoundThinking/ShotSpotter) using BLE service UUID fingerprinting:
|
||||
|
||||
#### Detected Raven Services
|
||||
- **Device Information Service** (`0000180a-...`) - Serial number, model, firmware version
|
||||
- **GPS Location Service** (`00003100-...`) - Real-time device coordinates
|
||||
- **Power Management Service** (`00003200-...`) - Battery and solar panel status
|
||||
- **Network Status Service** (`00003300-...`) - LTE and WiFi connectivity information
|
||||
- **Upload Statistics Service** (`00003400-...`) - Data transmission metrics
|
||||
- **Error/Failure Service** (`00003500-...`) - System diagnostics and error logs
|
||||
- **Legacy Services** (`00001809-...`, `00001819-...`) - Older firmware versions (1.1.x)
|
||||
|
||||
#### Firmware Version Detection
|
||||
The system automatically identifies Raven firmware versions based on advertised services:
|
||||
- **1.1.x (Legacy)**: Uses Health Thermometer and Location/Navigation services
|
||||
- **1.2.x**: Introduces GPS, Power, and Network services
|
||||
- **1.3.x (Latest)**: Full suite of diagnostic and monitoring services
|
||||
|
||||
#### Raven Detection Output
|
||||
When a Raven device is detected, the system provides:
|
||||
- Device type identification: `RAVEN_GUNSHOT_DETECTOR`
|
||||
- Manufacturer: `SoundThinking/ShotSpotter`
|
||||
- Complete list of advertised service UUIDs
|
||||
- Service descriptions (GPS, Battery, Network status, etc.)
|
||||
- Estimated firmware version
|
||||
- Threat level: `CRITICAL` with score of 100
|
||||
|
||||
**Configuration data sourced from `raven_configurations.json`** (provided by [GainSec](https://github.com/GainSec)) in the datasets folder, containing verified service UUIDs from firmware versions 1.1.7, 1.2.0, and 1.3.1.
|
||||
|
||||
## Technical Specifications
|
||||
|
||||
### WiFi Capabilities
|
||||
@@ -143,6 +176,8 @@ Detection patterns are derived from actual field data including:
|
||||
- **Frequency**: Every 10 seconds while device in range
|
||||
|
||||
### JSON Output Format
|
||||
|
||||
#### WiFi Detection Example
|
||||
```json
|
||||
{
|
||||
"timestamp": 12345,
|
||||
@@ -166,6 +201,33 @@ Detection patterns are derived from actual field data including:
|
||||
}
|
||||
```
|
||||
|
||||
#### Raven BLE Detection Example (NEW)
|
||||
```json
|
||||
{
|
||||
"protocol": "bluetooth_le",
|
||||
"detection_method": "raven_service_uuid",
|
||||
"device_type": "RAVEN_GUNSHOT_DETECTOR",
|
||||
"manufacturer": "SoundThinking/ShotSpotter",
|
||||
"mac_address": "12:34:56:78:9a:bc",
|
||||
"rssi": -72,
|
||||
"signal_strength": "MEDIUM",
|
||||
"device_name": "Raven-Device-001",
|
||||
"raven_service_uuid": "00003100-0000-1000-8000-00805f9b34fb",
|
||||
"raven_service_description": "GPS Location Service (Lat/Lon/Alt)",
|
||||
"raven_firmware_version": "1.3.x (Latest)",
|
||||
"threat_level": "CRITICAL",
|
||||
"threat_score": 100,
|
||||
"service_uuids": [
|
||||
"0000180a-0000-1000-8000-00805f9b34fb",
|
||||
"00003100-0000-1000-8000-00805f9b34fb",
|
||||
"00003200-0000-1000-8000-00805f9b34fb",
|
||||
"00003300-0000-1000-8000-00805f9b34fb",
|
||||
"00003400-0000-1000-8000-00805f9b34fb",
|
||||
"00003500-0000-1000-8000-00805f9b34fb"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Startup Sequence
|
||||
@@ -207,6 +269,16 @@ Detection patterns are derived from actual field data including:
|
||||
- `Penguin*` - Penguin BLE identifiers
|
||||
- `Pigvision*` - Pigvision BLE devices
|
||||
|
||||
### Raven Service UUIDs (NEW)
|
||||
- `0000180a-0000-1000-8000-00805f9b34fb` - Device Information Service
|
||||
- `00003100-0000-1000-8000-00805f9b34fb` - GPS Location Service
|
||||
- `00003200-0000-1000-8000-00805f9b34fb` - Power Management Service
|
||||
- `00003300-0000-1000-8000-00805f9b34fb` - Network Status Service
|
||||
- `00003400-0000-1000-8000-00805f9b34fb` - Upload Statistics Service
|
||||
- `00003500-0000-1000-8000-00805f9b34fb` - Error/Failure Service
|
||||
- `00001809-0000-1000-8000-00805f9b34fb` - Health Service (Legacy 1.1.x)
|
||||
- `00001819-0000-1000-8000-00805f9b34fb` - Location Service (Legacy 1.1.x)
|
||||
|
||||
## Limitations
|
||||
|
||||
### Technical Constraints
|
||||
@@ -261,6 +333,8 @@ This project is based on extensive research and public datasets from the surveil
|
||||
- **[GainSec](https://github.com/GainSec)** - OSINT and privacy research
|
||||
- Specialized in surveillance technology analysis and detection methodologies
|
||||
- **Research referenced**: Some methodologies are based on their published research on surveillance technology
|
||||
- **Raven UUID Dataset Provider**: Contributed the `raven_configurations.json` dataset containing verified BLE service UUIDs from SoundThinking/ShotSpotter Raven devices across firmware versions 1.1.7, 1.2.0, and 1.3.1
|
||||
- Enables precise detection of Raven acoustic gunshot detection devices through BLE service UUID fingerprinting
|
||||
|
||||
### Methodology Integration
|
||||
Flock You unifies multiple known detection methodologies into a comprehensive scanner/wardriver specifically designed for Flock Safety cameras and similar surveillance devices. The system combines:
|
||||
@@ -268,10 +342,18 @@ Flock You unifies multiple known detection methodologies into a comprehensive sc
|
||||
- **WiFi Promiscuous Monitoring**: Based on DeFlock's network analysis techniques
|
||||
- **BLE Device Detection**: Leveraging GainSec's Bluetooth surveillance research
|
||||
- **MAC Address Filtering**: Using crowdsourced device databases from deflock.me
|
||||
- **BLE Service UUID Fingerprinting**: Identifying Raven devices through advertised service characteristics
|
||||
- **Firmware Version Detection**: Analyzing service combinations to determine device capabilities
|
||||
- **Pattern Recognition**: Implementing research-based detection algorithms
|
||||
|
||||
### Acknowledgments
|
||||
Special thanks to the researchers and contributors who have made this work possible through their open-source contributions and public datasets. This project builds upon their foundational work in surveillance detection and privacy protection.
|
||||
Special thanks to the researchers and contributors who have made this work possible through their open-source contributions and public datasets:
|
||||
|
||||
- **GainSec** for providing the comprehensive Raven BLE service UUID dataset, enabling detection of SoundThinking/ShotSpotter acoustic surveillance devices
|
||||
- **DeFlock** for crowdsourced surveillance camera location data and detection methodologies
|
||||
- The broader surveillance detection community for their continued research and privacy protection efforts
|
||||
|
||||
This project builds upon their foundational work in surveillance detection and privacy protection.
|
||||
|
||||
## Support and Updates
|
||||
|
||||
|
||||
+1
-1
@@ -1299,7 +1299,7 @@ if __name__ == '__main__':
|
||||
print("Press Ctrl+C to stop the server")
|
||||
|
||||
try:
|
||||
socketio.run(app, debug=False, host='0.0.0.0', port=5000)
|
||||
socketio.run(app, debug=False, host='0.0.0.0', port=5000, allow_unsafe_werkzeug=True)
|
||||
except KeyboardInterrupt:
|
||||
print("\nShutting down server...")
|
||||
# Clean up connections
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Flask==2.2.5
|
||||
Flask-SocketIO==5.3.6
|
||||
python-socketio==5.8.0
|
||||
python-engineio==4.7.1
|
||||
Flask>=3.0.0
|
||||
Flask-SocketIO>=5.3.6
|
||||
python-socketio>=5.11.0
|
||||
python-engineio>=4.9.0
|
||||
pyserial==3.5
|
||||
Werkzeug==2.2.3
|
||||
Werkzeug>=3.0.0
|
||||
requests==2.31.0
|
||||
|
||||
@@ -0,0 +1,443 @@
|
||||
[
|
||||
{
|
||||
"firmwareVersion": "1.1.7",
|
||||
"characteristics": [
|
||||
{
|
||||
"name": "Serial Number",
|
||||
"serviceUuid": "0000180a-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00002a25-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Model Number",
|
||||
"serviceUuid": "0000180a-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00002a24-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Firmware Version",
|
||||
"serviceUuid": "0000180a-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00002a26-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "HTTP Status Code",
|
||||
"serviceUuid": "0000180a-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "0002AB8-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Reconnect Address",
|
||||
"serviceUuid": "0000180a-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00002a03-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Temperature",
|
||||
"serviceUuid": "00001809-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00002A6E-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Sensor Location",
|
||||
"serviceUuid": "00001809-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00002A5D-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Battery Level",
|
||||
"serviceUuid": "00001809-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00002A19-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "TX Power Level",
|
||||
"serviceUuid": "00001809-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00002A07-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Latitude",
|
||||
"serviceUuid": "00001819-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00002AAE-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Longitude",
|
||||
"serviceUuid": "00001819-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00002AAF-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Altitude",
|
||||
"serviceUuid": "00001819-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00002AB3-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"firmwareVersion": "1.2.0",
|
||||
"characteristics": [
|
||||
{
|
||||
"name": "Part Number",
|
||||
"serviceUuid": "0000180a-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003001-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Serial Number",
|
||||
"serviceUuid": "0000180a-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003002-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Firmware Version",
|
||||
"serviceUuid": "0000180a-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00002a26-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "MAC Address",
|
||||
"serviceUuid": "0000180a-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003004-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "GPS Latitude",
|
||||
"serviceUuid": "00003100-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003101-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "GPS Longitude",
|
||||
"serviceUuid": "00003100-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003102-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "GPS Altitude",
|
||||
"serviceUuid": "00003100-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003103-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Board Temperature",
|
||||
"serviceUuid": "00003200-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003201-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Battery Voltage",
|
||||
"serviceUuid": "00003200-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003202-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Charge/Discharge Current",
|
||||
"serviceUuid": "00003200-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003203-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "10 W Solar Voltage",
|
||||
"serviceUuid": "00003200-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003204-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Last Connected",
|
||||
"serviceUuid": "00003300-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003301-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "LTE Network Type",
|
||||
"serviceUuid": "00003300-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003302-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "LTE Operator",
|
||||
"serviceUuid": "00003300-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003303-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "LTE RSSI",
|
||||
"serviceUuid": "00003300-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003304-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "LTE RSRQ",
|
||||
"serviceUuid": "00003300-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003305-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "LTE RSRP",
|
||||
"serviceUuid": "00003300-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003306-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "LTE SINR",
|
||||
"serviceUuid": "00003300-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003307-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Last Connected WiFi SSID",
|
||||
"serviceUuid": "00003300-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003308-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "WiFi RSSI",
|
||||
"serviceUuid": "00003300-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003309-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Network Connection Status",
|
||||
"serviceUuid": "00003300-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "0000330A-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Average Upload Time",
|
||||
"serviceUuid": "00003400-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003401-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Most Recent Upload Time",
|
||||
"serviceUuid": "00003400-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003402-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Number of Audio Uploads Since Boot",
|
||||
"serviceUuid": "00003400-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003403-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Identity Check Failures",
|
||||
"serviceUuid": "00003500-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003501-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Status Update Failures",
|
||||
"serviceUuid": "00003500-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003502-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Heartbeat Failures",
|
||||
"serviceUuid": "00003500-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003503-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "OTA Update Failures",
|
||||
"serviceUuid": "00003500-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003504-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Audio Upload Failures",
|
||||
"serviceUuid": "00003500-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003505-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"firmwareVersion": "1.3.1",
|
||||
"characteristics": [
|
||||
{
|
||||
"name": "Part Number",
|
||||
"serviceUuid": "0000180a-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003001-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Serial Number",
|
||||
"serviceUuid": "0000180a-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003002-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Firmware Version",
|
||||
"serviceUuid": "0000180a-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00002a26-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "MAC Address",
|
||||
"serviceUuid": "0000180a-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003004-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "GPS Latitude",
|
||||
"serviceUuid": "00003100-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003101-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "GPS Longitude",
|
||||
"serviceUuid": "00003100-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003102-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "GPS Altitude",
|
||||
"serviceUuid": "00003100-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003103-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Board Temperature",
|
||||
"serviceUuid": "00003200-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003201-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Battery Voltage",
|
||||
"serviceUuid": "00003200-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003202-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Charge/Discharge Current",
|
||||
"serviceUuid": "00003200-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003203-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "10 W Solar Voltage",
|
||||
"serviceUuid": "00003200-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003204-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Battery State",
|
||||
"serviceUuid": "00003200-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003205-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Last Connected",
|
||||
"serviceUuid": "00003300-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003301-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "LTE Network Type",
|
||||
"serviceUuid": "00003300-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003302-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "LTE Operator",
|
||||
"serviceUuid": "00003300-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003303-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "LTE RSSI",
|
||||
"serviceUuid": "00003300-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003304-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "LTE RSRQ",
|
||||
"serviceUuid": "00003300-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003305-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "LTE RSRP",
|
||||
"serviceUuid": "00003300-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003306-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "LTE SINR",
|
||||
"serviceUuid": "00003300-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003307-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Last Connected WiFi SSID",
|
||||
"serviceUuid": "00003300-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003308-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "WiFi RSSI",
|
||||
"serviceUuid": "00003300-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003309-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Network Connection Status",
|
||||
"serviceUuid": "00003300-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "0000330A-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Average Upload Time",
|
||||
"serviceUuid": "00003400-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003401-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Most Recent Upload Time",
|
||||
"serviceUuid": "00003400-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003402-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Number of Audio Uploads Since Boot",
|
||||
"serviceUuid": "00003400-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003403-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Identity Check Failures",
|
||||
"serviceUuid": "00003500-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003501-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Status Update Failures",
|
||||
"serviceUuid": "00003500-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003502-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Heartbeat Failures",
|
||||
"serviceUuid": "00003500-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003503-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "OTA Update Failures",
|
||||
"serviceUuid": "00003500-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003504-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "Audio Upload Failures",
|
||||
"serviceUuid": "00003500-0000-1000-8000-00805f9b34fb",
|
||||
"characteristicUuid": "00003505-0000-1000-8000-00805f9b34fb",
|
||||
"dataType": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
+187
@@ -81,6 +81,48 @@ static const char* device_name_patterns[] = {
|
||||
"Pigvision" // Pigvision surveillance systems
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// RAVEN SURVEILLANCE DEVICE UUID PATTERNS
|
||||
// ============================================================================
|
||||
// These UUIDs are specific to Raven surveillance devices (acoustic gunshot detection)
|
||||
// Source: raven_configurations.json - firmware versions 1.1.7, 1.2.0, 1.3.1
|
||||
|
||||
// Raven Device Information Service (used across all firmware versions)
|
||||
#define RAVEN_DEVICE_INFO_SERVICE "0000180a-0000-1000-8000-00805f9b34fb"
|
||||
|
||||
// Raven GPS Location Service (firmware 1.2.0+)
|
||||
#define RAVEN_GPS_SERVICE "00003100-0000-1000-8000-00805f9b34fb"
|
||||
|
||||
// Raven Power/Battery Service (firmware 1.2.0+)
|
||||
#define RAVEN_POWER_SERVICE "00003200-0000-1000-8000-00805f9b34fb"
|
||||
|
||||
// Raven Network Status Service (firmware 1.2.0+)
|
||||
#define RAVEN_NETWORK_SERVICE "00003300-0000-1000-8000-00805f9b34fb"
|
||||
|
||||
// Raven Upload Statistics Service (firmware 1.2.0+)
|
||||
#define RAVEN_UPLOAD_SERVICE "00003400-0000-1000-8000-00805f9b34fb"
|
||||
|
||||
// Raven Error/Failure Service (firmware 1.2.0+)
|
||||
#define RAVEN_ERROR_SERVICE "00003500-0000-1000-8000-00805f9b34fb"
|
||||
|
||||
// Health Thermometer Service (firmware 1.1.7)
|
||||
#define RAVEN_OLD_HEALTH_SERVICE "00001809-0000-1000-8000-00805f9b34fb"
|
||||
|
||||
// Location and Navigation Service (firmware 1.1.7)
|
||||
#define RAVEN_OLD_LOCATION_SERVICE "00001819-0000-1000-8000-00805f9b34fb"
|
||||
|
||||
// Known Raven service UUIDs for detection
|
||||
static const char* raven_service_uuids[] = {
|
||||
RAVEN_DEVICE_INFO_SERVICE, // Device info (all versions)
|
||||
RAVEN_GPS_SERVICE, // GPS data (1.2.0+)
|
||||
RAVEN_POWER_SERVICE, // Battery/Solar (1.2.0+)
|
||||
RAVEN_NETWORK_SERVICE, // LTE/WiFi status (1.2.0+)
|
||||
RAVEN_UPLOAD_SERVICE, // Upload stats (1.2.0+)
|
||||
RAVEN_ERROR_SERVICE, // Error tracking (1.2.0+)
|
||||
RAVEN_OLD_HEALTH_SERVICE, // Old health service (1.1.7)
|
||||
RAVEN_OLD_LOCATION_SERVICE // Old location service (1.1.7)
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// GLOBAL VARIABLES
|
||||
// ============================================================================
|
||||
@@ -338,6 +380,100 @@ bool check_device_name_pattern(const char* name)
|
||||
return false;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// RAVEN UUID DETECTION
|
||||
// ============================================================================
|
||||
|
||||
// Check if a BLE device advertises any Raven surveillance service UUIDs
|
||||
bool check_raven_service_uuid(NimBLEAdvertisedDevice* device, char* detected_service_out = nullptr)
|
||||
{
|
||||
if (!device) return false;
|
||||
|
||||
// Check if device has service UUIDs
|
||||
if (!device->haveServiceUUID()) return false;
|
||||
|
||||
// Get the number of service UUIDs
|
||||
int serviceCount = device->getServiceUUIDCount();
|
||||
if (serviceCount == 0) return false;
|
||||
|
||||
// Check each advertised service UUID against known Raven UUIDs
|
||||
for (int i = 0; i < serviceCount; i++) {
|
||||
NimBLEUUID serviceUUID = device->getServiceUUID(i);
|
||||
std::string uuidStr = serviceUUID.toString();
|
||||
|
||||
// Compare against each known Raven service UUID
|
||||
for (int j = 0; j < sizeof(raven_service_uuids)/sizeof(raven_service_uuids[0]); j++) {
|
||||
if (strcasecmp(uuidStr.c_str(), raven_service_uuids[j]) == 0) {
|
||||
// Match found! Store the detected service UUID if requested
|
||||
if (detected_service_out != nullptr) {
|
||||
strncpy(detected_service_out, uuidStr.c_str(), 40);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get a human-readable description of the Raven service
|
||||
const char* get_raven_service_description(const char* uuid)
|
||||
{
|
||||
if (!uuid) return "Unknown Service";
|
||||
|
||||
if (strcasecmp(uuid, RAVEN_DEVICE_INFO_SERVICE) == 0)
|
||||
return "Device Information (Serial, Model, Firmware)";
|
||||
if (strcasecmp(uuid, RAVEN_GPS_SERVICE) == 0)
|
||||
return "GPS Location Service (Lat/Lon/Alt)";
|
||||
if (strcasecmp(uuid, RAVEN_POWER_SERVICE) == 0)
|
||||
return "Power Management (Battery/Solar)";
|
||||
if (strcasecmp(uuid, RAVEN_NETWORK_SERVICE) == 0)
|
||||
return "Network Status (LTE/WiFi)";
|
||||
if (strcasecmp(uuid, RAVEN_UPLOAD_SERVICE) == 0)
|
||||
return "Upload Statistics Service";
|
||||
if (strcasecmp(uuid, RAVEN_ERROR_SERVICE) == 0)
|
||||
return "Error/Failure Tracking Service";
|
||||
if (strcasecmp(uuid, RAVEN_OLD_HEALTH_SERVICE) == 0)
|
||||
return "Health/Temperature Service (Legacy)";
|
||||
if (strcasecmp(uuid, RAVEN_OLD_LOCATION_SERVICE) == 0)
|
||||
return "Location Service (Legacy)";
|
||||
|
||||
return "Unknown Raven Service";
|
||||
}
|
||||
|
||||
// Estimate firmware version based on detected service UUIDs
|
||||
const char* estimate_raven_firmware_version(NimBLEAdvertisedDevice* device)
|
||||
{
|
||||
if (!device || !device->haveServiceUUID()) return "Unknown";
|
||||
|
||||
bool has_new_gps = false;
|
||||
bool has_old_location = false;
|
||||
bool has_power_service = false;
|
||||
|
||||
int serviceCount = device->getServiceUUIDCount();
|
||||
for (int i = 0; i < serviceCount; i++) {
|
||||
NimBLEUUID serviceUUID = device->getServiceUUID(i);
|
||||
std::string uuidStr = serviceUUID.toString();
|
||||
|
||||
if (strcasecmp(uuidStr.c_str(), RAVEN_GPS_SERVICE) == 0)
|
||||
has_new_gps = true;
|
||||
if (strcasecmp(uuidStr.c_str(), RAVEN_OLD_LOCATION_SERVICE) == 0)
|
||||
has_old_location = true;
|
||||
if (strcasecmp(uuidStr.c_str(), RAVEN_POWER_SERVICE) == 0)
|
||||
has_power_service = true;
|
||||
}
|
||||
|
||||
// Firmware version heuristics based on service presence
|
||||
if (has_old_location && !has_new_gps)
|
||||
return "1.1.x (Legacy)";
|
||||
if (has_new_gps && !has_power_service)
|
||||
return "1.2.x";
|
||||
if (has_new_gps && has_power_service)
|
||||
return "1.3.x (Latest)";
|
||||
|
||||
return "Unknown Version";
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// WIFI PROMISCUOUS MODE HANDLER
|
||||
// ============================================================================
|
||||
@@ -457,6 +593,57 @@ class AdvertisedDeviceCallbacks: public NimBLEAdvertisedDeviceCallbacks {
|
||||
last_detection_time = millis();
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for Raven surveillance device service UUIDs
|
||||
char detected_service_uuid[41] = {0};
|
||||
if (check_raven_service_uuid(advertisedDevice, detected_service_uuid)) {
|
||||
// Raven device detected! Get firmware version estimate
|
||||
const char* fw_version = estimate_raven_firmware_version(advertisedDevice);
|
||||
const char* service_desc = get_raven_service_description(detected_service_uuid);
|
||||
|
||||
// Create enhanced JSON output with Raven-specific data
|
||||
StaticJsonDocument<1024> doc;
|
||||
doc["protocol"] = "bluetooth_le";
|
||||
doc["detection_method"] = "raven_service_uuid";
|
||||
doc["device_type"] = "RAVEN_GUNSHOT_DETECTOR";
|
||||
doc["manufacturer"] = "SoundThinking/ShotSpotter";
|
||||
doc["mac_address"] = addrStr.c_str();
|
||||
doc["rssi"] = rssi;
|
||||
doc["signal_strength"] = rssi > -50 ? "STRONG" : (rssi > -70 ? "MEDIUM" : "WEAK");
|
||||
|
||||
if (!name.empty()) {
|
||||
doc["device_name"] = name.c_str();
|
||||
}
|
||||
|
||||
// Raven-specific information
|
||||
doc["raven_service_uuid"] = detected_service_uuid;
|
||||
doc["raven_service_description"] = service_desc;
|
||||
doc["raven_firmware_version"] = fw_version;
|
||||
doc["threat_level"] = "CRITICAL";
|
||||
doc["threat_score"] = 100;
|
||||
|
||||
// List all detected service UUIDs
|
||||
if (advertisedDevice->haveServiceUUID()) {
|
||||
JsonArray services = doc.createNestedArray("service_uuids");
|
||||
int serviceCount = advertisedDevice->getServiceUUIDCount();
|
||||
for (int i = 0; i < serviceCount; i++) {
|
||||
NimBLEUUID serviceUUID = advertisedDevice->getServiceUUID(i);
|
||||
services.add(serviceUUID.toString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
// Output the detection
|
||||
serializeJson(doc, Serial);
|
||||
Serial.println();
|
||||
|
||||
if (!triggered) {
|
||||
triggered = true;
|
||||
flock_detected_beep_sequence();
|
||||
}
|
||||
// Always update detection time for heartbeat tracking
|
||||
last_detection_time = millis();
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user