pwn 0.5.154 → 0.5.155
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_sast +1 -1
- data/lib/pwn/plugins/ip_info.rb +11 -10
- data/lib/pwn/plugins/thread_pool.rb +41 -19
- 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: 750d1cd0053f38007697365f5dfbbbb8558623c4ba39230ace21d7ad85f37cad
|
4
|
+
data.tar.gz: e4d657864bb71497616619da64b73e2c2fa782ea11a3ade500cecea53cfae7a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0928635402765a9b79f4d324cc62efafcce43ff7ad5d7ccac30aa98ba34ead97cf3ff8a81b15e2a8faae3f5f59331f56e2c25837900110b3b8766854cad22962'
|
7
|
+
data.tar.gz: 1d48dcb220d837be65cd697e9e78e2cdf53a5f6e0a44365b39ccbfe4e0eacfaee576f9da301ac6b23f4cf4c3f93cd01cb7d3023166a5a674062f81b16cc9073e
|
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.155]:001 >>> PWN.help
|
41
41
|
```
|
42
42
|
|
43
43
|
[](https://youtu.be/G7iLUY4FzsI)
|
@@ -52,7 +52,7 @@ $ rvm use ruby-3.3.1@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.155]: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.1@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.155]: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_sast
CHANGED
data/lib/pwn/plugins/ip_info.rb
CHANGED
@@ -128,7 +128,7 @@ module PWN
|
|
128
128
|
# PWN::Plugins::IPInfo.bruteforce_subdomains(
|
129
129
|
# parent_domain: 'required - Parent Domain to brute force',
|
130
130
|
# dictionary: 'required - Dictionary to use for subdomain brute force',
|
131
|
-
# max_threads: 'optional - Maximum number of threads to use (default:
|
131
|
+
# max_threads: 'optional - Maximum number of threads to use (default: 9)',
|
132
132
|
# proxy: 'optional - use a proxy',
|
133
133
|
# tls_port: 'optional port to check cert for Domain Name (default: 443). Will not execute if proxy parameter is set.',
|
134
134
|
# results_file: 'optional - File to write results to (default: /tmp/parent_domain-timestamp-pwn_bruteforce_subdomains.txt)'
|
@@ -141,15 +141,14 @@ module PWN
|
|
141
141
|
dictionary = opts[:dictionary] ||= default_dictionary
|
142
142
|
raise "ERROR: Dictionary file not found: #{dictionary}" unless File.exist?(dictionary)
|
143
143
|
|
144
|
-
max_threads = opts[:max_threads]
|
145
|
-
max_threads = 8 unless max_threads.positive?
|
144
|
+
max_threads = opts[:max_threads]
|
146
145
|
|
147
146
|
proxy = opts[:proxy]
|
148
147
|
tls_port = opts[:tls_port]
|
149
148
|
timestamp = Time.now.strftime('%Y-%m-%d_%H.%M.%S')
|
150
149
|
results_file = opts[:results_file] ||= "/tmp/SUBS.#{parent_domain}-#{timestamp}-pwn_bruteforce_subdomains.txt"
|
151
150
|
|
152
|
-
File.write(results_file,
|
151
|
+
File.write(results_file, "[\n")
|
153
152
|
|
154
153
|
# Break up dictonary file into sublines and process each subline in a thread
|
155
154
|
dict_lines = File.readlines(dictionary).shuffle
|
@@ -158,17 +157,16 @@ module PWN
|
|
158
157
|
enumerable_array: dict_lines,
|
159
158
|
max_threads: max_threads
|
160
159
|
) do |subline|
|
160
|
+
print '.'
|
161
161
|
subdomain = subline.to_s.scrub.strip.chomp
|
162
162
|
target = parent_domain if subdomain.empty?
|
163
|
-
target = "#{subdomain}.#{parent_domain}"
|
163
|
+
target = "#{subdomain}.#{parent_domain}" unless subdomain.empty?
|
164
164
|
ip_info_resp = get(
|
165
165
|
target: target,
|
166
166
|
proxy: proxy,
|
167
167
|
tls_port: tls_port,
|
168
168
|
skip_api: true
|
169
169
|
)
|
170
|
-
puts "SUBD: #{target} RESP: #{ip_info_resp}" if ip_info_resp.empty?
|
171
|
-
puts "SUBD: #{target} RESP:\n#{ip_info_resp}" if ip_info_resp.any?
|
172
170
|
|
173
171
|
mutex.synchronize do
|
174
172
|
File.open(results_file, 'a') do |file|
|
@@ -185,8 +183,11 @@ module PWN
|
|
185
183
|
raise e
|
186
184
|
ensure
|
187
185
|
# Strip trailing comma and close JSON array
|
188
|
-
File.readlines(results_file)
|
189
|
-
|
186
|
+
final_results = File.readlines(results_file)
|
187
|
+
# Strip trailing comma from last line
|
188
|
+
last_line = final_results[-1][0..-2]
|
189
|
+
final_results[-1] = last_line
|
190
|
+
File.write(results_file, "#{final_results.join}\n]")
|
190
191
|
end
|
191
192
|
|
192
193
|
# Author(s):: 0day Inc. <support@0dayinc.com>
|
@@ -211,7 +212,7 @@ module PWN
|
|
211
212
|
#{self}.bruteforce_subdomains(
|
212
213
|
parent_domain: 'required - Parent Domain to brute force',
|
213
214
|
dictionary: 'required - Dictionary to use for subdomain brute force',
|
214
|
-
max_threads: 'optional - Maximum number of threads to use (default:
|
215
|
+
max_threads: 'optional - Maximum number of threads to use (default: 9)',
|
215
216
|
proxy: 'optional - use a proxy',
|
216
217
|
tls_port: 'optional port to check cert for Domain Name (default: 443). Will not execute if proxy parameter is set.',
|
217
218
|
results_file: 'optional - File to write results to (default: /tmp/parent_domain-timestamp-pwn_bruteforce_subdomains.txt)'
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'concurrent-ruby'
|
4
|
+
|
3
5
|
module PWN
|
4
6
|
module Plugins
|
5
7
|
# This plugin makes the creation of a thread pool much simpler.
|
@@ -27,34 +29,54 @@ module PWN
|
|
27
29
|
detach = opts[:detach] ||= false
|
28
30
|
|
29
31
|
puts "Initiating Thread Pool of #{max_threads} Worker Threads...."
|
30
|
-
|
31
|
-
threads = Array.new(max_threads) do
|
32
|
-
Thread.new do
|
33
|
-
until (this_thread = queue.pop) == :POOL_EXHAUSTED
|
34
|
-
yield this_thread
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
enumerable_array.uniq.sort.each do |this_thread|
|
40
|
-
queue << this_thread
|
41
|
-
end
|
32
|
+
pool = Concurrent::FixedThreadPool.new(max_threads)
|
42
33
|
|
43
|
-
|
44
|
-
|
34
|
+
enumerable_array.each do |this_thread|
|
35
|
+
pool.post do
|
36
|
+
yield this_thread
|
37
|
+
end
|
45
38
|
end
|
46
39
|
|
47
|
-
|
48
|
-
|
49
|
-
else
|
50
|
-
threads.each(&:join)
|
51
|
-
end
|
40
|
+
pool.shutdown
|
41
|
+
pool.wait_for_termination unless detach
|
52
42
|
rescue Interrupt
|
53
43
|
puts "\nGoodbye."
|
54
44
|
rescue StandardError => e
|
45
|
+
puts e.backtrace
|
55
46
|
raise e
|
56
47
|
end
|
57
48
|
|
49
|
+
# public_class_method def self.fill(opts = {})
|
50
|
+
# enumerable_array = opts[:enumerable_array]
|
51
|
+
# max_threads = opts[:max_threads].to_i
|
52
|
+
# max_threads = 9 if max_threads.zero?
|
53
|
+
# detach = opts[:detach] ||= false
|
54
|
+
|
55
|
+
# puts "Initiating Thread Pool of #{max_threads} Worker Threads...."
|
56
|
+
# queue = SizedQueue.new(max_threads)
|
57
|
+
# threads = Array.new(max_threads) do
|
58
|
+
# Thread.new do
|
59
|
+
# until (this_thread = queue.pop) == :POOL_EXHAUSTED
|
60
|
+
# yield this_thread
|
61
|
+
# end
|
62
|
+
# end
|
63
|
+
# end
|
64
|
+
|
65
|
+
# enumerable_array.uniq.each do |this_thread|
|
66
|
+
# queue << this_thread
|
67
|
+
# end
|
68
|
+
|
69
|
+
# max_threads.times do
|
70
|
+
# queue << :POOL_EXHAUSTED
|
71
|
+
# end
|
72
|
+
|
73
|
+
# threads.each(&:join) unless detach
|
74
|
+
# rescue Interrupt
|
75
|
+
# puts "\nGoodbye."
|
76
|
+
# rescue StandardError => e
|
77
|
+
# raise e
|
78
|
+
# end
|
79
|
+
|
58
80
|
# Author(s):: 0day Inc. <support@0dayinc.com>
|
59
81
|
|
60
82
|
public_class_method def self.authors
|
data/lib/pwn/version.rb
CHANGED