pwn 0.5.46 → 0.5.49

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a7184b7779835838904c456d596a269bdbcfc16ef1decfc74b1647b919a2a994
4
- data.tar.gz: 619117c61e14f580ded62296cad6ffaaba0c929fb30341a1476eb0b08fa24aae
3
+ metadata.gz: 762e3e9a589e677f3d31eed1bb5cf88d6fab392788bb8de661c97c456fab0e0f
4
+ data.tar.gz: 92ea685fb1fe3e1b324ef1e335712ed2893925b38f3c439f323c500173f98d84
5
5
  SHA512:
6
- metadata.gz: e5dd45352701c3610f8dadccd03dff9ac894a1c2c8a1347f92560d5066b919d660e30efca60bd693c043f31a1b8b787b1a21027338094465f6871ed5d8e95e46
7
- data.tar.gz: f23b45f291a86fd85a1f095a926c670ebc1ee00dc1464f995b06076b3bb3d44d7ec95d0807329af2b2a23e515b8554f2f08111cab663d8310720caf1ae51a20b
6
+ metadata.gz: de71a313a7d068ad6ca1f004c72d1a94ecdb81baec5bdd485010ba605d4c7b065a98e9df1bdb52775a08982627291ddd728720589c84274ad846af77a9e208c5
7
+ data.tar.gz: 73279b4428584ef92547dcb2661e4ead52957066addae20381260cc4f8c804029c6b42c969f063a1ea3137aafe63d561bb3c48e24da72fcb9b54218b2fa0f766
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.46]:001 >>> PWN.help
40
+ pwn[v0.5.49]: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.46]:001 >>> PWN.help
55
+ pwn[v0.5.49]: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.46]:001 >>> PWN.help
65
+ pwn[v0.5.49]: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,11 +10,15 @@ OptionParser.new do |options|
10
10
  #{$PROGRAM_NAME} [opts]
11
11
  "
12
12
 
13
- options.on('-sFREQ', '--start-freq=FREQ', '<Optional - Frequency to Set when Scanning Begins (Defaults to last known frequency)>') 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
+ end
16
+
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|
18
+ opts[:demodulator_mode] = d
15
19
  end
16
20
 
17
- options.on('-tFREQ', '--target-freq=FREQ', '<Required - Frequency to Conclude Scanning (e.g. 900000000 == 900 mHz>') do |s|
21
+ options.on('-sFREQ', '--start-freq=FREQ', '<Optional - Frequency to Set when Scanning Begins (Defaults to last known frequency)>') do |s|
18
22
  opts[:start_freq] = s
19
23
  end
20
24
 
@@ -25,6 +29,14 @@ OptionParser.new do |options|
25
29
  options.on('-pPORT', '--port=PORT', '<Optional - GQRX Port (Defaults to 7356)>') do |p|
26
30
  opts[:port] = p
27
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 - Time to Sleep Between Hops (Defaults to 0.01)>') do |s|
38
+ opts[:sleep_between_hops] = s
39
+ end
28
40
  end.parse!
29
41
 
30
42
  if opts.empty?
@@ -32,44 +44,108 @@ if opts.empty?
32
44
  exit 1
33
45
  end
34
46
 
35
- def jump_to_freq(opts = {})
47
+ def gqrx_cmd(opts = {})
48
+ # f - Get frequency [Hz]
49
+ # F - Set frequency [Hz]
50
+ # m - Get demodulator mode
51
+ # M - Set demodulator mode (OFF, RAW, AM, FM, WFM, WFM_ST,
52
+ # WFM_ST_OIRT, LSB, USB, CW, CWL, CWU)
53
+ # l STRENGTH - Get signal strength [dBFS]
54
+ # l SQL - Get squelch threshold [dBFS]
55
+ # L SQL <sql> - Set squelch threshold to <sql> [dBFS]
56
+ # u RECORD - Get status of audio recorder
57
+ # U RECORD <status> - Set status of audio recorder to <status>
58
+ # c - Close connection
59
+ # AOS - Acquisition of signal (AOS) event, start audio recording
60
+ # LOS - Loss of signal (LOS) event, stop audio recording
61
+ # \dump_state - Dump state (only usable for compatibility)
36
62
  gqrx_sock = opts[:gqrx_sock]
37
- freq = opts[:freq]
63
+ cmd = opts[:cmd]
38
64
 
39
- gqrx_sock.write("F #{freq}\n")
65
+ gqrx_sock.write("#{cmd}\n")
40
66
  does_respond = gqrx_sock.wait_readable
41
- gqrx_sock.readline.chomp
67
+ gqrx_sock.readline.chomp if does_respond
68
+ end
42
69
 
43
- gqrx_sock.write("f\n")
44
- does_respond = gqrx_sock.wait_readable
45
- reached_freq = gqrx_sock.readline.chomp
46
- puts "Reached #{reached_freq}..."
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
47
103
  end
48
104
 
49
105
  begin
50
106
  pwn_provider = 'ruby-gem'
51
- # pwn_provider = ENV.fetch('PWN_PROVIDER') if ENV.keys.select { |s| s == 'PWN_PROVIDER' }.any?
52
107
  pwn_provider = ENV.fetch('PWN_PROVIDER') if ENV.keys.any? { |s| s == 'PWN_PROVIDER' }
53
108
 
54
- start_freq = opts[:start_freq].to_i
55
- end_freq = opts[:end_freq].to_i
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)
112
+
56
113
  host = opts[:host] ||= '127.0.0.1'
57
114
  port = opts[:port] ||= 7356
115
+ puts "Connecting to GQRX at #{host}:#{port}..."
58
116
 
59
117
  gqrx_sock = PWN::Plugins::Sock.connect(target: host, port: port)
60
- # If start value is greater than end value, go in reverse
61
- if start_freq > end_freq
62
- end_freq.downto(start_freq) do |freq|
63
- jump_to_freq(gqrx_sock: gqrx_sock, freq: freq)
64
- end
65
- else
66
- (start_freq..end_freq).each do |freq|
67
- puts "Scanning #{freq}..."
68
- jump_to_freq(gqrx_sock: gqrx_sock, freq: freq)
69
- end
70
- end
118
+ puts "Setting demodulator mode to #{demodulator_mode}..."
119
+ demod_resp = gqrx_cmd(gqrx_sock: gqrx_sock, cmd: "M #{demodulator_mode}")
120
+ puts demod_resp
121
+
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?
125
+
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}..."
131
+
132
+ precision = opts[:precision] ||= 3
133
+ precision = precision.to_i
134
+ raise "ERROR: Invalid precision: #{precision}" unless (1..9).include?(precision)
135
+
136
+ sleep_between_hops = opts[:sleep_between_hops] ||= 0.01
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
+ )
71
146
  rescue SystemExit, Interrupt
72
147
  puts "\nGoodbye."
73
148
  ensure
149
+ resp = gqrx_cmd(gqrx_sock: gqrx_sock, cmd: 'c')
74
150
  gqrx_sock = PWN::Plugins::Sock.disconnect(sock_obj: gqrx_sock)
75
151
  end
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.46'
4
+ VERSION = '0.5.49'
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.46
4
+ version: 0.5.49
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.