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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 154afb0d351151e4fa856779ea706f70e4032e8dd0efb4f469c8c2ac6fdf073a
4
- data.tar.gz: 2ee1306939c069af7a6784c23593c2734e2f675d92856e06d2f1bdc4f3bc7195
3
+ metadata.gz: 0f9d1c877c0b0d4a074cff09b2b7f8c1fcb4dbb741f0477f8ae200bad601b68c
4
+ data.tar.gz: 2a92813b9ca894105d89bc468c1cd8c45ab1b11393f7fffea6c6c1ff23ba46e7
5
5
  SHA512:
6
- metadata.gz: 4707bb48b5e013cb085df46675aacc9c0288013d1d5900bd81235a78a1d2bd7d1ac23719ed1d7107abbc25dc4cb2d69521a0abfe2d895d9dd2bcf7a36147d298
7
- data.tar.gz: 5524ea205fc1486c79a3e575404abd58c8f458e8291528b5c4d8dc8f375f05b2486dfcad12c4f8839e147de2ca40eacf54a581709284cefc9c259b3ec4e3d783
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.50]:001 >>> PWN.help
40
+ pwn[v0.5.52]:001 >>> PWN.help
41
41
  ```
42
42
 
43
43
  [![Installing the pwn Security Automation Framework](https://raw.githubusercontent.com/0dayInc/pwn/master/documentation/pwn_install.png)](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.50]:001 >>> PWN.help
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.50]:001 >>> PWN.help
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('-hHOST', '--host=HOST', '<Optional - GQRX Host (Defaults to 127.0.0.1)>') do |h|
26
- opts[:host] = h
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('-pPORT', '--port=PORT', '<Optional - GQRX Port (Defaults to 7356)>') do |p|
30
- opts[:port] = p
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('-PPLACE', '--precision=PLACE', '<Optional - Precision of Frequency 1-9 (Defaults to 3)>') do |p|
34
- opts[:precision] = p
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', '--sleep-between-hops=FLOAT', '<Optional - Float to Sleep Between Hops (Defaults to 0)>') do |s|
38
- opts[:sleep_between_hops] = s
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
- multiplier = 10**(precision - 1)
76
- sleep_between_hops = opts[:sleep_between_hops]
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 |i|
137
+ start_freq.downto(target_freq) do |this_freq|
80
138
  next unless (i % multiplier).zero?
81
139
 
82
- this_freq = i
83
- gqrx_cmd(gqrx_sock: gqrx_sock, cmd: "F #{this_freq}")
84
- resp = gqrx_cmd(gqrx_sock: gqrx_sock, cmd: 'f')
85
- # Split the response from NNNNNNNNN to NNN.NNN.NNN
86
- this_freq = resp.to_s.chars.insert(-4, '.').insert(-8, '.').join
87
- puts ">>> #{this_freq}"
88
- sleep sleep_between_hops
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
- while start_freq <= target_freq
92
- this_freq = start_freq
93
- gqrx_cmd(gqrx_sock: gqrx_sock, cmd: "F #{this_freq}")
94
- resp = gqrx_cmd(gqrx_sock: gqrx_sock, cmd: 'f')
95
- # Split the response from NNNNNNNNN to NNN.NNN.NNN
96
- this_freq = resp.to_s.chars.insert(-4, '.').insert(-8, '.').join
97
- puts ">>> #{this_freq}"
98
- sleep sleep_between_hops
99
-
100
- start_freq += multiplier
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
- demodulator_mode = opts[:demodulator_mode] ||= 'AM'
110
- demodulator_mode.upcase!
111
- 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)
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
- puts demod_resp
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
- target_freq = opts[:target_freq]
127
- target_freq = target_freq.to_s.delete('.').to_i unless target_freq.nil?
128
- raise 'ERROR: Invalid end frequency' if target_freq.nil?
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..9).include?(precision)
196
+ raise "ERROR: Invalid precision: #{precision}" unless (1..12).include?(precision)
135
197
 
136
- sleep_between_hops = opts[:sleep_between_hops] ||= 0
137
- sleep_between_hops = sleep_between_hops.to_f
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
- sleep_between_hops: sleep_between_hops
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PWN
4
- VERSION = '0.5.50'
4
+ VERSION = '0.5.52'
5
5
  end
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.50
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-14 00:00:00.000000000 Z
11
+ date: 2024-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport