Class: Rex::Encoder::Alpha2::AlphaMixed
- Inherits:
-
Generic
- Object
- Generic
- Rex::Encoder::Alpha2::AlphaMixed
show all
- Defined in:
- lib/rex/encoder/alpha2/alpha_mixed.rb
Class Method Summary
collapse
Methods inherited from Generic
add_terminator, default_accepted_chars, encode, encode_byte, gen_second
Class Method Details
.gen_decoder(reg, offset) ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/rex/encoder/alpha2/alpha_mixed.rb', line 45
def self.gen_decoder(reg, offset)
decoder =
gen_decoder_prefix(reg, offset) +
"jA" + "X" + "P" + "0A0" + "A" + "kAAQ" + "2AB" + "2BB" + "0BB" + "A" + "B" + "X" + "P" + "8AB" + "uJ" + "I"
return decoder
end
|
.gen_decoder_prefix(reg, offset) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/rex/encoder/alpha2/alpha_mixed.rb', line 11
def self.gen_decoder_prefix(reg, offset)
if (offset > 32)
raise "Critical: Offset is greater than 32"
end
if (offset <= 16)
nop = 'C' * offset
mod = 'I' * (16 - offset) + nop + '7QZ' edxmod = 'J' * (17 - offset)
else
mod = 'A' * (offset - 16)
nop = 'C' * (16 - mod.length)
mod << nop + '7QZ'
edxmod = 'B' * (17 - (offset - 16))
end
regprefix = {
'EAX' => 'PY' + mod, 'ECX' => 'I' + mod, 'EDX' => edxmod + nop + '7RY', 'EBX' => 'SY' + mod, 'ESP' => 'TY' + mod, 'EBP' => 'UY' + mod, 'ESI' => 'VY' + mod, 'EDI' => 'WY' + mod, }
reg.upcase!
if (not regprefix.keys.include? reg)
raise ArgumentError.new("Invalid register name")
end
return regprefix[reg]
end
|