Module: PWN::SDR::Decoder::GSM
- Defined in:
- lib/pwn/sdr/decoder/gsm.rb
Overview
GSM (2G) true-air BCCH/CCCH activity decoder.
Defined Under Namespace
Classes: DemodIQ
Constant Summary collapse
- TSHARK_FIELDS =
%w[ frame.time gsmtap.arfcn gsmtap.chan_type gsm_a.imsi gsm_a.tmsi e212.mcc e212.mnc gsm_a.lac gsm_a.bssmap.cell_ci gsm_a.dtap.msg_rr_type ].freeze
Class Method Summary collapse
-
.authors ⇒ Object
- Author(s)
0day Inc.
-
.decode(opts = {}) ⇒ Object
- Supported Method Parameters
PWN::SDR::Decoder::GSM.decode( freq_obj: 'required - freq_obj returned from PWN::SDR::GQRX.init_freq' ).
- .help ⇒ Object
- .parse_line(opts = {}) ⇒ Object
Class Method Details
.authors ⇒ Object
- Author(s)
0day Inc. support@0dayinc.com
125 126 127 |
# File 'lib/pwn/sdr/decoder/gsm.rb', line 125 public_class_method def self. "AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n" end |
.decode(opts = {}) ⇒ Object
- Supported Method Parameters
PWN::SDR::Decoder::GSM.decode( freq_obj: 'required - freq_obj returned from PWN::SDR::GQRX.init_freq' )
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/pwn/sdr/decoder/gsm.rb', line 72 public_class_method def self.decode(opts = {}) freq_obj = opts[:freq_obj] rate = (opts[:sample_rate] || freq_obj[:iq_rate] || 1_000_000).to_i proto = 'GSM' extra = {} describe = proc { |b| { modulation: 'GMSK', symbol_rate: 270_833, tdma_frames: (b[:duration_ms] / 4.615).round, classification: (b[:duration_ms] / 4.615) > 10 ? 'BCCH/CCCH-continuous' : 'RACH/paging-burst' } } demod = DemodIQ.new( rate: rate, protocol: proto, modulation: 'GMSK', extra: { threshold: 5.0 }.merge(extra) ) PWN::SDR::Decoder::Base.run_iq( freq_obj: freq_obj, protocol: proto, sample_rate: rate, source: opts[:source], file: opts[:file], demod: demod, threshold: 5.0, note: '270.833 kbit/s GMSK — true-air path streams I/Q from RTL-SDR/Pluto and characterises TDMA burst duty; full Viterbi/BCCH SI decode is layered on Liquid when available.', describe: describe ) end |
.help ⇒ Object
129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/pwn/sdr/decoder/gsm.rb', line 129 public_class_method def self.help puts "USAGE (true-air I/Q via PWN::FFI + detector fallback): #{self}.decode( freq_obj: 'required - freq_obj returned from PWN::SDR::GQRX.init_freq', source: 'optional - :auto|:rtlsdr|:adalm_pluto|:file', file: 'optional - .cu8/.cs16 capture' ) #{self}.authors " end |
.parse_line(opts = {}) ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/pwn/sdr/decoder/gsm.rb', line 100 public_class_method def self.parse_line(opts = {}) line = opts[:line].to_s f = line.split('|', -1) out = { protocol: 'GSM', frame_time: f[0], arfcn: f[1], chan_type: f[2], imsi: f[3], tmsi: f[4], mcc: f[5], mnc: f[6], lac: f[7], cell_id: f[8], rr_msg_type: f[9] }.reject { |_, v| v.to_s.empty? } if out[:imsi].to_s.length.between?(14, 16) out[:imsi_mcc] = out[:imsi][0, 3] out[:imsi_mnc] = out[:imsi][3, 3] out[:imsi_msin] = out[:imsi][6..] end bits = [] bits << "ARFCN=#{out[:arfcn]}" if out[:arfcn] bits << "MCC/MNC=#{out[:mcc]}/#{out[:mnc]}" if out[:mcc] bits << "LAC=#{out[:lac]} CI=#{out[:cell_id]}" if out[:lac] bits << "IMSI=#{out[:imsi]}" if out[:imsi] bits << "TMSI=#{out[:tmsi]}" if out[:tmsi] out[:summary] = "GSM #{bits.join(' ')}".strip out end |