mirror of
https://github.com/smittix/intercept.git
synced 2026-06-29 21:52:08 -07:00
Add root privilege check and warning display
- Add startup check in app.py for root/sudo privileges - Show warning in terminal if not running as root - Add running_as_root flag to TSCM devices API response - Display privilege warning in TSCM UI when not running as root - Show command to run with sudo in the warning - Add CSS styling for privilege warning banner Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+19
-1
@@ -596,7 +596,25 @@ def get_tscm_devices():
|
||||
except Exception as e:
|
||||
logger.warning(f"Error detecting SDR devices: {e}")
|
||||
|
||||
return jsonify({'status': 'success', 'devices': devices})
|
||||
# Check if running as root
|
||||
import os
|
||||
from flask import current_app
|
||||
running_as_root = current_app.config.get('RUNNING_AS_ROOT', os.geteuid() == 0)
|
||||
|
||||
warnings = []
|
||||
if not running_as_root:
|
||||
warnings.append({
|
||||
'type': 'privileges',
|
||||
'message': 'Not running as root. WiFi monitor mode and some Bluetooth features require sudo.',
|
||||
'action': 'Run with: sudo -E venv/bin/python intercept.py'
|
||||
})
|
||||
|
||||
return jsonify({
|
||||
'status': 'success',
|
||||
'devices': devices,
|
||||
'running_as_root': running_as_root,
|
||||
'warnings': warnings
|
||||
})
|
||||
|
||||
|
||||
def _scan_wifi_networks(interface: str) -> list[dict]:
|
||||
|
||||
Reference in New Issue
Block a user