metasploit-framework/lib/msf/http/jboss/base.rb

44 lines
1.1 KiB
Ruby
Raw Normal View History

# -*- coding: binary -*-
module Msf::HTTP::JBoss::Base
# Call the specified uri to deploy the payload / stager
# @param opts [Hash] Hash of configuration options.
# @param num_attempts [Integer] The number of attempts
# @return [ClientRequest] or nil
2014-08-01 19:28:26 +00:00
def deploy(opts = {}, num_attempts = 5)
uri = opts['uri']
if uri.blank?
return nil
end
# JBoss might need some time for the deployment. Try 5 times at most and
# wait 5 seconds inbetween tries
num_attempts.times do |attempt|
2014-08-01 19:28:26 +00:00
res = send_request_cgi(opts, 5)
msg = nil
2014-08-01 19:28:26 +00:00
if res.nil?
msg = "Execution failed on #{uri} [No Response]"
2014-08-01 19:28:26 +00:00
elsif res.code < 200 || res.code >= 300
msg = "http request failed to #{uri} [#{res.code}]"
2014-08-01 19:28:26 +00:00
elsif res.code == 200
vprint_status("Successfully called '#{uri}'")
return res
end
2014-08-01 19:28:26 +00:00
if attempt < num_attempts - 1
msg << ", retrying in 5 seconds..."
vprint_status(msg)
Rex.sleep(5)
else
print_error(msg)
return res
end
end
end
2014-08-01 19:28:26 +00:00
def http_verb
datastore['VERB']
end
end