mirror of
https://github.com/smittix/intercept.git
synced 2026-04-24 06:40:00 -07:00
- Fix XSS: escape ASCII output in innerHTML via escapeHtml() - Fix deadlock: use put_nowait() for queue ops under ook_lock - Fix SSE leak: add ook to moduleDestroyMap so switching modes closes the EventSource - Fix RSSI: explicit null check preserves valid zero values in JSON export - Add frame cap: trim oldest frames at 5000 to prevent unbounded memory growth on busy bands - Validate timing params: wrap int() casts in try/except, return 400 instead of 500 on invalid input - Fix PWM hint: correct to short=0/long=1 matching rtl_433 OOK_PWM convention (UI, JS hints, and cheat sheet) - Fix inversion docstring: clarify fallback only applies when primary hex parse fails, not for valid decoded frames Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
154 lines
8.0 KiB
HTML
154 lines
8.0 KiB
HTML
<!-- OOK SIGNAL DECODER MODE -->
|
|
<div id="ookMode" class="mode-content">
|
|
<div class="section">
|
|
<h3>OOK Signal Decoder</h3>
|
|
<p class="info-text" style="font-size: 11px; color: var(--text-dim); margin-bottom: 12px;">
|
|
Decode raw OOK (On-Off Keying) signals via rtl_433 flex decoder.
|
|
Captures frames with configurable pulse timing and displays raw bits,
|
|
hex, and attempted ASCII — useful for unknown ISM-band protocols.
|
|
</p>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<h3>Frequency</h3>
|
|
<div class="form-group">
|
|
<label>Frequency (MHz)</label>
|
|
<input type="number" id="ookFrequency" value="433.920" step="0.001" min="1" max="1766">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Presets <span style="font-size:9px; color:#555;">(right-click to remove)</span></label>
|
|
<div id="ookPresetButtons" style="display: flex; flex-wrap: wrap; gap: 4px;">
|
|
<!-- Populated by OokMode.renderPresets() -->
|
|
</div>
|
|
<div style="margin-top: 6px; display: flex; gap: 4px;">
|
|
<input type="text" id="ookNewPresetFreq" placeholder="MHz"
|
|
style="width: 80px; background: #111; border: 1px solid #222; border-radius: 3px; color: var(--text-dim); font-family: var(--font-mono); font-size: 11px; padding: 3px 6px;">
|
|
<button class="preset-btn" onclick="OokMode.addPreset()" style="background: #2ecc71; color: #000;">Add</button>
|
|
<button class="preset-btn" onclick="OokMode.resetPresets()" style="font-size: 10px;">Reset</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<h3>SDR Settings</h3>
|
|
<div class="form-group">
|
|
<label>Gain (dB)</label>
|
|
<input type="number" id="ookGain" value="40" step="1" min="0" max="50">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>PPM Correction</label>
|
|
<input type="number" id="ookPPM" value="0" step="1" min="-100" max="100">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<h3>Modulation</h3>
|
|
<div class="form-group">
|
|
<div style="display: flex; gap: 4px;">
|
|
<button class="preset-btn" id="ookEnc_pwm"
|
|
onclick="OokMode.setEncoding('pwm')"
|
|
style="flex: 1; background: var(--accent); color: #000;">PWM</button>
|
|
<button class="preset-btn" id="ookEnc_ppm"
|
|
onclick="OokMode.setEncoding('ppm')"
|
|
style="flex: 1;">PPM</button>
|
|
<button class="preset-btn" id="ookEnc_manchester"
|
|
onclick="OokMode.setEncoding('manchester')"
|
|
style="flex: 1;">Manchester</button>
|
|
</div>
|
|
<input type="hidden" id="ookEncoding" value="pwm">
|
|
<p id="ookEncodingHint" class="info-text" style="font-size: 10px; color: var(--text-dim); margin-top: 4px;">
|
|
Short pulse = 0, long pulse = 1. Most common for ISM OOK.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<h3>Pulse Timing</h3>
|
|
<p class="info-text" style="font-size: 10px; color: var(--text-dim); margin-bottom: 8px;">
|
|
Pulse widths in microseconds for the flex decoder.
|
|
</p>
|
|
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 8px;">
|
|
<div class="form-group">
|
|
<label>Short (μs)</label>
|
|
<input type="number" id="ookShortPulse" value="300" step="10" min="50" max="5000">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Long (μs)</label>
|
|
<input type="number" id="ookLongPulse" value="600" step="10" min="100" max="10000">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Gap/Reset (μs)</label>
|
|
<input type="number" id="ookResetLimit" value="8000" step="100" min="500" max="50000">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Gap limit (μs)</label>
|
|
<input type="number" id="ookGapLimit" value="5000" step="100" min="500" max="50000">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Tolerance (μs)</label>
|
|
<input type="number" id="ookTolerance" value="150" step="10" min="10" max="1000">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Min bits</label>
|
|
<input type="number" id="ookMinBits" value="8" step="1" min="1" max="512">
|
|
</div>
|
|
</div>
|
|
<div class="form-group" style="margin-top: 8px;">
|
|
<label style="font-size: 10px; color: var(--text-dim);">Quick presets (short/long μs)</label>
|
|
<div style="display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px;">
|
|
<button class="preset-btn" onclick="OokMode.setTiming(300,600,8000,5000,150,8)"
|
|
title="Generic ISM default">300/600</button>
|
|
<button class="preset-btn" onclick="OokMode.setTiming(300,900,8000,5000,150,16)"
|
|
title="PWM common variant">300/900</button>
|
|
<button class="preset-btn" onclick="OokMode.setTiming(400,800,8000,5000,150,16)"
|
|
title="Generic 2:1 ratio">400/800</button>
|
|
<button class="preset-btn" onclick="OokMode.setTiming(500,1500,10000,6000,200,16)"
|
|
title="Long-range keyfob">500/1500</button>
|
|
<button class="preset-btn" onclick="OokMode.setTiming(500,1000,8000,5000,150,8)"
|
|
title="Manchester clock period">500 MC</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<h3>Options</h3>
|
|
<div class="form-group">
|
|
<label style="display: flex; align-items: center; gap: 8px; cursor: pointer;">
|
|
<input type="checkbox" id="ookDeduplicate" style="width: auto; margin: 0;">
|
|
<span>Deduplicate frames</span>
|
|
</label>
|
|
<p class="info-text" style="font-size: 10px; color: var(--text-dim); margin-top: 4px;">
|
|
Suppress consecutive frames with identical hex content.
|
|
Useful when a transmitter repeats the same packet multiple times.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Status -->
|
|
<div class="section">
|
|
<div style="display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-dim);">
|
|
<span id="ookStatusIndicator" class="status-dot" style="width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim);"></span>
|
|
<span id="ookStatusText">Standby</span>
|
|
<span style="margin-left: auto;" id="ookFrameCount">0 frames</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<p class="info-text" style="font-size: 11px; color: #ffaa00; line-height: 1.5;">
|
|
Uses rtl_433 with a custom flex decoder. Requires rtl_433 installed.
|
|
Works on any OOK/ASK signal in the SDR's frequency range.
|
|
</p>
|
|
<div id="ookCommandDisplay" style="display: none; margin-top: 8px;">
|
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px;">
|
|
<span style="font-size: 10px; color: #555; text-transform: uppercase; letter-spacing: 1px;">Active Command</span>
|
|
<button class="btn btn-sm btn-ghost" onclick="OokMode.copyCommand()" title="Copy to clipboard"
|
|
style="font-size: 9px; padding: 1px 6px;">Copy</button>
|
|
</div>
|
|
<pre id="ookCommandText" style="margin: 0; padding: 6px 8px; background: #0a0a0a; border: 1px solid #1a2e1a; border-radius: 4px; font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); white-space: pre-wrap; word-break: break-all; line-height: 1.5;"></pre>
|
|
</div>
|
|
</div>
|
|
|
|
<button class="run-btn" id="ookStartBtn" onclick="OokMode.start()">Start Decoder</button>
|
|
<button class="stop-btn" id="ookStopBtn" onclick="OokMode.stop()" style="display: none;">Stop Decoder</button>
|
|
</div>
|