2006-01-06 00:57:14 +00:00
|
|
|
require 'msf/core'
|
|
|
|
require 'rex/encoder/alpha2/alpha_mixed'
|
|
|
|
|
|
|
|
module Msf
|
|
|
|
module Encoders
|
|
|
|
module X86
|
|
|
|
|
2006-01-06 02:25:23 +00:00
|
|
|
class AlphaMixed < Msf::Encoder::Alphanum
|
|
|
|
|
|
|
|
Rank = LowRanking
|
2006-01-06 00:57:14 +00:00
|
|
|
|
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => "Alpha2 Alphanumeric Mixedcase Encoder",
|
|
|
|
'Version' => '$Revision$',
|
|
|
|
'Description' => %q{
|
|
|
|
Encodes payloads as alphanumeric mixedcase text. This encoder uses
|
|
|
|
SkyLined's Alpha2 encoding suite.
|
2006-01-27 05:00:35 +00:00
|
|
|
},
|
2006-01-06 00:57:14 +00:00
|
|
|
'Author' => [ 'pusscat', 'skylined' ],
|
|
|
|
'Arch' => ARCH_X86,
|
2006-05-06 16:34:39 +00:00
|
|
|
'License' => BSD_LICENSE,
|
2006-01-06 02:25:23 +00:00
|
|
|
'EncoderType' => Msf::Encoder::Type::AlphanumMixed,
|
2006-01-06 00:57:14 +00:00
|
|
|
'Decoder' =>
|
|
|
|
{
|
|
|
|
'BlockSize' => 1,
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Returns the decoder stub that is adjusted for the size of the buffer
|
|
|
|
# being encoded.
|
|
|
|
#
|
|
|
|
def decoder_stub(state)
|
2006-01-06 09:03:34 +00:00
|
|
|
reg = datastore['BufferRegister'] || 'EAX'
|
|
|
|
offset = datastore['BufferOffset'].to_i || 0
|
2006-01-06 00:57:14 +00:00
|
|
|
|
|
|
|
Rex::Encoder::Alpha2::AlphaMixed::gen_decoder(reg, offset)
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Encodes a one byte block with the current index of the length of the
|
|
|
|
# payload.
|
|
|
|
#
|
|
|
|
def encode_block(state, block)
|
2006-01-18 15:21:41 +00:00
|
|
|
Rex::Encoder::Alpha2::AlphaMixed::encode_byte(block.unpack('C')[0], datastore['BadChars'])
|
2006-01-06 00:57:14 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Tack on our terminator
|
|
|
|
#
|
|
|
|
def encode_end(state)
|
|
|
|
state.encoded += Rex::Encoder::Alpha2::AlphaMixed::add_terminator()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end end end
|