Module: Rex::Encoders::XorDword::Backend

Included in:
Rex::Encoders::XorDword
Defined in:
lib/rex/encoders/xor_dword.rb

Instance Method Summary collapse

Instance Method Details

#_prependObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/rex/encoders/xor_dword.rb', line 16

def _prepend
	# set the counter to the rounded up number of dwords to decode
	Rex::Arch::X86.set(
		Rex::Arch::X86::ECX,
		(encoded.length - 1 >> 2) + 1,
		badchars
	) +
	"\xe8\xff\xff\xff" +                # call $+4
	"\xff\xc0" +                        # inc eax
	"\x5e" +                            # pop esi
	"\x81\x76\x0e" + key +              # xor_xor: xor [esi + 0x0e], $xorkey
	"\x83\xee\xfc" +                    # sub esi, -4
	"\xe2\xf4"                          # loop xor_xor
end