Module: PWN::SDR::Decoder::RTL433
- Defined in:
- lib/pwn/sdr/decoder/rtl433.rb
Overview
Pure-Ruby ISM/keyfob/sensor activity detector for the 315 / 390 / 433.92 / 868 / 915 MHz device zoo.
The upstream rtl_433 binary carries ~250 device-specific protocol
dissectors; re-implementing that library is out of scope. This
module instead characterises OOK/ASK/FSK bursts natively (count,
duration, gap, peak dBFS) — enough to fingerprint a keyfob press,
a periodic weather-station beacon, or a TPMS chirp — without
invoking any external binary. parse_line still accepts rtl_433
-F json output for offline analysis.
Class Method Summary collapse
-
.authors ⇒ Object
- Author(s)
0day Inc.
-
.decode(opts = {}) ⇒ Object
- Supported Method Parameters
PWN::SDR::Decoder::RTL433.decode( freq_obj: 'required - freq_obj returned from PWN::SDR::GQRX.init_freq' ).
-
.help ⇒ Object
Display Usage for this Module.
-
.parse_line(opts = {}) ⇒ Object
- Supported Method Parameters
PWN::SDR::Decoder::RTL433.parse_line(line: '"time":"...","model":".."time":"...","model":"..."').
Class Method Details
.authors ⇒ Object
- Author(s)
0day Inc. support@0dayinc.com
66 67 68 |
# File 'lib/pwn/sdr/decoder/rtl433.rb', line 66 public_class_method def self. "AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n" end |
.decode(opts = {}) ⇒ Object
- Supported Method Parameters
PWN::SDR::Decoder::RTL433.decode( freq_obj: 'required - freq_obj returned from PWN::SDR::GQRX.init_freq' )
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/pwn/sdr/decoder/rtl433.rb', line 24 public_class_method def self.decode(opts = {}) freq_obj = opts[:freq_obj] PWN::SDR::Decoder::Base.run_detector( freq_obj: freq_obj, protocol: 'ISM-433', note: 'Native OOK/FSK burst characteriser (no rtl_433 binary). Feed captured `rtl_433 -F json` lines to .parse_line for per-device decode.', threshold: 10.0, describe: proc { |b| kind = if b[:duration_ms] < 20 then 'keyfob/OOK-short' elsif b[:duration_ms] < 120 then 'sensor/OOK-packet' else 'FSK-continuous' end { modulation: 'OOK/ASK/FSK', classification: kind } } ) end |
.help ⇒ Object
Display Usage for this Module
72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/pwn/sdr/decoder/rtl433.rb', line 72 public_class_method def self.help puts "USAGE (ruby-native detector, no external binaries): #{self}.decode( freq_obj: 'required - freq_obj returned from PWN::SDR::GQRX.init_freq' ) #{self}.parse_line(line: '{\"model\":\"Acurite-Tower\",\"id\":1234,...}') #{self}.authors " end |
.parse_line(opts = {}) ⇒ Object
- Supported Method Parameters
PWN::SDR::Decoder::RTL433.parse_line(line: '"time":"...","model":".."time":"...","model":"..."')
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/pwn/sdr/decoder/rtl433.rb', line 44 public_class_method def self.parse_line(opts = {}) line = opts[:line].to_s h = begin JSON.parse(line, symbolize_names: true) rescue StandardError { unparsed: line } end out = { protocol: 'RTL433' }.merge(h) bits = [] bits << out[:model].to_s if out[:model] bits << "id=#{out[:id]}" if out[:id] bits << "ch=#{out[:channel]}" if out[:channel] bits << "code=#{out[:code]}" if out[:code] bits << "cmd=#{out[:cmd] || out[:button]}" if out[:cmd] || out[:button] bits << "temp=#{out[:temperature_C]}C" if out[:temperature_C] bits << "rssi=#{out[:rssi]}" if out[:rssi] out[:summary] = bits.empty? ? line[0, 120] : bits.join(' ') out end |