mirror of
https://github.com/smittix/intercept.git
synced 2026-07-08 09:38:12 -07:00
Add scan progress to frontend, fix Europe band defaults
- Forward scanner progress (%) and status to SSE stream - Show progress bar and scan status in TRACKED TOWERS panel - Send scan_complete event with tower count and duration - Fix Europe BAND_CONFIG: only EGSM900 is recommended (GSM850/GSM800 are rarely used in Europe and waste scan time) - DCS1800 available but not recommended (RTL-SDR sensitivity is lower) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+35
-1
@@ -1312,7 +1312,30 @@ def scanner_thread(cmd, device_index):
|
|||||||
break # EOF
|
break # EOF
|
||||||
|
|
||||||
last_output = time.time()
|
last_output = time.time()
|
||||||
logger.info(f"Scanner [{msg_type}]: {line.strip()}")
|
stripped = line.strip()
|
||||||
|
logger.info(f"Scanner [{msg_type}]: {stripped}")
|
||||||
|
|
||||||
|
# Forward progress and status info to frontend
|
||||||
|
progress_match = re.match(r'Scanning:\s+([\d.]+)%\s+done', stripped)
|
||||||
|
if progress_match:
|
||||||
|
try:
|
||||||
|
app_module.gsm_spy_queue.put_nowait({
|
||||||
|
'type': 'progress',
|
||||||
|
'percent': float(progress_match.group(1)),
|
||||||
|
'scan': scan_count
|
||||||
|
})
|
||||||
|
except queue.Full:
|
||||||
|
pass
|
||||||
|
continue
|
||||||
|
if stripped.startswith('Try scan CCCH'):
|
||||||
|
try:
|
||||||
|
app_module.gsm_spy_queue.put_nowait({
|
||||||
|
'type': 'status',
|
||||||
|
'message': stripped,
|
||||||
|
'scan': scan_count
|
||||||
|
})
|
||||||
|
except queue.Full:
|
||||||
|
pass
|
||||||
|
|
||||||
parsed = parse_grgsm_scanner_output(line)
|
parsed = parse_grgsm_scanner_output(line)
|
||||||
if parsed:
|
if parsed:
|
||||||
@@ -1375,6 +1398,17 @@ def scanner_thread(cmd, device_index):
|
|||||||
scan_duration = time.time() - scan_start
|
scan_duration = time.time() - scan_start
|
||||||
logger.info(f"Scan #{scan_count} complete (exit code: {exit_code}, duration: {scan_duration:.1f}s)")
|
logger.info(f"Scan #{scan_count} complete (exit code: {exit_code}, duration: {scan_duration:.1f}s)")
|
||||||
|
|
||||||
|
# Notify frontend scan completed
|
||||||
|
try:
|
||||||
|
app_module.gsm_spy_queue.put_nowait({
|
||||||
|
'type': 'scan_complete',
|
||||||
|
'scan': scan_count,
|
||||||
|
'duration': round(scan_duration, 1),
|
||||||
|
'towers_found': gsm_towers_found
|
||||||
|
})
|
||||||
|
except queue.Full:
|
||||||
|
pass
|
||||||
|
|
||||||
# Detect crash pattern: process exits too quickly with no data
|
# Detect crash pattern: process exits too quickly with no data
|
||||||
if scan_duration < 5 and exit_code != 0:
|
if scan_duration < 5 and exit_code != 0:
|
||||||
crash_count += 1
|
crash_count += 1
|
||||||
|
|||||||
@@ -1240,6 +1240,15 @@
|
|||||||
<span>TRACKED TOWERS</span>
|
<span>TRACKED TOWERS</span>
|
||||||
<div class="panel-indicator"></div>
|
<div class="panel-indicator"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="scanProgress" style="display:none; padding: 8px 12px; border-bottom: 1px solid var(--border-color); font-size: 10px;">
|
||||||
|
<div style="display: flex; justify-content: space-between; margin-bottom: 4px;">
|
||||||
|
<span id="scanStatusText" style="color: var(--accent-cyan); font-family: var(--font-mono);">Scanning...</span>
|
||||||
|
<span id="scanPercentText" style="color: var(--text-secondary);">0%</span>
|
||||||
|
</div>
|
||||||
|
<div style="background: var(--bg-panel); border-radius: 2px; height: 3px; overflow: hidden;">
|
||||||
|
<div id="scanProgressBar" style="background: var(--accent-cyan); height: 100%; width: 0%; transition: width 0.3s;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="tracked-list-content" id="towersList">
|
<div class="tracked-list-content" id="towersList">
|
||||||
<div class="no-data">
|
<div class="no-data">
|
||||||
<div>No towers detected</div>
|
<div>No towers detected</div>
|
||||||
@@ -1344,9 +1353,9 @@
|
|||||||
const BAND_CONFIG = {
|
const BAND_CONFIG = {
|
||||||
'Europe': [
|
'Europe': [
|
||||||
{ name: 'EGSM900', label: 'EGSM900 (925-960 MHz)', freq: '925-960 MHz', common: true, recommended: true },
|
{ name: 'EGSM900', label: 'EGSM900 (925-960 MHz)', freq: '925-960 MHz', common: true, recommended: true },
|
||||||
{ name: 'GSM850', label: 'GSM850 (869-894 MHz)', freq: '869-894 MHz', common: true, recommended: true },
|
{ name: 'DCS1800', label: 'DCS1800 (1805-1880 MHz)', freq: '1805-1880 MHz', common: true, recommended: false },
|
||||||
{ name: 'GSM800', label: 'GSM800 (832-862 MHz)', freq: '832-862 MHz', common: true, recommended: true },
|
{ name: 'GSM850', label: 'GSM850 (869-894 MHz)', freq: '869-894 MHz', common: false, recommended: false },
|
||||||
{ name: 'DCS1800', label: 'DCS1800 (1805-1880 MHz)', freq: '1805-1880 MHz', common: false, recommended: false }
|
{ name: 'GSM800', label: 'GSM800 (832-862 MHz)', freq: '832-862 MHz', common: false, recommended: false }
|
||||||
],
|
],
|
||||||
'Americas': [
|
'Americas': [
|
||||||
{ name: 'GSM850', label: 'GSM850 (869-894 MHz)', freq: '869-894 MHz', common: true, recommended: true },
|
{ name: 'GSM850', label: 'GSM850 (869-894 MHz)', freq: '869-894 MHz', common: true, recommended: true },
|
||||||
@@ -1588,6 +1597,7 @@
|
|||||||
eventSource.close();
|
eventSource.close();
|
||||||
eventSource = null;
|
eventSource = null;
|
||||||
}
|
}
|
||||||
|
document.getElementById('scanProgress').style.display = 'none';
|
||||||
console.log('[GSM SPY] Scanner stopped');
|
console.log('[GSM SPY] Scanner stopped');
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
@@ -1653,8 +1663,16 @@
|
|||||||
addRogueAlert(data);
|
addRogueAlert(data);
|
||||||
} else if (data.type === 'stats') {
|
} else if (data.type === 'stats') {
|
||||||
updateStats(data);
|
updateStats(data);
|
||||||
|
} else if (data.type === 'progress') {
|
||||||
|
updateScanProgress(data.percent, data.scan);
|
||||||
|
} else if (data.type === 'status') {
|
||||||
|
updateScanStatus(data.message);
|
||||||
|
} else if (data.type === 'scan_complete') {
|
||||||
|
updateScanStatus('Scan #' + data.scan + ' complete (' + data.towers_found + ' towers, ' + data.duration + 's)');
|
||||||
|
document.getElementById('scanProgressBar').style.width = '100%';
|
||||||
} else if (data.type === 'error') {
|
} else if (data.type === 'error') {
|
||||||
console.error('[GSM SPY] Server error:', data.message);
|
console.error('[GSM SPY] Server error:', data.message);
|
||||||
|
updateScanStatus('Error: ' + data.message);
|
||||||
} else if (data.type === 'disconnected') {
|
} else if (data.type === 'disconnected') {
|
||||||
console.warn('[GSM SPY] Server disconnected stream');
|
console.warn('[GSM SPY] Server disconnected stream');
|
||||||
}
|
}
|
||||||
@@ -1896,6 +1914,22 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateScanProgress(percent, scanNum) {
|
||||||
|
const progressDiv = document.getElementById('scanProgress');
|
||||||
|
const bar = document.getElementById('scanProgressBar');
|
||||||
|
const text = document.getElementById('scanPercentText');
|
||||||
|
progressDiv.style.display = 'block';
|
||||||
|
bar.style.width = percent + '%';
|
||||||
|
text.textContent = Math.round(percent) + '% (Scan #' + scanNum + ')';
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateScanStatus(message) {
|
||||||
|
const progressDiv = document.getElementById('scanProgress');
|
||||||
|
const statusText = document.getElementById('scanStatusText');
|
||||||
|
progressDiv.style.display = 'block';
|
||||||
|
statusText.textContent = message;
|
||||||
|
}
|
||||||
|
|
||||||
function updateTowersList() {
|
function updateTowersList() {
|
||||||
const listDiv = document.getElementById('towersList');
|
const listDiv = document.getElementById('towersList');
|
||||||
const towerCount = Object.keys(towers).length;
|
const towerCount = Object.keys(towers).length;
|
||||||
|
|||||||
Reference in New Issue
Block a user