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