Updates to encode_shellcode_stub

git-svn-id: file:///home/svn/framework3/trunk@7842 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2009-12-13 19:43:17 +00:00
parent 40fb409343
commit 89da53d570
1 changed files with 8 additions and 4 deletions

View File

@ -444,10 +444,14 @@ class Exploit < Msf::Module
# Allows arbitrary shellcode to be encoded from within an exploit
#
def encode_shellcode_stub(code, badchars=payload_badchars)
framework.encoders.each_module_ranked('Arch' => self.arch) do |name, mod|
platform = self.platform
if(self.payload_instance)
self.payload_instance.explicit_platform
end
compatible_encoders.each do |name, mod|
begin
enc = framework.encoders.create(name)
raw = enc.encode(code, badchars, nil, self.payload_instance.explicit_platform)
raw = enc.encode(code, badchars, nil, platform)
return raw if raw
rescue ::Exception
end
@ -700,7 +704,7 @@ class Exploit < Msf::Module
c_arch = (target and target.arch) ? target.arch : (arch == []) ? nil : arch
c_arch ||= [ ARCH_X86 ]
framework.payloads.each_module(
framework.payloads.each_module_ranked(
'Platform' => c_platform,
'Arch' => c_arch ) { |name, mod|
@ -737,7 +741,7 @@ class Exploit < Msf::Module
c_platform = (target and target.platform) ? target.platform : platform
c_arch = (target and target.arch) ? target.arch : (arch == []) ? nil : arch
framework.encoders.each_module(
framework.encoders.each_module_ranked(
'Arch' => c_arch) { |name, mod|
encoders << [ name, mod ]