pwn 0.5.513 → 0.5.515
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.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/pwn/sdr/gqrx.rb +76 -55
- data/lib/pwn/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d607ee5ce171b1d6683a6930a6ef46e636b0ba79b38f636627ac7d3552dba740
|
|
4
|
+
data.tar.gz: c04ae0f7241c14ed7cff5b270ecac11f1558cc28070af7fd15b51a72db5252db
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 99378a68ba8484746d057a7082064dfbd7c0011e15e6b85fd1c746fe3084f4811fa973d99d6c9d41da74fcc78bf56dbe9a8a98e12206e6f9f8de31ac3906aaa1
|
|
7
|
+
data.tar.gz: 7c9f89ff3be93b1914cfe20075a5f30c4062be1e5525d4a650c052ccaba4b10d7f884742baaffabb41cd956729e8a58dd4d0b55bd032e125c2bc7452d0db50b3
|
data/README.md
CHANGED
|
@@ -37,7 +37,7 @@ $ cd /opt/pwn
|
|
|
37
37
|
$ ./install.sh
|
|
38
38
|
$ ./install.sh ruby-gem
|
|
39
39
|
$ pwn
|
|
40
|
-
pwn[v0.5.
|
|
40
|
+
pwn[v0.5.515]:001 >>> PWN.help
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
[](https://youtu.be/G7iLUY4FzsI)
|
|
@@ -52,7 +52,7 @@ $ rvm use ruby-3.4.7@pwn
|
|
|
52
52
|
$ gem uninstall --all --executables pwn
|
|
53
53
|
$ gem install --verbose pwn
|
|
54
54
|
$ pwn
|
|
55
|
-
pwn[v0.5.
|
|
55
|
+
pwn[v0.5.515]:001 >>> PWN.help
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
If you're using a multi-user install of RVM do:
|
|
@@ -62,7 +62,7 @@ $ rvm use ruby-3.4.7@pwn
|
|
|
62
62
|
$ rvmsudo gem uninstall --all --executables pwn
|
|
63
63
|
$ rvmsudo gem install --verbose pwn
|
|
64
64
|
$ pwn
|
|
65
|
-
pwn[v0.5.
|
|
65
|
+
pwn[v0.5.515]:001 >>> PWN.help
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
PWN periodically upgrades to the latest version of Ruby which is reflected in `/opt/pwn/.ruby-version`. The easiest way to upgrade to the latest version of Ruby from a previous PWN installation is to run the following script:
|
data/lib/pwn/sdr/gqrx.rb
CHANGED
|
@@ -141,11 +141,7 @@ module PWN
|
|
|
141
141
|
response.push(gqrx_sock.readline.chomp)
|
|
142
142
|
# Drain any additional lines quickly
|
|
143
143
|
loop do
|
|
144
|
-
|
|
145
|
-
# We're trading speed for accuracy here.
|
|
146
|
-
# break if gqrx_sock.wait_readable(0.0625).nil? && cmd == 'l STRENGTH'
|
|
147
|
-
break if gqrx_sock.wait_readable(0.04).nil? && cmd == 'l STRENGTH'
|
|
148
|
-
break if gqrx_sock.wait_readable(0.001).nil? && cmd != 'l STRENGTH'
|
|
144
|
+
break if gqrx_sock.wait_readable(0.0001).nil?
|
|
149
145
|
|
|
150
146
|
response.push(gqrx_sock.readline.chomp)
|
|
151
147
|
end
|
|
@@ -175,26 +171,72 @@ module PWN
|
|
|
175
171
|
|
|
176
172
|
# Supported Method Parameters::
|
|
177
173
|
# strength_db = PWN::SDR::GQRX.measure_signal_strength(
|
|
178
|
-
# gqrx_sock: 'required - GQRX socket object returned from #connect method'
|
|
174
|
+
# gqrx_sock: 'required - GQRX socket object returned from #connect method',
|
|
175
|
+
# strength_lock: 'optional - Strength lock in dBFS to determine signal edges (defaults to -70.0)'
|
|
179
176
|
# )
|
|
180
177
|
private_class_method def self.measure_signal_strength(opts = {})
|
|
181
178
|
gqrx_sock = opts[:gqrx_sock]
|
|
179
|
+
strength_lock = opts[:strength_lock] ||= -70.0
|
|
182
180
|
|
|
181
|
+
attempts = 0
|
|
183
182
|
strength_db = -99.9
|
|
184
|
-
prev_strength_db =
|
|
185
|
-
# While strength_db is rising, keep measuring
|
|
183
|
+
prev_strength_db = -99.9
|
|
186
184
|
loop do
|
|
185
|
+
attempts += 1
|
|
187
186
|
strength_db = gqrx_cmd(gqrx_sock: gqrx_sock, cmd: 'l STRENGTH').to_f
|
|
188
|
-
break if strength_db <= prev_strength_db
|
|
189
187
|
|
|
188
|
+
# Suprisingly accurate but takes longer
|
|
189
|
+
# `break if strength_db < prev_strength_db` || attempts >= 300
|
|
190
|
+
# is VERY accurate with
|
|
191
|
+
# `sleep 0.0001`
|
|
192
|
+
# but with more sampling == longer time
|
|
193
|
+
# break if attempts >= 100 && (strength_lock > strength_db || strength_db < prev_strength_db)
|
|
194
|
+
|
|
195
|
+
break if attempts >= 30 && strength_lock > strength_db
|
|
196
|
+
|
|
197
|
+
break if attempts >= 300 || strength_db < prev_strength_db
|
|
198
|
+
|
|
199
|
+
sleep 0.001
|
|
190
200
|
prev_strength_db = strength_db
|
|
191
201
|
end
|
|
202
|
+
puts "Strength Measurement Attempts: #{attempts}"
|
|
192
203
|
|
|
193
204
|
strength_db
|
|
194
205
|
rescue StandardError => e
|
|
195
206
|
raise e
|
|
196
207
|
end
|
|
197
208
|
|
|
209
|
+
# Supported Method Parameters::
|
|
210
|
+
# tune_resp = PWN::SDR::GQRX.tune_to(
|
|
211
|
+
# gqrx_sock: 'required - GQRX socket object returned from #connect method',
|
|
212
|
+
# hz: 'required - Frequency to tune to'
|
|
213
|
+
# )
|
|
214
|
+
private_class_method def self.tune_to(opts = {})
|
|
215
|
+
gqrx_sock = opts[:gqrx_sock]
|
|
216
|
+
hz = opts[:hz].to_s.cast_to_raw_hz
|
|
217
|
+
|
|
218
|
+
current_freq = 0
|
|
219
|
+
attempts = 0
|
|
220
|
+
loop do
|
|
221
|
+
attempts += 1
|
|
222
|
+
gqrx_cmd(
|
|
223
|
+
gqrx_sock: gqrx_sock,
|
|
224
|
+
cmd: "F #{hz}",
|
|
225
|
+
resp_ok: 'RPRT 0'
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
current_freq = gqrx_cmd(
|
|
229
|
+
gqrx_sock: gqrx_sock,
|
|
230
|
+
cmd: 'f'
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
break if current_freq.to_s.cast_to_raw_hz == hz
|
|
234
|
+
end
|
|
235
|
+
# puts "Tuned to #{current_freq} in #{attempts} attempt(s)."
|
|
236
|
+
rescue StandardError => e
|
|
237
|
+
raise e
|
|
238
|
+
end
|
|
239
|
+
|
|
198
240
|
# Supported Method Parameters::
|
|
199
241
|
# candidate_signals = PWN::SDR::GQRX.edge_detection(
|
|
200
242
|
# gqrx_sock: 'required - GQRX socket object returned from #connect method',
|
|
@@ -216,15 +258,11 @@ module PWN
|
|
|
216
258
|
strength_db = 99.9
|
|
217
259
|
puts 'Finding Beginning Edge of Signal...'
|
|
218
260
|
while strength_db >= strength_lock
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
cmd: 'f'
|
|
225
|
-
)
|
|
226
|
-
end
|
|
227
|
-
strength_db = measure_signal_strength(gqrx_sock: gqrx_sock)
|
|
261
|
+
tune_to(gqrx_sock: gqrx_sock, hz: hz)
|
|
262
|
+
strength_db = measure_signal_strength(
|
|
263
|
+
gqrx_sock: gqrx_sock,
|
|
264
|
+
strength_lock: strength_lock
|
|
265
|
+
)
|
|
228
266
|
candidate = {
|
|
229
267
|
hz: hz.to_s.cast_to_raw_hz,
|
|
230
268
|
freq: hz.to_i.cast_to_pretty_hz,
|
|
@@ -245,15 +283,11 @@ module PWN
|
|
|
245
283
|
strength_db = 99.9
|
|
246
284
|
puts 'Finding Ending Edge of Signal...'
|
|
247
285
|
while strength_db >= strength_lock
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
cmd: 'f'
|
|
254
|
-
)
|
|
255
|
-
end
|
|
256
|
-
strength_db = measure_signal_strength(gqrx_sock: gqrx_sock)
|
|
286
|
+
tune_to(gqrx_sock: gqrx_sock, hz: hz)
|
|
287
|
+
strength_db = measure_signal_strength(
|
|
288
|
+
gqrx_sock: gqrx_sock,
|
|
289
|
+
strength_lock: strength_lock
|
|
290
|
+
)
|
|
257
291
|
candidate = {
|
|
258
292
|
hz: hz.to_s.cast_to_raw_hz,
|
|
259
293
|
freq: hz.to_i.cast_to_pretty_hz,
|
|
@@ -287,7 +321,7 @@ module PWN
|
|
|
287
321
|
|
|
288
322
|
signals = signals_arr.sort_by { |s| s[:freq].to_s.cast_to_raw_hz }
|
|
289
323
|
# Unique signals by frequency
|
|
290
|
-
signals.uniq! { |s| s[:
|
|
324
|
+
signals.uniq! { |s| s[:freq].to_s.cast_to_raw_hz }
|
|
291
325
|
|
|
292
326
|
timestamp_end = Time.now.strftime('%Y-%m-%d %H:%M:%S%z')
|
|
293
327
|
duration_secs = Time.parse(timestamp_end) - Time.parse(timestamp_start)
|
|
@@ -439,24 +473,16 @@ module PWN
|
|
|
439
473
|
)
|
|
440
474
|
end
|
|
441
475
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
resp_ok: 'RPRT 0'
|
|
476
|
+
tune_to(gqrx_sock: gqrx_sock, hz: freq)
|
|
477
|
+
strength_db = measure_signal_strength(
|
|
478
|
+
gqrx_sock: gqrx_sock
|
|
446
479
|
)
|
|
447
480
|
|
|
448
|
-
current_freq = 0
|
|
449
|
-
while current_freq.to_s.cast_to_raw_hz != freq.to_s.cast_to_raw_hz
|
|
450
|
-
current_freq = gqrx_cmd(
|
|
451
|
-
gqrx_sock: gqrx_sock,
|
|
452
|
-
cmd: 'f'
|
|
453
|
-
)
|
|
454
|
-
end
|
|
455
|
-
|
|
456
481
|
freq_obj = {
|
|
457
482
|
bandwidth: bandwidth,
|
|
458
483
|
demodulator_mode: demodulator_mode,
|
|
459
484
|
rds: rds,
|
|
485
|
+
strength_db: strength_db,
|
|
460
486
|
freq: freq
|
|
461
487
|
}
|
|
462
488
|
|
|
@@ -471,8 +497,6 @@ module PWN
|
|
|
471
497
|
cmd: 'l AF'
|
|
472
498
|
).to_f
|
|
473
499
|
|
|
474
|
-
strength_db = measure_signal_strength(gqrx_sock: gqrx_sock)
|
|
475
|
-
|
|
476
500
|
squelch = gqrx_cmd(
|
|
477
501
|
gqrx_sock: gqrx_sock,
|
|
478
502
|
cmd: 'l SQL'
|
|
@@ -502,7 +526,6 @@ module PWN
|
|
|
502
526
|
freq_obj[:if_gain] = if_gain
|
|
503
527
|
freq_obj[:rf_gain] = rf_gain
|
|
504
528
|
freq_obj[:squelch] = squelch
|
|
505
|
-
freq_obj[:strength_db] = strength_db
|
|
506
529
|
freq_obj[:rds] = rds_resp
|
|
507
530
|
end
|
|
508
531
|
|
|
@@ -707,8 +730,11 @@ module PWN
|
|
|
707
730
|
start_hz_direction.step(by: step_hz_direction, to: end_hz_direction) do |hz|
|
|
708
731
|
print '>' if direction_up
|
|
709
732
|
print '<' unless direction_up
|
|
710
|
-
|
|
711
|
-
strength_db = measure_signal_strength(
|
|
733
|
+
tune_to(gqrx_sock: gqrx_sock, hz: hz)
|
|
734
|
+
strength_db = measure_signal_strength(
|
|
735
|
+
gqrx_sock: gqrx_sock,
|
|
736
|
+
strength_lock: strength_lock
|
|
737
|
+
)
|
|
712
738
|
samples.push({ hz: hz, strength_db: strength_db })
|
|
713
739
|
|
|
714
740
|
# current_hz = gqrx_cmd(gqrx_sock: gqrx_sock, cmd: 'f').to_s.cast_to_raw_hz
|
|
@@ -787,16 +813,11 @@ module PWN
|
|
|
787
813
|
signals_arr = []
|
|
788
814
|
hz = hz_start
|
|
789
815
|
while hz <= hz_target
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
cmd: 'f'
|
|
796
|
-
)
|
|
797
|
-
end
|
|
798
|
-
|
|
799
|
-
strength_db = measure_signal_strength(gqrx_sock: gqrx_sock)
|
|
816
|
+
tune_to(gqrx_sock: gqrx_sock, hz: hz)
|
|
817
|
+
strength_db = measure_signal_strength(
|
|
818
|
+
gqrx_sock: gqrx_sock,
|
|
819
|
+
strength_lock: strength_lock
|
|
820
|
+
)
|
|
800
821
|
|
|
801
822
|
if strength_db >= strength_lock
|
|
802
823
|
puts '-' * 86
|
data/lib/pwn/version.rb
CHANGED