File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
lib/metasploit/framework/login_scanner Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -187,6 +187,40 @@ def check_setup
187
187
error_message
188
188
end
189
189
190
+ # Sends a HTTP request with Rex
191
+ #
192
+ # @param (see Rex::Proto::Http::Request#request_raw)
193
+ # @raise [Rex::ConnectionError] Something has gone wrong while sending the HTTP request
194
+ # @return [Rex::Proto::Http::Response] The HTTP response
195
+ def send_request ( opts )
196
+ res = nil
197
+ cli = Rex ::Proto ::Http ::Client . new ( host , port ,
198
+ {
199
+ 'Msf' => framework ,
200
+ 'MsfExploit' => framework_module
201
+ } ,
202
+ ssl ,
203
+ ssl_version ,
204
+ proxies
205
+ )
206
+ configure_http_client ( cli )
207
+ begin
208
+ cli . connect
209
+ req = cli . request_cgi ( opts )
210
+ res = cli . send_recv ( req )
211
+ rescue ::Errno ::EPIPE , ::Timeout ::Error => e
212
+ # We are trying to mimic the same type of exception rescuing in
213
+ # Msf::Exploit::Remote::HttpClient. But instead of returning nil, we'll consistently
214
+ # raise Rex::ConnectionError so the #attempt_login can return the error message back
215
+ # to the login module.
216
+ raise Rex ::ConnectionError , e . message
217
+ ensure
218
+ cli . close
219
+ end
220
+
221
+ res
222
+ end
223
+
190
224
# Attempt a single login with a single credential against the target.
191
225
#
192
226
# @param credential [Credential] The credential object to attempt to
You can’t perform that action at this time.
0 commit comments