Land #5065: OJ fix missed merges for uri_checksum and others
commit
16cb334325
|
@ -1,8 +1,8 @@
|
||||||
# -*- coding: binary -*-
|
# -*- coding: binary -*-
|
||||||
require 'rex/io/stream_abstraction'
|
require 'rex/io/stream_abstraction'
|
||||||
require 'rex/sync/ref'
|
require 'rex/sync/ref'
|
||||||
require 'msf/core/handler/reverse_http/uri_checksum'
|
|
||||||
require 'rex/payloads/meterpreter/patch'
|
require 'rex/payloads/meterpreter/patch'
|
||||||
|
require 'rex/payloads/meterpreter/uri_checksum'
|
||||||
require 'rex/parser/x509_certificate'
|
require 'rex/parser/x509_certificate'
|
||||||
require 'msf/core/payload/windows/verify_ssl'
|
require 'msf/core/payload/windows/verify_ssl'
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ module Handler
|
||||||
module ReverseHttp
|
module ReverseHttp
|
||||||
|
|
||||||
include Msf::Handler
|
include Msf::Handler
|
||||||
include Msf::Handler::ReverseHttp::UriChecksum
|
include Rex::Payloads::Meterpreter::UriChecksum
|
||||||
include Msf::Payload::Windows::VerifySsl
|
include Msf::Payload::Windows::VerifySsl
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
require 'msf/core'
|
require 'msf/core'
|
||||||
require 'rex/parser/x509_certificate'
|
require 'rex/parser/x509_certificate'
|
||||||
|
require 'rex/payloads/meterpreter/uri_checksum'
|
||||||
|
|
||||||
module Msf
|
module Msf
|
||||||
|
|
||||||
|
@ -17,6 +18,7 @@ module Msf
|
||||||
module Handler::ReverseHttp::Stageless
|
module Handler::ReverseHttp::Stageless
|
||||||
|
|
||||||
include Msf::Payload::Windows::VerifySsl
|
include Msf::Payload::Windows::VerifySsl
|
||||||
|
include Rex::Payloads::Meterpreter::UriChecksum
|
||||||
|
|
||||||
def initialize_stageless
|
def initialize_stageless
|
||||||
register_options([
|
register_options([
|
||||||
|
@ -25,7 +27,7 @@ module Handler::ReverseHttp::Stageless
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_stageless(&block)
|
def generate_stageless(&block)
|
||||||
checksum = generate_uri_checksum(Handler::ReverseHttp::UriChecksum::URI_CHECKSUM_CONN)
|
checksum = generate_uri_checksum(URI_CHECKSUM_CONN)
|
||||||
rand = Rex::Text.rand_text_alphanumeric(16)
|
rand = Rex::Text.rand_text_alphanumeric(16)
|
||||||
url = "https://#{datastore['LHOST']}:#{datastore['LPORT']}/#{checksum}_#{rand}/"
|
url = "https://#{datastore['LHOST']}:#{datastore['LPORT']}/#{checksum}_#{rand}/"
|
||||||
|
|
||||||
|
|
|
@ -99,14 +99,14 @@ module Payload::Windows::ReverseHttp
|
||||||
raise ArgumentError, "Minimum StagerURILength is 5"
|
raise ArgumentError, "Minimum StagerURILength is 5"
|
||||||
end
|
end
|
||||||
|
|
||||||
"/" + generate_uri_checksum(Msf::Handler::ReverseHttp::URI_CHECKSUM_INITW, uri_req_len)
|
"/" + generate_uri_checksum(Rex::Payloads::Meterpreter::UriChecksum::URI_CHECKSUM_INITW, uri_req_len)
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Generate the URI for the initial stager
|
# Generate the URI for the initial stager
|
||||||
#
|
#
|
||||||
def generate_small_uri
|
def generate_small_uri
|
||||||
"/" + generate_uri_checksum(Msf::Handler::ReverseHttp::URI_CHECKSUM_INITW)
|
"/" + generate_uri_checksum(Rex::Payloads::Meterpreter::UriChecksum::URI_CHECKSUM_INITW)
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# -*- coding: binary -*-
|
# -*- coding: binary -*-
|
||||||
module Msf
|
module Rex
|
||||||
module Handler
|
module Payloads
|
||||||
module ReverseHttp
|
module Meterpreter
|
||||||
module UriChecksum
|
module UriChecksum
|
||||||
|
|
||||||
#
|
#
|
|
@ -54,7 +54,7 @@ module Metasploit3
|
||||||
c << "URL=http://#{datastore["LHOST"]}"
|
c << "URL=http://#{datastore["LHOST"]}"
|
||||||
c << ":#{datastore["LPORT"]}" if datastore["LPORT"]
|
c << ":#{datastore["LPORT"]}" if datastore["LPORT"]
|
||||||
c << "/"
|
c << "/"
|
||||||
c << generate_uri_checksum(Msf::Handler::ReverseHttp::URI_CHECKSUM_INITJ, uri_req_len)
|
c << generate_uri_checksum(Rex::Payloads::Meterpreter::UriChecksum::URI_CHECKSUM_INITJ, uri_req_len)
|
||||||
c << "\n"
|
c << "\n"
|
||||||
|
|
||||||
c
|
c
|
||||||
|
|
|
@ -56,7 +56,7 @@ module Metasploit3
|
||||||
c << "URL=https://#{datastore["LHOST"]}"
|
c << "URL=https://#{datastore["LHOST"]}"
|
||||||
c << ":#{datastore["LPORT"]}" if datastore["LPORT"]
|
c << ":#{datastore["LPORT"]}" if datastore["LPORT"]
|
||||||
c << "/"
|
c << "/"
|
||||||
c << generate_uri_checksum(Msf::Handler::ReverseHttp::URI_CHECKSUM_INITJ, uri_req_len)
|
c << generate_uri_checksum(Rex::Payloads::Meterpreter::UriChecksum::URI_CHECKSUM_INITJ, uri_req_len)
|
||||||
c << "\n"
|
c << "\n"
|
||||||
|
|
||||||
c
|
c
|
||||||
|
|
|
@ -106,7 +106,7 @@ module Metasploit3
|
||||||
uri_req_len = 5
|
uri_req_len = 5
|
||||||
end
|
end
|
||||||
|
|
||||||
generate_uri_checksum(Msf::Handler::ReverseHttp::URI_CHECKSUM_INITP, uri_req_len)
|
generate_uri_checksum(Rex::Payloads::Meterpreter::UriChecksum::URI_CHECKSUM_INITP, uri_req_len)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -120,7 +120,7 @@ module Metasploit3
|
||||||
uri_req_len = 5
|
uri_req_len = 5
|
||||||
end
|
end
|
||||||
|
|
||||||
generate_uri_checksum(Msf::Handler::ReverseHttp::URI_CHECKSUM_INITP, uri_req_len)
|
generate_uri_checksum(Rex::Payloads::Meterpreter::UriChecksum::URI_CHECKSUM_INITP, uri_req_len)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -99,7 +99,7 @@ module Metasploit3
|
||||||
def generate
|
def generate
|
||||||
p = super
|
p = super
|
||||||
i = p.index("/12345\x00")
|
i = p.index("/12345\x00")
|
||||||
u = "/" + generate_uri_checksum(Msf::Handler::ReverseHttp::URI_CHECKSUM_INITW) + "\x00"
|
u = "/" + generate_uri_checksum(Rex::Payloads::Meterpreter::UriChecksum::URI_CHECKSUM_INITW) + "\x00"
|
||||||
p[i, u.length] = u
|
p[i, u.length] = u
|
||||||
p + datastore['LHOST'].to_s + "\x00"
|
p + datastore['LHOST'].to_s + "\x00"
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
require 'msf/core'
|
require 'msf/core'
|
||||||
require 'msf/core/handler/reverse_https'
|
require 'msf/core/handler/reverse_https'
|
||||||
#require 'msf/core/payload/windows/x64/reverse_https'
|
|
||||||
|
|
||||||
module Metasploit3
|
module Metasploit3
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require 'msf/core/handler/reverse_http/uri_checksum'
|
require 'rex/payloads/meterpreter/uri_checksum'
|
||||||
|
|
||||||
describe Msf::Handler::ReverseHttp::UriChecksum do
|
describe Rex::Payloads::Meterpreter::UriChecksum do
|
||||||
class DummyClass
|
class DummyClass
|
||||||
include Msf::Handler::ReverseHttp::UriChecksum
|
include Rex::Payloads::Meterpreter::UriChecksum
|
||||||
end
|
end
|
||||||
|
|
||||||
subject(:dummy_object) { DummyClass.new }
|
subject(:dummy_object) { DummyClass.new }
|
||||||
|
@ -23,7 +23,7 @@ describe Msf::Handler::ReverseHttp::UriChecksum do
|
||||||
context 'when it fails to generate a random URI' do
|
context 'when it fails to generate a random URI' do
|
||||||
it 'should use the pre-calculated checksum string' do
|
it 'should use the pre-calculated checksum string' do
|
||||||
Rex::Text.stub(:checksum8) { false }
|
Rex::Text.stub(:checksum8) { false }
|
||||||
expect(dummy_object.generate_uri_checksum(checksum_value)).to eq Msf::Handler::ReverseHttp::UriChecksum::URI_CHECKSUM_PRECALC[checksum_value]
|
expect(dummy_object.generate_uri_checksum(checksum_value)).to eq Rex::Payloads::Meterpreter::UriChecksum::URI_CHECKSUM_PRECALC[checksum_value]
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
Loading…
Reference in New Issue