pwn 0.5.506 → 0.5.508

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.
@@ -0,0 +1,416 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'open3'
4
+ require 'json'
5
+ require 'fileutils'
6
+
7
+ module PWN
8
+ module SDR
9
+ # This plugin interacts with the remote control interface of GQRX.
10
+ module FrequencyAllocation
11
+ # Supported Method Parameters::
12
+ # profiles = PWN::SDR::FrequencyAllocation.profiles
13
+ # Supported Method Parameters::
14
+ # profiles = PWN::SDR::FrequencyAllocation.profiles
15
+ public_class_method def self.profiles
16
+ # TODO: Wifi5 / Wifi6 profiles,
17
+ # migrate to a YAML file, and add
18
+ # rSpec test to ensure all profiles
19
+ # contain consistent key-value pairs
20
+ {
21
+ ads_b978: {
22
+ start_freq: '978.000.000',
23
+ target_freq: '979.000.000',
24
+ demodulator_mode: 'RAW',
25
+ bandwidth: 100_000,
26
+ precision: 5,
27
+ overlap_protection: true
28
+ },
29
+ ads_b1090: {
30
+ start_freq: '1.090.000.000',
31
+ target_freq: '1.091.000.000',
32
+ demodulator_mode: 'RAW',
33
+ bandwidth: 100_000,
34
+ precision: 5,
35
+ overlap_protection: true
36
+ },
37
+ analog_tv_vhf: {
38
+ start_freq: '54.000.000',
39
+ target_freq: '216.000.000',
40
+ demodulator_mode: 'WFM',
41
+ bandwidth: 600_000,
42
+ precision: 5,
43
+ overlap_protection: true
44
+ },
45
+ analog_tv_uhf: {
46
+ start_freq: '470.000.000',
47
+ target_freq: '890.000.000',
48
+ demodulator_mode: 'WFM',
49
+ bandwidth: 600_000,
50
+ precision: 5,
51
+ overlap_protection: true
52
+ },
53
+ am_radio: {
54
+ start_freq: '540.000',
55
+ target_freq: '1.700.000',
56
+ demodulator_mode: 'AM',
57
+ bandwidth: 10_000,
58
+ precision: 4,
59
+ overlap_protection: true
60
+ },
61
+ bluetooth: {
62
+ start_freq: '2.402.000.000',
63
+ target_freq: '2.480.000.000',
64
+ demodulator_mode: 'RAW',
65
+ bandwidth: 100_000,
66
+ precision: 5,
67
+ overlap_protection: true
68
+ },
69
+ cdma: {
70
+ start_freq: '824.000.000',
71
+ target_freq: '849.000.000',
72
+ demodulator_mode: 'RAW',
73
+ bandwidth: 125_000,
74
+ precision: 6,
75
+ overlap_protection: false
76
+ },
77
+ cw20: {
78
+ start_freq: '14.000.000',
79
+ target_freq: '14.350.000',
80
+ demodulator_mode: 'CW',
81
+ bandwidth: 150,
82
+ precision: 3,
83
+ overlap_protection: true
84
+ },
85
+ cw40: {
86
+ start_freq: '7.000.000',
87
+ target_freq: '7.300.000',
88
+ demodulator_mode: 'CW',
89
+ bandwidth: 150,
90
+ precision: 3,
91
+ overlap_protection: true
92
+ },
93
+ cw80: {
94
+ start_freq: '3.500.000',
95
+ target_freq: '3.800.000',
96
+ demodulator_mode: 'CW',
97
+ bandwidth: 150,
98
+ precision: 3,
99
+ overlap_protection: true
100
+ },
101
+ fm_radio: {
102
+ start_freq: '87.900.000',
103
+ target_freq: '108.000.000',
104
+ demodulator_mode: 'WFM',
105
+ bandwidth: 200_000,
106
+ precision: 6,
107
+ overlap_protection: true
108
+ },
109
+ frs: {
110
+ start_freq: '462.562.500',
111
+ target_freq: '467.725.000',
112
+ demodulator_mode: 'FM',
113
+ bandwidth: 200_000,
114
+ precision: 3,
115
+ overlap_protection: true
116
+ },
117
+ gmrs: {
118
+ start_freq: '462.550.000',
119
+ target_freq: '467.725.000',
120
+ demodulator_mode: 'FM',
121
+ bandwidth: 200_000,
122
+ precision: 3,
123
+ overlap_protection: true
124
+ },
125
+ gprs: {
126
+ start_freq: '880.000.000',
127
+ target_freq: '915.000.000',
128
+ demodulator_mode: 'RAW',
129
+ bandwidth: 200_000,
130
+ precision: 4,
131
+ overlap_protection: false
132
+ },
133
+ gps_l1: {
134
+ start_freq: '1.574.420.000',
135
+ target_freq: '1.576.420.000',
136
+ demodulator_mode: 'RAW',
137
+ bandwidth: 200_000,
138
+ precision: 6,
139
+ overlap_protection: false
140
+ },
141
+ gps_l2: {
142
+ start_freq: '1.226.600.000',
143
+ target_freq: '1.228.600.000',
144
+ demodulator_mode: 'RAW',
145
+ bandwidth: 200_000,
146
+ precision: 6,
147
+ overlap_protection: false
148
+ },
149
+ gsm: {
150
+ start_freq: '824.000.000',
151
+ target_freq: '894.000.000',
152
+ demodulator_mode: 'RAW',
153
+ bandwidth: 200_000,
154
+ precision: 4,
155
+ overlap_protection: false
156
+ },
157
+ high_rfid: {
158
+ start_freq: '13.560.000',
159
+ target_freq: '13.570.000',
160
+ demodulator_mode: 'RAW',
161
+ bandwidth: 200_000,
162
+ precision: 3,
163
+ overlap_protection: true
164
+ },
165
+ lora433: {
166
+ start_freq: '432.000.000',
167
+ target_freq: '434.000.000',
168
+ demodulator_mode: 'RAW',
169
+ bandwidth: 50_000,
170
+ precision: 3,
171
+ overlap_protection: true
172
+ },
173
+ lora915: {
174
+ start_freq: '902.000.000',
175
+ target_freq: '928.000.000',
176
+ demodulator_mode: 'RAW',
177
+ bandwidth: 50_000,
178
+ precision: 3,
179
+ overlap_protection: true
180
+ },
181
+ low_rfid: {
182
+ start_freq: '125.000',
183
+ target_freq: '134.000',
184
+ demodulator_mode: 'RAW',
185
+ bandwidth: 200_000,
186
+ precision: 1,
187
+ overlap_protection: true
188
+ },
189
+ keyfob300: {
190
+ start_freq: '300.000.000',
191
+ target_freq: '300.100.000',
192
+ demodulator_mode: 'RAW',
193
+ bandwidth: 50_000,
194
+ precision: 4,
195
+ overlap_protection: true
196
+ },
197
+ keyfob310: {
198
+ start_freq: '310.000.000',
199
+ target_freq: '310.100.000',
200
+ demodulator_mode: 'RAW',
201
+ bandwidth: 50_000,
202
+ precision: 4,
203
+ overlap_protection: true
204
+ },
205
+ keyfob315: {
206
+ start_freq: '315.000.000',
207
+ target_freq: '315.100.000',
208
+ demodulator_mode: 'RAW',
209
+ bandwidth: 50_000,
210
+ precision: 4,
211
+ overlap_protection: true
212
+ },
213
+ keyfob390: {
214
+ start_freq: '390.000.000',
215
+ target_freq: '390.100.000',
216
+ demodulator_mode: 'RAW',
217
+ bandwidth: 50_000,
218
+ precision: 4,
219
+ overlap_protection: true
220
+ },
221
+ keyfob433: {
222
+ start_freq: '433.000.000',
223
+ target_freq: '434.000.000',
224
+ demodulator_mode: 'RAW',
225
+ bandwidth: 50_000,
226
+ precision: 4,
227
+ overlap_protection: true
228
+ },
229
+ keyfob868: {
230
+ start_freq: '868.000.000',
231
+ target_freq: '869.000.000',
232
+ demodulator_mode: 'RAW',
233
+ bandwidth: 50_000,
234
+ precision: 4,
235
+ overlap_protection: true
236
+ },
237
+ rtty20: {
238
+ start_freq: '14.000.000',
239
+ target_freq: '14.350.000',
240
+ demodulator_mode: 'RTTY',
241
+ bandwidth: 170,
242
+ precision: 3,
243
+ overlap_protection: true
244
+ },
245
+ rtty40: {
246
+ start_freq: '7.000.000',
247
+ target_freq: '7.300.000',
248
+ demodulator_mode: 'RTTY',
249
+ bandwidth: 170,
250
+ precision: 3,
251
+ overlap_protection: true
252
+ },
253
+ rtty80: {
254
+ start_freq: '3.500.000',
255
+ target_freq: '3.800.000',
256
+ demodulator_mode: 'RTTY',
257
+ bandwidth: 170,
258
+ precision: 3,
259
+ overlap_protection: true
260
+ },
261
+ ssb10: {
262
+ start_freq: '28.000.000',
263
+ target_freq: '29.700.000',
264
+ demodulator_mode: 'USB',
265
+ bandwidth: 2_700,
266
+ precision: 6,
267
+ overlap_protection: true
268
+ },
269
+ ssb12: {
270
+ start_freq: '24.890.000',
271
+ target_freq: '24.990.000',
272
+ demodulator_mode: 'USB',
273
+ bandwidth: 2_700,
274
+ precision: 6,
275
+ overlap_protection: true
276
+ },
277
+ ssb15: {
278
+ start_freq: '21.000.000',
279
+ target_freq: '21.450.000',
280
+ demodulator_mode: 'USB',
281
+ bandwidth: 2_700,
282
+ precision: 6,
283
+ overlap_protection: true
284
+ },
285
+ ssb17: {
286
+ start_freq: '18.068.000',
287
+ target_freq: '18.168.000',
288
+ demodulator_mode: 'USB',
289
+ bandwidth: 2_700,
290
+ precision: 6,
291
+ overlap_protection: true
292
+ },
293
+ ssb20: {
294
+ start_freq: '14.000.000',
295
+ target_freq: '14.350.000',
296
+ demodulator_mode: 'USB',
297
+ bandwidth: 2_700,
298
+ precision: 6,
299
+ overlap_protection: true
300
+ },
301
+ ssb40: {
302
+ start_freq: '7.000.000',
303
+ target_freq: '7.300.000',
304
+ demodulator_mode: 'LSB',
305
+ bandwidth: 2_700,
306
+ precision: 6,
307
+ overlap_protection: true
308
+ },
309
+ ssb80: {
310
+ start_freq: '3.500.000',
311
+ target_freq: '3.800.000',
312
+ demodulator_mode: 'LSB',
313
+ bandwidth: 2_700,
314
+ precision: 6,
315
+ overlap_protection: true
316
+ },
317
+ ssb160: {
318
+ start_freq: '1.800.000',
319
+ target_freq: '2.000.000',
320
+ demodulator_mode: 'LSB',
321
+ bandwidth: 2_700,
322
+ precision: 6,
323
+ overlap_protection: true
324
+ },
325
+ tempest: {
326
+ start_freq: '400.000.000',
327
+ target_freq: '430.000.000',
328
+ demodulator_mode: 'WFM',
329
+ bandwidth: 200_000,
330
+ precision: 4,
331
+ overlap_protection: false
332
+ },
333
+ uhf_rfid: {
334
+ start_freq: '860.000.000',
335
+ target_freq: '960.000.000',
336
+ demodulator_mode: 'RAW',
337
+ bandwidth: 100_000,
338
+ precision: 5,
339
+ overlap_protection: true
340
+ },
341
+ wifi24: {
342
+ start_freq: '2.400.000.000',
343
+ target_freq: '2.500.000.000',
344
+ demodulator_mode: 'RAW',
345
+ bandwidth: 200_000,
346
+ precision: 7,
347
+ overlap_protection: true
348
+ },
349
+ wifi5: {
350
+ start_freq: '5.150.000.000',
351
+ target_freq: '5.850.000.000',
352
+ demodulator_mode: 'RAW',
353
+ bandwidth: 200_000,
354
+ precision: 7,
355
+ overlap_protection: true
356
+ },
357
+ wifi6: {
358
+ start_freq: '5.925.000.000',
359
+ target_freq: '7.125.000.000',
360
+ demodulator_mode: 'RAW',
361
+ bandwidth: 200_000,
362
+ precision: 7,
363
+ overlap_protection: true
364
+ },
365
+ zigbee: {
366
+ start_freq: '2.405.000.000',
367
+ target_freq: '2.485.000.000',
368
+ demodulator_mode: 'RAW',
369
+ bandwidth: 200_000,
370
+ precision: 7,
371
+ overlap_protection: true
372
+ }
373
+ }
374
+ rescue StandardError => e
375
+ raise e
376
+ end
377
+
378
+ # Supported Method Parameters::
379
+ # opts = PWN::SDR::FrequencyAllocation.load(
380
+ # profile: 'required - valid FrequencyAllocation profile name returned from #profiles method'
381
+ # )
382
+ public_class_method def self.load(opts = {})
383
+ profile = opts[:profile]&.to_sym
384
+
385
+ profiles_available = profiles
386
+ raise "ERROR: Invalid profile: #{profile}" unless profiles_available.key?(profile)
387
+
388
+ profiles_available[profile]
389
+ rescue StandardError => e
390
+ raise e
391
+ end
392
+
393
+ # Author(s):: 0day Inc. <support@0dayinc.com>
394
+
395
+ public_class_method def self.authors
396
+ "AUTHOR(S):
397
+ 0day Inc. <support@0dayinc.com>
398
+ "
399
+ end
400
+
401
+ # Display Usage for this Module
402
+
403
+ public_class_method def self.help
404
+ puts "USAGE:
405
+ profiles = #{self}.profiles
406
+
407
+ opts = #{self}.load(
408
+ profile: 'required - valid frequency allocation profile name returned from #profiles method'
409
+ )
410
+
411
+ #{self}.authors
412
+ "
413
+ end
414
+ end
415
+ end
416
+ end