Module: PWN::SDR::Decoder::GPS
- Defined in:
- lib/pwn/sdr/decoder/gps.rb
Overview
True-air + detector-fallback decoder for GPS. Prefers PWN::FFI I/Q (RTL-SDR / ADALM-Pluto / HackRF / capture file) via Base.run_iq; degrades to Base.run_detector with no hardware.
Defined Under Namespace
Classes: DemodIQ
Class Method Summary collapse
-
.authors ⇒ Object
- Author(s)
0day Inc.
-
.decode(opts = {}) ⇒ Object
- Supported Method Parameters
PWN::SDR::Decoder::GPS.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
118 119 120 |
# File 'lib/pwn/sdr/decoder/gps.rb', line 118 public_class_method def self. "AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n" end |
.decode(opts = {}) ⇒ Object
- Supported Method Parameters
PWN::SDR::Decoder::GPS.decode( freq_obj: 'required - freq_obj returned from PWN::SDR::GQRX.init_freq' )
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/pwn/sdr/decoder/gps.rb', line 74 public_class_method def self.decode(opts = {}) freq_obj = opts[:freq_obj] rate = (opts[:sample_rate] || freq_obj[:iq_rate] || 2_048_000).to_i proto = 'GPS' demod = DemodIQ.new( rate: rate, protocol: proto, modulation: 'BPSK/DSSS', extra: { threshold: 3.0 } ) PWN::SDR::Decoder::Base.run_iq( freq_obj: freq_obj, protocol: proto, sample_rate: rate, source: opts[:source], file: opts[:file], demod: demod, threshold: 3.0, note: 'BPSK/DSSS 1.023 Mcps — true-air I/Q path reports composite L1 energy; PRN acquisition is layered on FFTW when available.', describe: proc { |_b| { modulation: 'BPSK/DSSS', chip_rate: 1_023_000 } } ) end |
.help ⇒ Object
122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/pwn/sdr/decoder/gps.rb', line 122 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
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/pwn/sdr/decoder/gps.rb', line 96 public_class_method def self.parse_line(opts = {}) line = opts[:line].to_s out = { protocol: 'GPS' } out[:prn] = ::Regexp.last_match(1) if line =~ /PRN[ =]?(\d{1,2})/ out[:cn0] = ::Regexp.last_match(1) if line =~ /CN0[ =]?([\d.]+)/i out[:lat] = ::Regexp.last_match(1) if line =~ /Lat(?:itude)?\s*=\s*(-?[\d.]+)/i out[:lon] = ::Regexp.last_match(1) if line =~ /Long(?:itude)?\s*=\s*(-?[\d.]+)/i out[:alt] = ::Regexp.last_match(1) if line =~ /Height\s*=\s*(-?[\d.]+)/i out[:utc] = ::Regexp.last_match(1) if line =~ /UTC\s*=?\s*([\d:.-]+T?[\d:.]*)/ out[:nmea] = line if line.start_with?('$G') out[:summary] = if out[:lat] "GPS FIX #{out[:lat]},#{out[:lon]} alt=#{out[:alt]}m" elsif out[:prn] "GPS PRN#{out[:prn]} CN0=#{out[:cn0]}" else "GPS #{line[0, 100]}" end out.compact end |