Add new code template

bug/bundler_fix
jvazquez-r7 2015-06-08 09:46:04 -05:00
parent a39539f8ef
commit e72f705298
No known key found for this signature in database
GPG Key ID: 38D99152B9352D83
1 changed files with 19 additions and 1 deletions

View File

@ -31,6 +31,7 @@ class Metasploit3 < Msf::Encoder::Alphanum
# being encoded.
#
def decoder_stub(state)
modified_registers = []
reg = datastore['BufferRegister']
off = (datastore['BufferOffset'] || 0).to_i
buf = ''
@ -52,7 +53,14 @@ class Metasploit3 < Msf::Encoder::Alphanum
reg.upcase!
end
buf + Rex::Encoder::Alpha2::AlphaMixed::gen_decoder(reg, off)
stub = buf + Rex::Encoder::Alpha2::AlphaMixed::gen_decoder(reg, off)
# Sanity check that saved_registers doesn't overlap with modified_registers
if (modified_registers & saved_registers).length > 0
raise BadGenerateError
end
stub
end
#
@ -69,4 +77,14 @@ class Metasploit3 < Msf::Encoder::Alphanum
def encode_end(state)
state.encoded += Rex::Encoder::Alpha2::AlphaMixed::add_terminator()
end
# Indicate that this module can preserve some registers
def can_preserve_registers?
true
end
# Convert the SaveRegisters to an array of x86 register constants
def saved_registers
Rex::Arch::X86.register_names_to_ids(datastore['SaveRegisters'])
end
end