pwn 0.5.51 → 0.5.52
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/bin/pwn_gqrx_scanner +81 -33
- 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: 0f9d1c877c0b0d4a074cff09b2b7f8c1fcb4dbb741f0477f8ae200bad601b68c
|
|
4
|
+
data.tar.gz: 2a92813b9ca894105d89bc468c1cd8c45ab1b11393f7fffea6c6c1ff23ba46e7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2ef418cb373ff1e3fb95826cd98b47be932e70f0e87f4ce7e9694972441adc203f0b1dd67acc2341e9ab78170706550f4f39c06664acbeb3313b132641326db9
|
|
7
|
+
data.tar.gz: 88fc2a90c23beeb8a352bc41e48ef211150b50e9555d0534013c143dd66b9ee38952b68bf9d89f1636ddc15258ba76724946f128ebd7ad6f1dabd78102619aa2
|
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.52]:001 >>> PWN.help
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
[](https://youtu.be/G7iLUY4FzsI)
|
|
@@ -52,7 +52,7 @@ $ rvm use ruby-3.3.0@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.52]: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.3.0@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.52]: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/bin/pwn_gqrx_scanner
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
# frozen_string_literal: false
|
|
3
3
|
|
|
4
4
|
require 'pwn'
|
|
5
|
+
require 'json'
|
|
5
6
|
require 'optparse'
|
|
6
7
|
|
|
7
8
|
opts = {}
|
|
@@ -14,6 +15,14 @@ OptionParser.new do |options|
|
|
|
14
15
|
opts[:target_freq] = e
|
|
15
16
|
end
|
|
16
17
|
|
|
18
|
+
options.on('-hHOST', '--host=HOST', '<Optional - GQRX Host (Defaults to 127.0.0.1)>') do |h|
|
|
19
|
+
opts[:host] = h
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
options.on('-pPORT', '--port=PORT', '<Optional - GQRX Port (Defaults to 7356)>') do |p|
|
|
23
|
+
opts[:port] = p
|
|
24
|
+
end
|
|
25
|
+
|
|
17
26
|
options.on('-dMODE', '--demodulator-mode=MODE', '<Optional - Set Demodulator ModeOFF | RAW | AM | FM | WFM | WFM_ST | WFM_ST_OIRT | LSB |USB | CW | CWL | CWU (Defaults to AM)>') do |d|
|
|
18
27
|
opts[:demodulator_mode] = d
|
|
19
28
|
end
|
|
@@ -22,20 +31,20 @@ OptionParser.new do |options|
|
|
|
22
31
|
opts[:start_freq] = s
|
|
23
32
|
end
|
|
24
33
|
|
|
25
|
-
options.on('-
|
|
26
|
-
opts[:
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
options.on('-pPORT', '--port=PORT', '<Optional - GQRX Port (Defaults to 7356)>') do |p|
|
|
30
|
-
opts[:port] = p
|
|
34
|
+
options.on('-qFLOAT', '--squelch=FLOAT', '<Optional - Squelch Threshold (Defaults to -63)>') do |q|
|
|
35
|
+
opts[:squelch] = q
|
|
31
36
|
end
|
|
32
37
|
|
|
33
38
|
options.on('-PPLACE', '--precision=PLACE', '<Optional - Precision of Frequency 1-12 (Defaults to 3)>') do |p|
|
|
34
39
|
opts[:precision] = p
|
|
35
40
|
end
|
|
36
41
|
|
|
37
|
-
options.on('-
|
|
38
|
-
opts[:
|
|
42
|
+
options.on('-LFLOAT', '--lock-on-freq-duration=FLOAT', '<Optional - Duration to lock onto Freqency when Strength < --strength value (Defaults to -63)>') do |l|
|
|
43
|
+
opts[:lock_on_freq_duration] = l
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
options.on('-SFLOAT', '--strength=FLOAT', '<Optional - Strength to trigger sleep (Defaults to 0)>') do |s|
|
|
47
|
+
opts[:strength] = s
|
|
39
48
|
end
|
|
40
49
|
end.parse!
|
|
41
50
|
|
|
@@ -70,24 +79,49 @@ end
|
|
|
70
79
|
def init_freq(opts = {})
|
|
71
80
|
gqrx_sock = opts[:gqrx_sock]
|
|
72
81
|
this_freq = opts[:this_freq]
|
|
73
|
-
|
|
82
|
+
lock_on_freq_duration = opts[:lock_on_freq_duration]
|
|
83
|
+
strength = opts[:strength]
|
|
74
84
|
|
|
75
|
-
|
|
85
|
+
change_frreq_resp = gqrx_cmd(
|
|
76
86
|
gqrx_sock: gqrx_sock,
|
|
77
87
|
cmd: "F #{this_freq}"
|
|
78
88
|
)
|
|
79
|
-
raise "ERROR: Failed to set frequency to #{this_freq}" unless
|
|
89
|
+
raise "ERROR: Failed to set frequency to #{this_freq}" unless change_frreq_resp == 'RPRT 0'
|
|
80
90
|
|
|
81
|
-
|
|
91
|
+
raw_freq = gqrx_cmd(
|
|
82
92
|
gqrx_sock: gqrx_sock,
|
|
83
93
|
cmd: 'f'
|
|
84
94
|
)
|
|
85
95
|
|
|
86
96
|
# Split the response from NNNNNNNNN
|
|
87
97
|
# to NNN.NNN.NNN
|
|
88
|
-
this_freq =
|
|
89
|
-
|
|
90
|
-
|
|
98
|
+
this_freq = raw_freq.to_s.chars.insert(-4, '.').insert(-8, '.').join
|
|
99
|
+
|
|
100
|
+
strength_resp = gqrx_cmd(
|
|
101
|
+
gqrx_sock: gqrx_sock,
|
|
102
|
+
cmd: 'l STRENGTH'
|
|
103
|
+
)
|
|
104
|
+
current_strength = strength_resp.to_f
|
|
105
|
+
|
|
106
|
+
squelch_resp = gqrx_cmd(
|
|
107
|
+
gqrx_sock: gqrx_sock,
|
|
108
|
+
cmd: 'l SQL'
|
|
109
|
+
)
|
|
110
|
+
current_squelch = squelch_resp.to_f
|
|
111
|
+
|
|
112
|
+
init_freq_hash = {
|
|
113
|
+
frequency: this_freq,
|
|
114
|
+
strength: current_strength,
|
|
115
|
+
squelch: current_squelch
|
|
116
|
+
}
|
|
117
|
+
# puts JSON.parse(init_freq_hash)
|
|
118
|
+
puts init_freq_hash.to_json
|
|
119
|
+
|
|
120
|
+
sleep lock_on_freq_duration if current_strength < strength
|
|
121
|
+
# This helps level out strength
|
|
122
|
+
sleep 0.03
|
|
123
|
+
|
|
124
|
+
init_freq_hash
|
|
91
125
|
end
|
|
92
126
|
|
|
93
127
|
def scan_range(opts = {})
|
|
@@ -95,26 +129,30 @@ def scan_range(opts = {})
|
|
|
95
129
|
start_freq = opts[:start_freq]
|
|
96
130
|
target_freq = opts[:target_freq]
|
|
97
131
|
precision = opts[:precision]
|
|
98
|
-
|
|
132
|
+
lock_on_freq_duration = opts[:lock_on_freq_duration]
|
|
133
|
+
strength = opts[:strength]
|
|
99
134
|
|
|
100
135
|
multiplier = 10**(precision - 1)
|
|
101
136
|
if start_freq > target_freq
|
|
102
137
|
start_freq.downto(target_freq) do |this_freq|
|
|
103
138
|
next unless (i % multiplier).zero?
|
|
104
139
|
|
|
105
|
-
init_freq(
|
|
140
|
+
init_freq_hash = init_freq(
|
|
106
141
|
gqrx_sock: gqrx_sock,
|
|
107
142
|
this_freq: this_freq,
|
|
108
|
-
|
|
143
|
+
lock_on_freq_duration: lock_on_freq_duration,
|
|
144
|
+
strength: strength
|
|
109
145
|
)
|
|
146
|
+
puts init_freq_hash.to_json
|
|
110
147
|
end
|
|
111
148
|
else
|
|
112
149
|
this_freq = start_freq
|
|
113
150
|
while this_freq <= target_freq
|
|
114
|
-
init_freq(
|
|
151
|
+
init_freq_hash = init_freq(
|
|
115
152
|
gqrx_sock: gqrx_sock,
|
|
116
153
|
this_freq: this_freq,
|
|
117
|
-
|
|
154
|
+
lock_on_freq_duration: lock_on_freq_duration,
|
|
155
|
+
strength: strength
|
|
118
156
|
)
|
|
119
157
|
|
|
120
158
|
this_freq += multiplier
|
|
@@ -126,42 +164,52 @@ begin
|
|
|
126
164
|
pwn_provider = 'ruby-gem'
|
|
127
165
|
pwn_provider = ENV.fetch('PWN_PROVIDER') if ENV.keys.any? { |s| s == 'PWN_PROVIDER' }
|
|
128
166
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
raise
|
|
167
|
+
target_freq = opts[:target_freq]
|
|
168
|
+
target_freq = target_freq.to_s.delete('.').to_i unless target_freq.nil?
|
|
169
|
+
raise 'ERROR: Invalid end frequency' if target_freq.nil?
|
|
132
170
|
|
|
133
171
|
host = opts[:host] ||= '127.0.0.1'
|
|
134
172
|
port = opts[:port] ||= 7356
|
|
135
|
-
puts "Connecting to GQRX at #{host}:#{port}..."
|
|
136
173
|
|
|
174
|
+
puts "Connecting to GQRX at #{host}:#{port}..."
|
|
137
175
|
gqrx_sock = PWN::Plugins::Sock.connect(target: host, port: port)
|
|
176
|
+
|
|
177
|
+
demodulator_mode = opts[:demodulator_mode] ||= 'AM'
|
|
178
|
+
demodulator_mode.upcase!
|
|
179
|
+
raise "ERROR: Invalid demodulator mode: #{demodulator_mode}" unless %w[OFF RAW AM FM WFM WFM_ST WFM_ST_OIRT LSB USB CW CWL CWU].include?(demodulator_mode)
|
|
180
|
+
|
|
138
181
|
puts "Setting demodulator mode to #{demodulator_mode}..."
|
|
139
182
|
demod_resp = gqrx_cmd(gqrx_sock: gqrx_sock, cmd: "M #{demodulator_mode}")
|
|
140
|
-
|
|
183
|
+
raise "ERROR: Failed to set demodulator mode to #{demodulator_mode}" unless demod_resp == 'RPRT 0'
|
|
141
184
|
|
|
142
185
|
start_freq = opts[:start_freq]
|
|
143
186
|
start_freq = start_freq.to_s.delete('.').to_i unless start_freq.nil?
|
|
144
187
|
start_freq = gqrx_cmd(gqrx_sock: gqrx_sock, cmd: 'f').to_i if start_freq.nil?
|
|
145
188
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
puts "Scanning from #{start_freq} to #{target_freq}..."
|
|
189
|
+
squelch = opts[:squelch] ||= -63
|
|
190
|
+
squelch = squelch.to_f
|
|
191
|
+
squelch_resp = gqrx_cmd(gqrx_sock: gqrx_sock, cmd: "L SQL #{squelch}")
|
|
192
|
+
raise "ERROR: Failed to set squelch to #{squelch}" unless squelch_resp == 'RPRT 0'
|
|
151
193
|
|
|
152
194
|
precision = opts[:precision] ||= 3
|
|
153
195
|
precision = precision.to_i
|
|
154
196
|
raise "ERROR: Invalid precision: #{precision}" unless (1..12).include?(precision)
|
|
155
197
|
|
|
156
|
-
|
|
157
|
-
|
|
198
|
+
lock_on_freq_duration = opts[:lock_on_freq_duration] ||= 0
|
|
199
|
+
lock_on_freq_duration = lock_on_freq_duration.to_f
|
|
200
|
+
|
|
201
|
+
strength = opts[:strength] ||= -63
|
|
202
|
+
strength = strength.to_f
|
|
203
|
+
|
|
204
|
+
puts "Scanning from #{start_freq} to #{target_freq}..."
|
|
158
205
|
|
|
159
206
|
scan_range(
|
|
160
207
|
gqrx_sock: gqrx_sock,
|
|
161
208
|
start_freq: start_freq,
|
|
162
209
|
target_freq: target_freq,
|
|
163
210
|
precision: precision,
|
|
164
|
-
|
|
211
|
+
lock_on_freq_duration: lock_on_freq_duration,
|
|
212
|
+
strength: strength
|
|
165
213
|
)
|
|
166
214
|
rescue SystemExit, Interrupt
|
|
167
215
|
puts "\nGoodbye."
|
data/lib/pwn/version.rb
CHANGED