Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/encoders/x86/unicode_mixed.rb
Views: 11780
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45require 'rex/encoder/alpha2/unicode_mixed'67class MetasploitModule < Msf::Encoder::Alphanum8Rank = ManualRanking910def initialize11super(12'Name' => 'Alpha2 Alphanumeric Unicode Mixedcase Encoder',13'Description' => %q{14Encodes payload as unicode-safe mixedcase text. This encoder uses15SkyLined's Alpha2 encoding suite.16},17'Author' => [ 'pusscat', 'skylined' ],18'Arch' => ARCH_X86,19'License' => BSD_LICENSE,20'EncoderType' => Msf::Encoder::Type::AlphanumUnicodeMixed,21'Decoder' =>22{23'BlockSize' => 124})25register_options(26[27OptString.new('BufferRegister', [true, 'The register that points to the encoded payload', 'ECX'])28]29)30end3132#33# Returns the decoder stub that is adjusted for the size of the buffer34# being encoded.35#36def decoder_stub(_state)37reg = datastore['BufferRegister']38offset = datastore['BufferOffset'].to_i || 039if !reg40raise EncodingError, 'Need BufferRegister'41end4243Rex::Encoder::Alpha2::UnicodeMixed.gen_decoder(reg, offset)44end4546#47# Encodes a one byte block with the current index of the length of the48# payload.49#50def encode_block(state, block)51Rex::Encoder::Alpha2::UnicodeMixed.encode_byte(block.unpack1('C'), state.badchars)52end5354#55# Tack on our terminator56#57def encode_end(state)58state.encoded += Rex::Encoder::Alpha2::UnicodeMixed.add_terminator59end6061#62# Returns the unicode version of the supplied buffer.63#64def to_native(buffer)65Rex::Text.to_unicode(buffer)66end67end686970