Module: PWN::SDR::Decoder::Bluetooth
- Defined in:
- lib/pwn/sdr/decoder/bluetooth.rb
Overview
Bluetooth Classic (BR/EDR) & BLE advertising decoder for 2.402–2.480 GHz.
1 Mbit/s GFSK with 79 (BR/EDR) or 40 (BLE) FHSS channels cannot be
recovered from GQRX audio. This module drives an Ubertooth One via
ubertooth-rx (LAP/UAP discovery) or ubertooth-btle -f -p (BLE
advertising follow) directly and structures each output line.
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
55 56 57 |
# File 'lib/pwn/sdr/decoder/bluetooth.rb', line 55 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' )
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/pwn/sdr/decoder/bluetooth.rb', line 20 public_class_method def self.decode(opts = {}) freq_obj = opts[:freq_obj] raise 'ERROR: :freq_obj is required' unless freq_obj.is_a?(Hash) ble = freq_obj[:ble] || freq_obj[:mode].to_s.casecmp('ble').zero? direct_cmd = ble ? 'ubertooth-btle -f -p' : 'ubertooth-rx -z' PWN::SDR::Decoder::Base.run_pipeline( freq_obj: freq_obj, protocol: ble ? 'BLE' : 'BT-BR/EDR', required_bins: [ble ? 'ubertooth-btle' : 'ubertooth-rx'], direct_cmd: direct_cmd, line_match: /(LAP|AdvA|ADV_|SCAN_|BD_ADDR|systime)/i, parser: proc { |line| parse_line(line: line) } ) end |
.help ⇒ Object
Display Usage for this Module
61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/pwn/sdr/decoder/bluetooth.rb', line 61 public_class_method def self.help puts "USAGE: #{self}.decode( freq_obj: 'required - freq_obj returned from PWN::SDR::GQRX.init_freq' ) NOTE: Requires an Ubertooth One and `ubertooth-rx` / `ubertooth-btle`. Set freq_obj[:ble] = true for BLE mode. #{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 ...')
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/pwn/sdr/decoder/bluetooth.rb', line 40 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 |