pwn 0.5.50 → 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 +110 -42
- data/lib/pwn/version.rb +1 -1
- metadata +2 -2
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[:
|
34
|
+
options.on('-qFLOAT', '--squelch=FLOAT', '<Optional - Squelch Threshold (Defaults to -63)>') do |q|
|
35
|
+
opts[:squelch] = q
|
27
36
|
end
|
28
37
|
|
29
|
-
options.on('-
|
30
|
-
opts[:
|
38
|
+
options.on('-PPLACE', '--precision=PLACE', '<Optional - Precision of Frequency 1-12 (Defaults to 3)>') do |p|
|
39
|
+
opts[:precision] = p
|
31
40
|
end
|
32
41
|
|
33
|
-
options.on('-
|
34
|
-
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
|
35
44
|
end
|
36
45
|
|
37
|
-
options.on('-SFLOAT', '--
|
38
|
-
opts[:
|
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
|
|
@@ -67,37 +76,86 @@ def gqrx_cmd(opts = {})
|
|
67
76
|
gqrx_sock.readline.chomp if does_respond
|
68
77
|
end
|
69
78
|
|
79
|
+
def init_freq(opts = {})
|
80
|
+
gqrx_sock = opts[:gqrx_sock]
|
81
|
+
this_freq = opts[:this_freq]
|
82
|
+
lock_on_freq_duration = opts[:lock_on_freq_duration]
|
83
|
+
strength = opts[:strength]
|
84
|
+
|
85
|
+
change_frreq_resp = gqrx_cmd(
|
86
|
+
gqrx_sock: gqrx_sock,
|
87
|
+
cmd: "F #{this_freq}"
|
88
|
+
)
|
89
|
+
raise "ERROR: Failed to set frequency to #{this_freq}" unless change_frreq_resp == 'RPRT 0'
|
90
|
+
|
91
|
+
raw_freq = gqrx_cmd(
|
92
|
+
gqrx_sock: gqrx_sock,
|
93
|
+
cmd: 'f'
|
94
|
+
)
|
95
|
+
|
96
|
+
# Split the response from NNNNNNNNN
|
97
|
+
# to NNN.NNN.NNN
|
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
|
125
|
+
end
|
126
|
+
|
70
127
|
def scan_range(opts = {})
|
71
128
|
gqrx_sock = opts[:gqrx_sock]
|
72
129
|
start_freq = opts[:start_freq]
|
73
130
|
target_freq = opts[:target_freq]
|
74
131
|
precision = opts[:precision]
|
75
|
-
|
76
|
-
|
132
|
+
lock_on_freq_duration = opts[:lock_on_freq_duration]
|
133
|
+
strength = opts[:strength]
|
77
134
|
|
135
|
+
multiplier = 10**(precision - 1)
|
78
136
|
if start_freq > target_freq
|
79
|
-
start_freq.downto(target_freq) do |
|
137
|
+
start_freq.downto(target_freq) do |this_freq|
|
80
138
|
next unless (i % multiplier).zero?
|
81
139
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
140
|
+
init_freq_hash = init_freq(
|
141
|
+
gqrx_sock: gqrx_sock,
|
142
|
+
this_freq: this_freq,
|
143
|
+
lock_on_freq_duration: lock_on_freq_duration,
|
144
|
+
strength: strength
|
145
|
+
)
|
146
|
+
puts init_freq_hash.to_json
|
89
147
|
end
|
90
148
|
else
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
149
|
+
this_freq = start_freq
|
150
|
+
while this_freq <= target_freq
|
151
|
+
init_freq_hash = init_freq(
|
152
|
+
gqrx_sock: gqrx_sock,
|
153
|
+
this_freq: this_freq,
|
154
|
+
lock_on_freq_duration: lock_on_freq_duration,
|
155
|
+
strength: strength
|
156
|
+
)
|
157
|
+
|
158
|
+
this_freq += multiplier
|
101
159
|
end
|
102
160
|
end
|
103
161
|
end
|
@@ -106,42 +164,52 @@ begin
|
|
106
164
|
pwn_provider = 'ruby-gem'
|
107
165
|
pwn_provider = ENV.fetch('PWN_PROVIDER') if ENV.keys.any? { |s| s == 'PWN_PROVIDER' }
|
108
166
|
|
109
|
-
|
110
|
-
|
111
|
-
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?
|
112
170
|
|
113
171
|
host = opts[:host] ||= '127.0.0.1'
|
114
172
|
port = opts[:port] ||= 7356
|
115
|
-
puts "Connecting to GQRX at #{host}:#{port}..."
|
116
173
|
|
174
|
+
puts "Connecting to GQRX at #{host}:#{port}..."
|
117
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
|
+
|
118
181
|
puts "Setting demodulator mode to #{demodulator_mode}..."
|
119
182
|
demod_resp = gqrx_cmd(gqrx_sock: gqrx_sock, cmd: "M #{demodulator_mode}")
|
120
|
-
|
183
|
+
raise "ERROR: Failed to set demodulator mode to #{demodulator_mode}" unless demod_resp == 'RPRT 0'
|
121
184
|
|
122
185
|
start_freq = opts[:start_freq]
|
123
186
|
start_freq = start_freq.to_s.delete('.').to_i unless start_freq.nil?
|
124
187
|
start_freq = gqrx_cmd(gqrx_sock: gqrx_sock, cmd: 'f').to_i if start_freq.nil?
|
125
188
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
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'
|
131
193
|
|
132
194
|
precision = opts[:precision] ||= 3
|
133
195
|
precision = precision.to_i
|
134
|
-
raise "ERROR: Invalid precision: #{precision}" unless (1..
|
196
|
+
raise "ERROR: Invalid precision: #{precision}" unless (1..12).include?(precision)
|
135
197
|
|
136
|
-
|
137
|
-
|
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}..."
|
138
205
|
|
139
206
|
scan_range(
|
140
207
|
gqrx_sock: gqrx_sock,
|
141
208
|
start_freq: start_freq,
|
142
209
|
target_freq: target_freq,
|
143
210
|
precision: precision,
|
144
|
-
|
211
|
+
lock_on_freq_duration: lock_on_freq_duration,
|
212
|
+
strength: strength
|
145
213
|
)
|
146
214
|
rescue SystemExit, Interrupt
|
147
215
|
puts "\nGoodbye."
|
data/lib/pwn/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pwn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.52
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 0day Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03-
|
11
|
+
date: 2024-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|