pwn 0.5.506 → 0.5.507

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,757 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'open3'
4
-
5
- module PWN
6
- module Plugins
7
- # This plugin interacts with the remote control interface of GQRX.
8
- module GQRX
9
- # Supported Method Parameters::
10
- # gqrx_sock = PWN::Plugins::GQRX.connect(
11
- # target: 'optional - GQRX target IP address (defaults to 127.0.0.1)',
12
- # port: 'optional - GQRX target port (defaults to 7356)'
13
- # )
14
- public_class_method def self.connect(opts = {})
15
- target = opts[:target] ||= '127.0.0.1'
16
- port = opts[:port] ||= 7356
17
-
18
- PWN::Plugins::Sock.connect(target: target, port: port)
19
- rescue StandardError => e
20
- raise e
21
- end
22
-
23
- # Supported Method Parameters::
24
- # gqrx_resp = PWN::Plugins::GQRX.gqrx_cmd(
25
- # gqrx_sock: 'required - GQRX socket object returned from #connect method',
26
- # cmd: 'required - GQRX command to execute',
27
- # resp_ok: 'optional - Expected response from GQRX to indicate success'
28
- # )
29
-
30
- public_class_method def self.gqrx_cmd(opts = {})
31
- gqrx_sock = opts[:gqrx_sock]
32
- cmd = opts[:cmd]
33
- resp_ok = opts[:resp_ok]
34
-
35
- # Most Recent GQRX Command Set:
36
- # https://raw.githubusercontent.com/gqrx-sdr/gqrx/master/resources/remote-control.txt
37
- # Supported commands:
38
- # f Get frequency [Hz]
39
- # F <frequency> Set frequency [Hz]
40
- # m Get demodulator mode and passband
41
- # M <mode> [passband]
42
- # Set demodulator mode and passband [Hz]
43
- # Passing a '?' as the first argument instead of 'mode' will return
44
- # a space separated list of radio backend supported modes.
45
- # l|L ?
46
- # Get a space separated list of settings available for reading (l) or writing (L).
47
- # l STRENGTH
48
- # Get signal strength [dBFS]
49
- # l SQL
50
- # Get squelch threshold [dBFS]
51
- # L SQL <sql>
52
- # Set squelch threshold to <sql> [dBFS]
53
- # l AF
54
- # Get audio gain [dB]
55
- # L AF <gain>
56
- # Set audio gain to <gain> [dB]
57
- # l <gain_name>_GAIN
58
- # Get the value of the gain setting with the name <gain_name>
59
- # L <gain_name>_GAIN <value>
60
- # Set the value of the gain setting with the name <gain_name> to <value>
61
- # p RDS_PI
62
- # Get the RDS PI code (in hexadecimal). Returns 0000 if not applicable.
63
- # u RECORD
64
- # Get status of audio recorder
65
- # U RECORD <status>
66
- # Set status of audio recorder to <status>
67
- # u DSP
68
- # Get DSP (SDR receiver) status
69
- # U DSP <status>
70
- # Set DSP (SDR receiver) status to <status>
71
- # u RDS
72
- # Get RDS decoder to <status>. Only functions in WFM mode.
73
- # U RDS <status>
74
- # Set RDS decoder to <status>. Only functions in WFM mode.
75
- # q|Q
76
- # Close connection
77
- # AOS
78
- # Acquisition of signal (AOS) event, start audio recording
79
- # LOS
80
- # Loss of signal (LOS) event, stop audio recording
81
- # LNB_LO [frequency]
82
- # If frequency [Hz] is specified set the LNB LO frequency used for
83
- # display. Otherwise print the current LNB LO frequency [Hz].
84
- # \chk_vfo
85
- # Get VFO option status (only usable for hamlib compatibility)
86
- # \dump_state
87
- # Dump state (only usable for hamlib compatibility)
88
- # \get_powerstat
89
- # Get power status (only usable for hamlib compatibility)
90
- # v
91
- # Get 'VFO' (only usable for hamlib compatibility)
92
- # V
93
- # Set 'VFO' (only usable for hamlib compatibility)
94
- # s
95
- # Get 'Split' mode (only usable for hamlib compatibility)
96
- # S
97
- # Set 'Split' mode (only usable for hamlib compatibility)
98
- # _
99
- # Get version
100
- #
101
- # Reply:
102
- # RPRT 0
103
- # Command successful
104
- # RPRT 1
105
- # Command failed
106
-
107
- gqrx_sock.write("#{cmd}\n")
108
- response = []
109
- got_freq = false
110
- # Read all responses from gqrx_sock.write
111
- timeout = 0.001 if timeout.nil?
112
-
113
- begin
114
- response.push(gqrx_sock.readline.chomp) while gqrx_sock.wait_readable(timeout)
115
- raise IOError if response.empty?
116
- rescue IOError
117
- timeout += 0.001
118
- retry
119
- end
120
-
121
- got_int_value_in_resp = true if response.first.to_i.positive?
122
- response = response.first if response.length == 1
123
-
124
- raise "ERROR!!! Command: #{cmd} Expected Resp: #{resp_ok}, Got: #{response}" if resp_ok && response != resp_ok
125
-
126
- if got_int_value_in_resp
127
- fixed_len_freq = format('%0.12d', response.to_i)
128
- freq_segments = fixed_len_freq.scan(/.{3}/)
129
- first_non_zero_index = freq_segments.index { |s| s.to_i.positive? }
130
- freq_segments = freq_segments[first_non_zero_index..-1]
131
- freq_segments[0] = freq_segments.first.to_i.to_s
132
- response = freq_segments.join('.')
133
- end
134
-
135
- # DEBUG
136
- # puts response.inspect
137
- # puts response.length
138
-
139
- response
140
- rescue RuntimeError => e
141
- puts 'WARNING: RF Gain is not supported by the radio backend.' if e.message.include?('Command: L RF_GAIN')
142
- puts 'WARNING: Intermediate Gain is not supported by the radio backend.' if e.message.include?('Command: L IF_GAIN')
143
- puts 'WARNING: Baseband Gain is not supported by the radio backend.' if e.message.include?('Command: L BB_GAIN')
144
-
145
- raise e unless e.message.include?('Command: L RF_GAIN') ||
146
- e.message.include?('Command: L IF_GAIN') ||
147
- e.message.include?('Command: L BB_GAIN')
148
- rescue StandardError => e
149
- raise e
150
- end
151
-
152
- # Supported Method Parameters::
153
- # PWN::Plugins::GQRX.init_freq(
154
- # gqrx_sock: 'required - GQRX socket object returned from #connect method',
155
- # freq: 'required - Frequency to set',
156
- # demodulator_mode: 'optional - Demodulator mode (defaults to WFM)',
157
- # bandwidth: 'optional - Bandwidth (defaults to 200000)',
158
- # lock_freq_duration: 'optional - Lock frequency duration (defaults to 0.5)',
159
- # strength_lock: 'optional - Strength lock (defaults to -60.0)'
160
- # )
161
- public_class_method def self.init_freq(opts = {})
162
- gqrx_sock = opts[:gqrx_sock]
163
- freq = opts[:freq]
164
- demodulator_mode = opts[:demodulator_mode]
165
- bandwidth = opts[:bandwidth]
166
- lock_freq_duration = opts[:lock_freq_duration]
167
- strength_lock = opts[:strength_lock]
168
-
169
- demod_n_passband = gqrx_cmd(
170
- gqrx_sock: gqrx_sock,
171
- cmd: 'm'
172
- )
173
-
174
- change_freq_resp = gqrx_cmd(
175
- gqrx_sock: gqrx_sock,
176
- cmd: "F #{freq}",
177
- resp_ok: 'RPRT 0'
178
- )
179
-
180
- current_freq = gqrx_cmd(
181
- gqrx_sock: gqrx_sock,
182
- cmd: 'f'
183
- )
184
-
185
- audio_gain_db = gqrx_cmd(
186
- gqrx_sock: gqrx_sock,
187
- cmd: 'l AF'
188
- ).to_f
189
-
190
- current_strength = gqrx_cmd(
191
- gqrx_sock: gqrx_sock,
192
- cmd: 'l STRENGTH'
193
- ).to_f
194
-
195
- current_squelch = gqrx_cmd(
196
- gqrx_sock: gqrx_sock,
197
- cmd: 'l SQL'
198
- ).to_f
199
-
200
- rf_gain = gqrx_cmd(
201
- gqrx_sock: gqrx_sock,
202
- cmd: 'l RF_GAIN'
203
- ).to_f
204
-
205
- if_gain = gqrx_cmd(
206
- gqrx_sock: gqrx_sock,
207
- cmd: 'l IF_GAIN'
208
- ).to_f
209
-
210
- bb_gain = gqrx_cmd(
211
- gqrx_sock: gqrx_sock,
212
- cmd: 'l BB_GAIN'
213
- ).to_f
214
-
215
- init_freq_hash = {
216
- demod_mode_n_passband: demod_n_passband,
217
- frequency: current_freq,
218
- bandwidth: bandwidth,
219
- audio_gain_db: audio_gain_db,
220
- squelch: current_squelch,
221
- rf_gain: rf_gain,
222
- if_gain: if_gain,
223
- bb_gain: bb_gain,
224
- strength: current_strength,
225
- strength_lock: strength_lock,
226
- lock_freq_duration: lock_freq_duration
227
- }
228
-
229
- print '.'
230
- sleep lock_freq_duration if current_strength > strength_lock
231
-
232
- init_freq_hash
233
- rescue StandardError => e
234
- raise e
235
- end
236
-
237
- # Supported Method Parameters::
238
- # PWN::Plugins::GQRX.scan_range(
239
- # gqrx_sock: 'required - GQRX socket object returned from #connect method',
240
- # demodulator_mode: 'required - Demodulator mode',
241
- # bandwidth: 'required - Bandwidth',
242
- # start_freq: 'required - Starting frequency',
243
- # target_freq: 'required - Target frequency',
244
- # precision: 'required - Precision',
245
- # lock_freq_duration: 'optional - Lock frequency duration (defaults to 0.5)',
246
- # strength_lock: 'optional - Strength lock (defaults to -60.0)'
247
- # )
248
-
249
- public_class_method def self.scan_range(opts = {})
250
- gqrx_sock = opts[:gqrx_sock]
251
- demodulator_mode = opts[:demodulator_mode]
252
- bandwidth = opts[:bandwidth]
253
- start_freq = opts[:start_freq]
254
- target_freq = opts[:target_freq]
255
- precision = opts[:precision]
256
- lock_freq_duration = opts[:lock_freq_duration]
257
- strength_lock = opts[:strength_lock]
258
-
259
- multiplier = 10**(precision - 1)
260
- prev_freq_hash = {
261
- demod_mode_n_passband: demodulator_mode,
262
- frequency: start_freq,
263
- bandwidth: bandwidth,
264
- audio_gain_db: 0.0,
265
- squelch: 0.0,
266
- rf_gain: 0.0,
267
- if_gain: 0.0,
268
- bb_gain: 0.0,
269
- strength: 0.0,
270
- strength_lock: strength_lock,
271
- lock_freq_duration: lock_freq_duration
272
- }
273
- if start_freq > target_freq
274
- start_freq.downto(target_freq) do |freq|
275
- next unless (freq % multiplier).zero?
276
-
277
- init_freq_hash = init_freq(
278
- gqrx_sock: gqrx_sock,
279
- freq: freq,
280
- demodulator_mode: demodulator_mode,
281
- bandwidth: bandwidth,
282
- lock_freq_duration: lock_freq_duration,
283
- strength_lock: strength_lock
284
- )
285
-
286
- current_strength = init_freq_hash[:strength]
287
- prev_strength = prev_freq_hash[:strength]
288
- prev_freq = prev_freq_hash[:frequency]
289
-
290
- approaching_detection = true if current_strength > prev_strength &&
291
- current_strength > strength_lock
292
- if approaching_detection && current_strength <= prev_strength
293
- puts "\n**** Found a signal ~ #{prev_freq} Hz ****"
294
- puts JSON.pretty_generate(prev_freq_hash)
295
- approaching_detection = false
296
- end
297
-
298
- prev_freq_hash = init_freq_hash
299
- end
300
- else
301
- freq = start_freq
302
- while freq <= target_freq
303
- init_freq_hash = init_freq(
304
- gqrx_sock: gqrx_sock,
305
- demodulator_mode: demodulator_mode,
306
- bandwidth: bandwidth,
307
- freq: freq,
308
- lock_freq_duration: lock_freq_duration,
309
- strength_lock: strength_lock
310
- )
311
-
312
- current_strength = init_freq_hash[:strength]
313
- prev_strength = prev_freq_hash[:strength]
314
- prev_freq = prev_freq_hash[:frequency]
315
-
316
- approaching_detection = true if current_strength > prev_strength &&
317
- current_strength > strength_lock
318
- if approaching_detection && current_strength < prev_strength
319
- puts "\n**** Discovered a signal ~ #{prev_freq} Hz ****"
320
- puts JSON.pretty_generate(prev_freq_hash)
321
- approaching_detection = false
322
- end
323
-
324
- prev_freq_hash = init_freq_hash
325
-
326
- freq += multiplier
327
- end
328
- end
329
- end
330
-
331
- # Supported Method Parameters::
332
- # profiles = PWN::Plugins::GQRX.list_profiles
333
- public_class_method def self.list_profiles
334
- # TODO: Wifi5 / Wifi6 profiles,
335
- # migrate to a YAML file, and add
336
- # rSpec test to ensure all profiles
337
- # contain consistent key-value pairs
338
- {
339
- ads_b978: {
340
- start_freq: '978.000.000',
341
- target_freq: '979.000.000',
342
- demodulator_mode: :RAW,
343
- bandwidth: '1.000.000',
344
- precision: 5
345
- },
346
- ads_b1090: {
347
- start_freq: '1.090.000.000',
348
- target_freq: '1.091.000.000',
349
- demodulator_mode: :RAW,
350
- bandwidth: '1.000.000',
351
- precision: 5
352
- },
353
- analog_tv_vhf: {
354
- start_freq: '54.000.000',
355
- target_freq: '216.000.000',
356
- demodulator_mode: :WFM,
357
- bandwidth: '6.000',
358
- precision: 5
359
- },
360
- analog_tv_uhf: {
361
- start_freq: '470.000.000',
362
- target_freq: '890.000.000',
363
- demodulator_mode: :WFM,
364
- bandwidth: '6.000',
365
- precision: 5
366
- },
367
- am_radio: {
368
- start_freq: '540.000',
369
- target_freq: '1.700.000',
370
- demodulator_mode: :AM,
371
- bandwidth: '10.000',
372
- precision: 4
373
- },
374
- bluetooth: {
375
- start_freq: '2.400.000.000',
376
- target_freq: '2.485.000.000',
377
- demodulator_mode: :RAW,
378
- bandwidth: '1.000.000',
379
- precision: 5
380
- },
381
- cdma: {
382
- start_freq: '824.000.000',
383
- target_freq: '849.000.000',
384
- demodulator_mode: :RAW,
385
- bandwidth: '1.250.000',
386
- precision: 6
387
- },
388
- cw20: {
389
- start_freq: '14.000.000',
390
- target_freq: '14.350.000',
391
- demodulator_mode: :CW,
392
- bandwidth: '150',
393
- precision: 3
394
- },
395
- cw40: {
396
- start_freq: '7.000.000',
397
- target_freq: '7.300.000',
398
- demodulator_mode: :CW,
399
- bandwidth: '150',
400
- precision: 3
401
- },
402
- cw80: {
403
- start_freq: '3.500.000',
404
- target_freq: '3.800.000',
405
- demodulator_mode: :CW,
406
- bandwidth: '150',
407
- precision: 3
408
- },
409
- gps12: {
410
- start_freq: '1.227.600.000',
411
- target_freq: '1.227.700.000',
412
- demodulator_mode: :RAW,
413
- bandwidth: '2.000.000',
414
- precision: 6
415
- },
416
- gps15: {
417
- start_freq: '1.575.420.000',
418
- target_freq: '1.575.450.000',
419
- demodulator_mode: :RAW,
420
- bandwidth: '2.000.000',
421
- precision: 6
422
- },
423
- gsm: {
424
- start_freq: '935.000.000',
425
- target_freq: '960.000.000',
426
- demodulator_mode: :RAW,
427
- bandwidth: '200.000',
428
- precision: 4
429
- },
430
- fm_radio: {
431
- start_freq: '88.000.000',
432
- target_freq: '108.000.000',
433
- demodulator_mode: :WFM,
434
- bandwidth: '200.000',
435
- precision: 5
436
- },
437
- high_rfid: {
438
- start_freq: '13.560.000',
439
- target_freq: '13.570.000',
440
- demodulator_mode: :RAW,
441
- bandwidth: '2.000.000',
442
- precision: 3
443
- },
444
- lora433: {
445
- start_freq: '432.000.000',
446
- target_freq: '434.000.000',
447
- demodulator_mode: :RAW,
448
- bandwidth: '500.000',
449
- precision: 3
450
- },
451
- lora915: {
452
- start_freq: '914.000.000',
453
- target_freq: '916.000.000',
454
- demodulator_mode: :RAW,
455
- bandwidth: '500.000',
456
- precision: 3
457
- },
458
- low_rfid: {
459
- start_freq: '125.000',
460
- target_freq: '125.100',
461
- demodulator_mode: :RAW,
462
- bandwidth: '200.000',
463
- precision: 1
464
- },
465
- keyfob300: {
466
- start_freq: '300.000.000',
467
- target_freq: '300.100.000',
468
- demodulator_mode: :RAW,
469
- bandwidth: '50.000',
470
- precision: 4
471
- },
472
- keyfob310: {
473
- start_freq: '310.000.000',
474
- target_freq: '310.100.000',
475
- demodulator_mode: :RAW,
476
- bandwidth: '50.000',
477
- precision: 4
478
- },
479
- keyfob315: {
480
- start_freq: '315.000.000',
481
- target_freq: '315.100.000',
482
- demodulator_mode: :RAW,
483
- bandwidth: '50.000',
484
- precision: 4
485
- },
486
- keyfob390: {
487
- start_freq: '390.000.000',
488
- target_freq: '390.100.000',
489
- demodulator_mode: :RAW,
490
- bandwidth: '50.000',
491
- precision: 4
492
- },
493
- rtty20: {
494
- start_freq: '14.000.000',
495
- target_freq: '14.350.000',
496
- demodulator_mode: :RTTY,
497
- bandwidth: '170',
498
- precision: 3
499
- },
500
- rtty40: {
501
- start_freq: '7.000.000',
502
- target_freq: '7.300.000',
503
- demodulator_mode: :RTTY,
504
- bandwidth: '170',
505
- precision: 3
506
- },
507
- rtty80: {
508
- start_freq: '3.500.000',
509
- target_freq: '3.800.000',
510
- demodulator_mode: :RTTY,
511
- bandwidth: '170',
512
- precision: 3
513
- },
514
- ssb10: {
515
- start_freq: '28.000.000',
516
- target_freq: '29.700.000',
517
- demodulator_mode: :USB,
518
- bandwidth: '2.700',
519
- precision: 6
520
- },
521
- ssb12: {
522
- start_freq: '24.890.000',
523
- target_freq: '24.990.000',
524
- demodulator_mode: :USB,
525
- bandwidth: '2.700',
526
- precision: 6
527
- },
528
- ssb15: {
529
- start_freq: '21.000.000',
530
- target_freq: '21.450.000',
531
- demodulator_mode: :USB,
532
- bandwidth: '2.700',
533
- precision: 6
534
- },
535
- ssb17: {
536
- start_freq: '18.068.000',
537
- target_freq: '18.168.000',
538
- demodulator_mode: :USB,
539
- bandwidth: '2.700',
540
- precision: 6
541
- },
542
- ssb20: {
543
- start_freq: '14.000.000',
544
- target_freq: '14.350.000',
545
- demodulator_mode: :USB,
546
- bandwidth: '2.700',
547
- precision: 6
548
- },
549
- ssb40: {
550
- start_freq: '7.000.000',
551
- target_freq: '7.300.000',
552
- demodulator_mode: :LSB,
553
- bandwidth: '2.700',
554
- precision: 6
555
- },
556
- ssb80: {
557
- start_freq: '3.500.000',
558
- target_freq: '3.800.000',
559
- demodulator_mode: :LSB,
560
- bandwidth: '2.700',
561
- precision: 6
562
- },
563
- ssb160: {
564
- start_freq: '1.800.000',
565
- target_freq: '2.000.000',
566
- demodulator_mode: :LSB,
567
- bandwidth: '2.700',
568
- precision: 6
569
- },
570
- tempest: {
571
- start_freq: '400.000.000',
572
- target_freq: '430.000.000',
573
- demodulator_mode: :WFM,
574
- bandwidth: '200.000',
575
- precision: 4
576
- },
577
- wifi24: {
578
- start_freq: '2.400.000.000',
579
- target_freq: '2.500.000.000',
580
- demodulator_mode: :RAW,
581
- bandwidth: '20.000.000',
582
- precision: 7
583
- },
584
- zigbee: {
585
- start_freq: '2.405.000.000',
586
- target_freq: '2.485.000.000',
587
- demodulator_mode: :RAW,
588
- bandwidth: '2.000.000',
589
- precision: 7
590
- }
591
- }
592
- rescue StandardError => e
593
- raise e
594
- end
595
-
596
- # Supported Method Parameters::
597
- # opts = PWN::Plugins::GQRX.assume_profile(
598
- # profile: 'required - valid GQRX profile name returned from #list_profiles method'
599
- # )
600
- public_class_method def self.assume_profile(opts = {})
601
- profile = opts[:profile].to_s.to_sym
602
-
603
- profiles_available = list_profiles
604
- opts = {}
605
- case profile
606
- when :ads_b978
607
- opts = profiles_available[:ads_b978]
608
- when :ads_b1090
609
- opts = profiles_available[:ads_b1090]
610
- when :analog_tv_vhf
611
- opts = profiles_available[:analog_tv_vhf]
612
- when :analog_tv_uhf
613
- opts = profiles_available[:analog_tv_uhf]
614
- when :am_radio
615
- opts = profiles_available[:am_radio]
616
- when :bluetooth
617
- opts = profiles_available[:bluetooth]
618
- when :cdma
619
- opts = profiles_available[:cdma]
620
- when :cw20
621
- opts = profiles_available[:cw20]
622
- when :cw40
623
- opts = profiles_available[:cw40]
624
- when :cw80
625
- opts = profiles_available[:cw80]
626
- when :gps12
627
- opts = profiles_available[:gps12]
628
- when :gps15
629
- opts = profiles_available[:gps15]
630
- when :gsm
631
- opts = profiles_available[:gsm]
632
- when :fm_radio
633
- opts = profiles_available[:fm_radio]
634
- when :high_rfid
635
- opts = profiles_available[:high_rfid]
636
- when :lora433
637
- opts = profiles_available[:lora433]
638
- when :lora915
639
- opts = profiles_available[:lora915]
640
- when :low_rfid
641
- opts = profiles_available[:low_rfid]
642
- when :keyfob300
643
- opts = profiles_available[:keyfob300]
644
- when :keyfob310
645
- opts = profiles_available[:keyfob310]
646
- when :keyfob315
647
- opts = profiles_available[:keyfob315]
648
- when :keyfob390
649
- opts = profiles_available[:keyfob390]
650
- when :rtty20
651
- opts = profiles_available[:rtty20]
652
- when :rtty40
653
- opts = profiles_available[:rtty40]
654
- when :rtty80
655
- opts = profiles_available[:rtty80]
656
- when :ssb10
657
- opts = profiles_available[:ssb10]
658
- when :ssb12
659
- opts = profiles_available[:ssb12]
660
- when :ssb15
661
- opts = profiles_available[:ssb15]
662
- when :ssb17
663
- opts = profiles_available[:ssb17]
664
- when :ssb20
665
- opts = profiles_available[:ssb20]
666
- when :ssb40
667
- opts = profiles_available[:ssb40]
668
- when :ssb80
669
- opts = profiles_available[:ssb80]
670
- when :ssb160
671
- opts = profiles_available[:ssb160]
672
- when :tempest
673
- opts = profiles_available[:tempest]
674
- when :wifi24
675
- opts = profiles_available[:wifi24]
676
- when :zigbee
677
- opts = profiles_available[:zigbee]
678
- else
679
- raise "ERROR: Invalid profile: #{profile}"
680
- end
681
-
682
- opts
683
- rescue StandardError => e
684
- raise e
685
- end
686
-
687
- # Supported Method Parameters::
688
- # PWN::Plugins::GQRX.disconnect(
689
- # gqrx_sock: 'required - GQRX socket object returned from #connect method'
690
- # )
691
- public_class_method def self.disconnect(opts = {})
692
- gqrx_sock = opts[:gqrx_sock]
693
-
694
- PWN::Plugins::Sock.disconnect(sock_obj: gqrx_sock)
695
- rescue StandardError => e
696
- raise e
697
- end
698
-
699
- # Author(s):: 0day Inc. <support@0dayinc.com>
700
-
701
- public_class_method def self.authors
702
- "AUTHOR(S):
703
- 0day Inc. <support@0dayinc.com>
704
- "
705
- end
706
-
707
- # Display Usage for this Module
708
-
709
- public_class_method def self.help
710
- puts "USAGE:
711
- gqrx_sock = #{self}.connect(
712
- target: 'optional - GQRX target IP address (defaults to 127.0.0.1)',
713
- port: 'optional - GQRX target port (defaults to 7356)'
714
- )
715
-
716
- #{self}.gqrx_cmd(
717
- gqrx_sock: 'required - GQRX socket object returned from #connect method',
718
- cmd: 'required - GQRX command to execute',
719
- resp_ok: 'optional - Expected response from GQRX to indicate success'
720
- )
721
-
722
- #{self}.init_freq(
723
- gqrx_sock: 'required - GQRX socket object returned from #connect method',
724
- freq: 'required - Frequency to set',
725
- demodulator_mode: 'optional - Demodulator mode (defaults to WFM)',
726
- bandwidth: 'optional - Bandwidth (defaults to 200000)',
727
- lock_freq_duration: 'optional - Lock frequency duration (defaults to 0.5)',
728
- strength_lock: 'optional - Strength lock (defaults to -60.0)'
729
- )
730
-
731
- #{self}.scan_range(
732
- gqrx_sock: 'required - GQRX socket object returned from #connect method',
733
- demodulator_mode: 'required - Demodulator mode',
734
- bandwidth: 'required - Bandwidth',
735
- start_freq: 'required - Starting frequency',
736
- target_freq: 'required - Target frequency',
737
- precision: 'required - Precision',
738
- lock_freq_duration: 'optional - Lock frequency duration (defaults to 0.5)',
739
- strength_lock: 'optional - Strength lock (defaults to -60.0)'
740
- )
741
-
742
- profiles = #{self}.list_profiles
743
-
744
- opts = #{self}.assume_profile(
745
- profile: 'required - valid GQRX profile name returned from #list_profiles method'
746
- )
747
-
748
- #{self}.disconnect(
749
- gqrx_sock: 'required - GQRX socket object returned from #connect method'
750
- )
751
-
752
- #{self}.authors
753
- "
754
- end
755
- end
756
- end
757
- end