Class Msf::Encoder
In: lib/msf/core/encoder.rb
Parent: Module

This class is the base class that all encoders inherit from.

Methods

Classes and Modules

Module Msf::Encoder::Type

Public Class methods

Initializes an encoder module instance using the supplied information hash.

Returns MODULE_ENCODER to indicate that this is an encoder module.

Public Instance methods

Returns the size of each logical encoding block, in bytes. This is typically the same as decoder_key_size.

Returns the module‘s decoder hash or an empty hash.

Returns the offset to the key associated with the decoder stub.

Returns the byte-packing character that should be used to encode the key.

Returns the size of the key, in bytes.

Returns the decoder stub to use based on the supplied state.

Performs the actual encoding operation after the encoder state has been initialized and is ready to go.

This method generates an encoded version of the supplied buffer in buf using the bad characters as guides. On success, an encoded and functional version of the supplied buffer will be returned. Otherwise, an exception will be thrown if an error is encountered during the encoding process.

Called when encoding is about to start immediately after the encoding state has been initialized.

Called once for each block being encoded based on the attributes of the decoder.

Called after encoding has completed.

This callback allows a derived class to finalize a stub after a key have been selected. The finalized stub should be returned.

Returns the type or types of encoders that this specific module classifies as. If there is more than one type, the values should be separated by whitespace.

Returns a string that should be prepended to the encoded version of the buffer before returning it to callers.

Provides the encoder with an opportunity to return the native format (as in the format the code will be in when it executes on the target). In general, the same buffer is returned to the caller. However, for things like unicode, the buffer is unicod encoded and then returned.

Returns MODULE_ENCODER to indicate that this is an encoder module.

Protected Instance methods

Returns the list of bad keys associated with this encoder.

Parses a context information file in an effort to find a compatible key

This method finds a compatible key for the supplied buffer based also on the supplied bad characters list. This is meant to make encoders more reliable and less prone to bad character failure by doing a fairly complete key search before giving up on an encoder.

Determines if the key selected by find_key is usable

Returns the index of any bad characters found in the supplied buffer.

Initializes the encoding state supplied as an argument to the attributes that have been defined for this decoder stub, such as key offset, size, and pack.

Convert an integer into the individual key bytes based on the decoder‘s key size and packing requirements

Convert individual key bytes into a byte buffer

Convert individual key bytes into a single integer based on the decoder‘s key size and packing requirements

Obtains the key to use during encoding. If context encoding is enabled, special steps are taken. Otherwise, the derived class is given an opportunity to find the key.

[Validate]