pwn 0.5.47 → 0.5.50

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: 910719a42741cc9b2eff2806e8a8194876bdd7b221233011fc2f9fa4e257f553
4
- data.tar.gz: 07ba7fd748c10f2f429e486843351244b1e2b9e06a8e520604a172a6f5887d7f
3
+ metadata.gz: 154afb0d351151e4fa856779ea706f70e4032e8dd0efb4f469c8c2ac6fdf073a
4
+ data.tar.gz: 2ee1306939c069af7a6784c23593c2734e2f675d92856e06d2f1bdc4f3bc7195
5
5
  SHA512:
6
- metadata.gz: 1c632a95588955c41d2bbf60870fd747ba6398c59fcfe7f0e7782ed1d41818ca64022525fadc255d879c50f9d04d5a43254693373cc870603c2a48659773a052
7
- data.tar.gz: b8c3569b0b95cd3f8317e51adc6989a2d9fa5ff24a32e3ff0d5fe36f362ee22f011f9c435d3120e7ad7a79000e64f8bed00de4b8455ec663f8b461fa595b1c6f
6
+ metadata.gz: 4707bb48b5e013cb085df46675aacc9c0288013d1d5900bd81235a78a1d2bd7d1ac23719ed1d7107abbc25dc4cb2d69521a0abfe2d895d9dd2bcf7a36147d298
7
+ data.tar.gz: 5524ea205fc1486c79a3e575404abd58c8f458e8291528b5c4d8dc8f375f05b2486dfcad12c4f8839e147de2ca40eacf54a581709284cefc9c259b3ec4e3d783
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.47]:001 >>> PWN.help
40
+ pwn[v0.5.50]: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.47]:001 >>> PWN.help
55
+ pwn[v0.5.50]: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.47]:001 >>> PWN.help
65
+ pwn[v0.5.50]: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
@@ -10,8 +10,8 @@ OptionParser.new do |options|
10
10
  #{$PROGRAM_NAME} [opts]
11
11
  "
12
12
 
13
- options.on('-tFREQ', '--target-freq=FREQ', '<Required - Frequency to Conclude Scanning (e.g. 900000000 == 900 mHz>') do |s|
14
- opts[:start_freq] = s
13
+ options.on('-tFREQ', '--target-freq=FREQ', '<Required - Frequency to Conclude Scanning (e.g. 900000000 == 900 mHz>') do |e|
14
+ opts[:target_freq] = e
15
15
  end
16
16
 
17
17
  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|
@@ -29,6 +29,14 @@ OptionParser.new do |options|
29
29
  options.on('-pPORT', '--port=PORT', '<Optional - GQRX Port (Defaults to 7356)>') do |p|
30
30
  opts[:port] = p
31
31
  end
32
+
33
+ options.on('-PPLACE', '--precision=PLACE', '<Optional - Precision of Frequency 1-9 (Defaults to 3)>') do |p|
34
+ opts[:precision] = p
35
+ end
36
+
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
39
+ end
32
40
  end.parse!
33
41
 
34
42
  if opts.empty?
@@ -59,45 +67,82 @@ def gqrx_cmd(opts = {})
59
67
  gqrx_sock.readline.chomp if does_respond
60
68
  end
61
69
 
70
+ def scan_range(opts = {})
71
+ gqrx_sock = opts[:gqrx_sock]
72
+ start_freq = opts[:start_freq]
73
+ target_freq = opts[:target_freq]
74
+ precision = opts[:precision]
75
+ multiplier = 10**(precision - 1)
76
+ sleep_between_hops = opts[:sleep_between_hops]
77
+
78
+ if start_freq > target_freq
79
+ start_freq.downto(target_freq) do |i|
80
+ next unless (i % multiplier).zero?
81
+
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
89
+ end
90
+ 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
101
+ end
102
+ end
103
+ end
104
+
62
105
  begin
63
106
  pwn_provider = 'ruby-gem'
64
107
  pwn_provider = ENV.fetch('PWN_PROVIDER') if ENV.keys.any? { |s| s == 'PWN_PROVIDER' }
65
108
 
66
109
  demodulator_mode = opts[:demodulator_mode] ||= 'AM'
110
+ demodulator_mode.upcase!
67
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)
68
112
 
113
+ host = opts[:host] ||= '127.0.0.1'
114
+ port = opts[:port] ||= 7356
115
+ puts "Connecting to GQRX at #{host}:#{port}..."
116
+
117
+ gqrx_sock = PWN::Plugins::Sock.connect(target: host, port: port)
69
118
  puts "Setting demodulator mode to #{demodulator_mode}..."
70
119
  demod_resp = gqrx_cmd(gqrx_sock: gqrx_sock, cmd: "M #{demodulator_mode}")
71
120
  puts demod_resp
72
121
 
73
- start_freq = opts[:start_freq].to_i
74
- start_freq = gqrx_cmd(gqrx_sock: gqrx_sock, cmd: 'f').to_i if start_freq.zero?
122
+ start_freq = opts[:start_freq]
123
+ start_freq = start_freq.to_s.delete('.').to_i unless start_freq.nil?
124
+ start_freq = gqrx_cmd(gqrx_sock: gqrx_sock, cmd: 'f').to_i if start_freq.nil?
75
125
 
76
- end_freq = opts[:end_freq].to_i
77
- raise 'ERROR: Invalid end frequency' if end_freq.zero?
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?
78
129
 
79
- puts "Scanning from #{start_freq} to #{end_freq}..."
130
+ puts "Scanning from #{start_freq} to #{target_freq}..."
80
131
 
81
- host = opts[:host] ||= '127.0.0.1'
82
- port = opts[:port] ||= 7356
83
- puts "Connecting to GQRX at #{host}:#{port}..."
132
+ precision = opts[:precision] ||= 3
133
+ precision = precision.to_i
134
+ raise "ERROR: Invalid precision: #{precision}" unless (1..9).include?(precision)
84
135
 
85
- gqrx_sock = PWN::Plugins::Sock.connect(target: host, port: port)
86
- # If start value is greater than end value, go in reverse
87
- if start_freq > end_freq
88
- end_freq.downto(start_freq) do |freq|
89
- gqrx_cmd(gqrx_sock: gqrx_sock, cmd: "F #{freq}")
90
- resp = gqrx_cmd(gqrx_sock: gqrx_sock, cmd: 'f')
91
- puts "Reached #{resp}..."
92
- end
93
- else
94
- (start_freq..end_freq).each do |freq|
95
- puts "Scanning #{freq}..."
96
- gqrx_cmd(gqrx_sock: gqrx_sock, cmd: "F #{freq}")
97
- resp = gqrx_cmd(gqrx_sock: gqrx_sock, cmd: 'f')
98
- puts "Reached #{resp}..."
99
- end
100
- end
136
+ sleep_between_hops = opts[:sleep_between_hops] ||= 0
137
+ sleep_between_hops = sleep_between_hops.to_f
138
+
139
+ scan_range(
140
+ gqrx_sock: gqrx_sock,
141
+ start_freq: start_freq,
142
+ target_freq: target_freq,
143
+ precision: precision,
144
+ sleep_between_hops: sleep_between_hops
145
+ )
101
146
  rescue SystemExit, Interrupt
102
147
  puts "\nGoodbye."
103
148
  ensure
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.47'
4
+ VERSION = '0.5.50'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pwn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.47
4
+ version: 0.5.50
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.