pwn 0.4.545 → 0.4.546

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: a482ad2be090b5fc318d1048fd48f6936906ec7f50ec3e5732c7fbda412f17e0
4
- data.tar.gz: 8a5d6ad28f6e45bbcbffe34e29a3f558f142b054c46360a0ebabf3dd8b66b7c0
3
+ metadata.gz: fb5cb201bcb76d6d206fb20e15fe749eb46837aea978fe0480c172a7926ac034
4
+ data.tar.gz: 7e9e2b80e4762619251c1be2d4cf844c0849f1e71ad5b11e90736324884072a6
5
5
  SHA512:
6
- metadata.gz: 3557a95e19c60f023ef6099c58351cee88c3e98f675de6c8e3806e360a7c0eeb4a26fcd0b44a6d306829d8460ba604e6b303e1593a6d26c923ea89e60cc1be69
7
- data.tar.gz: 1a58439197b28adecbfd79a67922bd39a655df2f6cc1d2a83508c7c47a58bdb77251619ba3bb702f6827c4bd146246d8e2ff9f949b970851748a112f36982660
6
+ metadata.gz: 06b1809a5b8f8a106c5bf84cda440a3a6943b900c417a6f6994b93727b5314fae5bb89d40a4983307606d853223fdb1b09cc464d54ea12aa5068d70c1bd21a3d
7
+ data.tar.gz: 36eea59775283c86e6ceda33860ff75c6486a9ed2c0314c632804661d791e6467e00414ae473e275510eb6bc5f3d1554f542273f2594f180fd7adb6eea829f56
data/README.md CHANGED
@@ -37,7 +37,7 @@ $ rvm use ruby-3.1.2@pwn
37
37
  $ rvm list gemsets
38
38
  $ gem install --verbose pwn
39
39
  $ pwn
40
- pwn[v0.4.545]:001 >>> PWN.help
40
+ pwn[v0.4.546]: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.1.2@pwn
52
52
  $ gem uninstall --all --executables pwn
53
53
  $ gem install --verbose pwn
54
54
  $ pwn
55
- pwn[v0.4.545]:001 >>> PWN.help
55
+ pwn[v0.4.546]:001 >>> PWN.help
56
56
  ```
57
57
 
58
58
 
@@ -51,6 +51,76 @@ if opts.empty?
51
51
  exit 1
52
52
  end
53
53
 
54
+ def request_path(opts = {})
55
+ target_url = opts[:target_url]
56
+ proxy = opts[:proxy]
57
+ wordlist_line = opts[:wordlist_line]
58
+
59
+ http_methods = %i[DELETE GET HEAD OPTIONS PATCH POST PUT TRACE]
60
+ http_methods.each do |http_method|
61
+ begin
62
+ print '.'
63
+ http_uri = "#{target_url}/#{wordlist_line}"
64
+ rest_client_resp_hash = {}
65
+ if proxy
66
+ rest_client = PWN::Plugins::TransparentBrowser.open(
67
+ browser_type: :rest,
68
+ proxy: proxy
69
+ )::Request
70
+ else
71
+ rest_client = PWN::Plugins::TransparentBrowser.open(
72
+ browser_type: :rest
73
+ )::Request
74
+ end
75
+
76
+ headers = nil
77
+ if http_request_headers
78
+ headers = JSON.parse(
79
+ http_request_headers,
80
+ symbolize_names: true
81
+ )
82
+ end
83
+
84
+ response = rest_client.execute(
85
+ method: http_method,
86
+ url: http_uri,
87
+ headers: headers,
88
+ verify_ssl: false
89
+ )
90
+
91
+ rest_client_resp_hash = {
92
+ request_timestamp: Time.now.strftime('%Y-%m-%d_%H-%M-%S'),
93
+ http_uri: http_uri,
94
+ http_method: http_method,
95
+ http_resp_code: response.code,
96
+ http_resp_length: response.body.length,
97
+ http_resp: "#{response.body[0..300]}..."
98
+ }
99
+ rescue RestClient::ExceptionWithResponse,
100
+ RestClient::ServerBrokeConnection => e
101
+ rest_client_resp_hash = {
102
+ request_timestamp: Time.now.strftime('%Y-%m-%d_%H-%M-%S'),
103
+ http_uri: http_uri,
104
+ http_method: http_method,
105
+ http_resp_code: e.response.code,
106
+ http_resp_length: e.response.body.length,
107
+ http_resp: "#{e.response.body[0..300]}..."
108
+ }
109
+ next
110
+ rescue URI::InvalidURIError
111
+ url_encoded_wordlist_arr = []
112
+ wordlist_line.split('/').each do |path|
113
+ url_encoded_wordlist_arr.push(CGI.escape(path))
114
+ end
115
+ wordlist_line = url_encoded_wordlist_arr.join('/')
116
+
117
+ retry
118
+ rescue RestClient::TooManyRequests
119
+ sleep 60
120
+ end
121
+ end
122
+ end
123
+
54
124
  begin
55
125
  pwn_provider = ENV.fetch('PWN_PROVIDER') if ENV.fetch('PWN_PROVIDER')
56
126
  $stdout.sync = true
@@ -94,73 +164,15 @@ begin
94
164
 
95
165
  next if wordlist_line.match?(/^#/)
96
166
 
97
- # http_methods = %i[CONNECT DELETE GET HEAD OPTIONS PATCH POST PUT TRACE]
98
- http_methods = %i[DELETE GET HEAD OPTIONS PATCH POST PUT TRACE]
99
- http_methods.each do |http_method|
100
- begin
101
- print '.'
102
- http_uri = "#{target_url}/#{wordlist_line}"
103
- rest_client_resp_hash = {}
104
- if proxy
105
- rest_client = PWN::Plugins::TransparentBrowser.open(
106
- browser_type: :rest,
107
- proxy: proxy
108
- )::Request
109
- else
110
- rest_client = PWN::Plugins::TransparentBrowser.open(
111
- browser_type: :rest
112
- )::Request
113
- end
114
-
115
- headers = nil
116
- if http_request_headers
117
- headers = JSON.parse(
118
- http_request_headers,
119
- symbolize_names: true
120
- )
121
- end
122
-
123
- response = rest_client.execute(
124
- method: http_method,
125
- url: http_uri,
126
- headers: headers,
127
- verify_ssl: false
128
- )
167
+ rest_client_resp_hash = request_path(
168
+ target_url: target_url,
169
+ http_request_headers: http_request_headers,
170
+ proxy: proxy,
171
+ wordlist_line: wordlist_line
172
+ )
129
173
 
130
- rest_client_resp_hash = {
131
- request_timestamp: Time.now.strftime('%Y-%m-%d_%H-%M-%S'),
132
- http_uri: http_uri,
133
- http_method: http_method,
134
- http_resp_code: response.code,
135
- http_resp_length: response.body.length,
136
- http_resp: "#{response.body[0..300]}..."
137
- }
138
- rescue RestClient::ExceptionWithResponse,
139
- RestClient::ServerBrokeConnection => e
140
- rest_client_resp_hash = {
141
- request_timestamp: Time.now.strftime('%Y-%m-%d_%H-%M-%S'),
142
- http_uri: http_uri,
143
- http_method: http_method,
144
- http_resp_code: e.response.code,
145
- http_resp_length: e.response.body.length,
146
- http_resp: "#{e.response.body[0..300]}..."
147
- }
148
- next
149
- rescue URI::InvalidURIError
150
- url_encoded_wordlist_arr = []
151
- wordlist_line.split('/').each do |path|
152
- url_encoded_wordlist_arr.push(CGI.escape(path))
153
- end
154
- wordlist_line = url_encoded_wordlist_arr.join('/')
155
-
156
- retry
157
- rescue RestClient::TooManyRequests
158
- sleep 60
159
- ensure
160
- mutex.synchronize do
161
- results_hash[:data].push(rest_client_resp_hash)
162
- end
163
- end
174
+ mutex.synchronize do
175
+ results_hash[:data].push(rest_client_resp_hash)
164
176
  end
165
177
  end
166
178
 
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.4.545'
4
+ VERSION = '0.4.546'
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.4.545
4
+ version: 0.4.546
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-26 00:00:00.000000000 Z
11
+ date: 2022-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport