Adjustments for POSIX meterpreter patching

bug/bundler_fix
OJ 2015-04-17 19:53:05 +10:00
parent eb7155d533
commit 97912882ca
2 changed files with 18 additions and 3 deletions

View File

@ -659,7 +659,7 @@ class ClientCore < Extension
# This should be done by the reflective loader payloads
#else
# # Just patch the timeouts, which are consistent on each of the payloads.
# Rex::Payloads::Meterpreter::Patch.patch_passive_service!(blob,
# Rex::Payloads::Meterpreter::Patch.patch_timeouts!(blob,
# :expiration => self.client.expiration,
# :comm_timeout => self.client.comm_timeout,
# :retry_total => self.client.retry_total,
@ -675,6 +675,12 @@ class ClientCore < Extension
f.read(f.stat.size)
}
Rex::Payloads::Meterpreter::Patch.patch_timeouts!(blob,
:expiration => self.client.expiration,
:comm_timeout => self.client.comm_timeout,
:retry_total => self.client.retry_total,
:retry_wait => self.client.retry_wait)
blob
end

View File

@ -8,6 +8,9 @@ require 'msf/base/sessions/meterpreter_x86_linux'
require 'msf/base/sessions/meterpreter_options'
require 'rex/elfparsey'
# Provides methods to patch options into the metsrv stager.
require 'rex/payloads/meterpreter/patch'
module Metasploit3
include Msf::Sessions::MeterpreterOptions
@ -100,10 +103,16 @@ module Metasploit3
#file = File.join(Msf::Config.data_directory, "msflinker_linux_x86.elf")
file = File.join(Msf::Config.data_directory, "meterpreter", "msflinker_linux_x86.bin")
met = File.open(file, "rb") {|f|
blob = File.open(file, "rb") {|f|
f.read(f.stat.size)
}
return met
Rex::Payloads::Meterpreter::Patch.patch_timeouts!(blob,
:expiration => datastore['SessionExpirationTimeout'].to_i,
:comm_timeout => datastore['SessionCommunicationTimeout'].to_i,
:retry_total => datastore['SessionRetryTotal'].to_i,
:retry_wait => datastore['SessionRetryWait'].to_i)
return blob
end
end