Module: PWN::SDR::Decoder::Bluetooth
- Defined in:
- lib/pwn/sdr/decoder/bluetooth.rb
Overview
Pure-Ruby Bluetooth Classic (BR/EDR) & BLE activity detector.
1 Mbit/s GFSK with 79 (BR/EDR) or 40 (BLE) FHSS channels — native
mode reports per-channel hop bursts and derives channel index from
freq_obj. parse_line retained for offline text analysis.
Class Method Summary collapse
-
.authors ⇒ Object
- Author(s)
0day Inc.
-
.decode(opts = {}) ⇒ Object
- Supported Method Parameters
PWN::SDR::Decoder::Bluetooth.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::Bluetooth.parse_line(line: 'systime=... LAP=9e8b33 ...').
Class Method Details
.authors ⇒ Object
- Author(s)
0day Inc. support@0dayinc.com
51 52 53 |
# File 'lib/pwn/sdr/decoder/bluetooth.rb', line 51 public_class_method def self. "AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n" end |
.decode(opts = {}) ⇒ Object
- Supported Method Parameters
PWN::SDR::Decoder::Bluetooth.decode( freq_obj: 'required - freq_obj returned from PWN::SDR::GQRX.init_freq' )
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/pwn/sdr/decoder/bluetooth.rb', line 17 public_class_method def self.decode(opts = {}) freq_obj = opts[:freq_obj] hz = PWN::SDR.hz_to_i(freq: freq_obj[:freq]) ble = freq_obj[:ble] || freq_obj[:mode].to_s.casecmp('ble').zero? ch = ble ? ((hz - 2_402_000_000) / 2_000_000).clamp(0, 39) : ((hz - 2_402_000_000) / 1_000_000).clamp(0, 78) PWN::SDR::Decoder::Base.run_detector( freq_obj: freq_obj, protocol: ble ? 'BLE' : 'BT-BR/EDR', note: '1 Mbit/s GFSK FHSS — native mode reports single-channel hop bursts only.', threshold: 9.0, describe: proc { |b| { modulation: 'GFSK', channel: ch, hop_slots: (b[:duration_ms] / 0.625).round, classification: ble && [37, 38, 39].include?(ch) ? 'BLE-advertising' : 'data-hop' } } ) end |
.help ⇒ Object
Display Usage for this Module
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/pwn/sdr/decoder/bluetooth.rb', line 57 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: 'systime=... ch=37 LAP=9e8b33 ...') #{self}.authors " end |
.parse_line(opts = {}) ⇒ Object
- Supported Method Parameters
PWN::SDR::Decoder::Bluetooth.parse_line(line: 'systime=... LAP=9e8b33 ...')
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/pwn/sdr/decoder/bluetooth.rb', line 36 public_class_method def self.parse_line(opts = {}) line = opts[:line].to_s out = { protocol: 'Bluetooth' } out[:lap] = ::Regexp.last_match(1) if line =~ /LAP[=: ]([0-9a-fA-F]{6})/ out[:uap] = ::Regexp.last_match(1) if line =~ /UAP[=: ]([0-9a-fA-F]{2})/ out[:bd_addr] = ::Regexp.last_match(1) if line =~ /(?:AdvA|BD_ADDR)[=: ]([0-9a-fA-F:]{12,17})/ out[:pdu_type] = ::Regexp.last_match(1) if line =~ /\b(ADV_\w+|SCAN_\w+|CONNECT_REQ)\b/ out[:channel] = ::Regexp.last_match(1) if line =~ /ch[=: ]?(\d{1,2})\b/i out[:rssi] = ::Regexp.last_match(1) if line =~ /rssi[=: ]?(-?\d+)/i out[:summary] = "BT #{out.values_at(:pdu_type, :bd_addr, :lap).compact.join(' ')}".strip out.compact end |