1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-10-29 18:07:27 +01:00

Switch to Array#union and rename preserved_registers

This commit is contained in:
HD Moore 2014-09-13 22:48:14 -05:00
parent 71228b48a0
commit b8a1010ba4

View File

@ -84,15 +84,9 @@ class Metasploit3 < Msf::Encoder::XorAdditiveFeedback
] ]
end end
# Always preserve these registers in our block generation # Always blacklist these registers in our block generation
def preserved_registers def block_generator_register_blacklist
([ [Rex::Arch::X86::ESP, Rex::Arch::X86::ECX] | saved_registers
# Never modify our stack pointer
Rex::Arch::X86::ESP,
# Never modify our counter register
Rex::Arch::X86::ECX
# Never modify user specified registers
] + saved_registers).uniq
end end
protected protected
@ -286,7 +280,7 @@ protected
begin begin
# Generate a permutation saving the ECX, ESP, and user defined registers # Generate a permutation saving the ECX, ESP, and user defined registers
loop_inst.generate(preserved_registers, nil, state.badchars) loop_inst.generate(block_generator_register_blacklist, nil, state.badchars)
rescue RuntimeError => e rescue RuntimeError => e
raise EncodingError raise EncodingError
end end