Class: Msf::EncoderState

Inherits:
Object
  • Object
show all
Defined in:
lib/msf/core/encoder.rb

Overview

This class is used to track the state of a single encoding operation from start to finish.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key = nil) ⇒ EncoderState

Initializes a new encoder state, optionally with a key.



16
17
18
19
20
# File 'lib/msf/core/encoder.rb', line 16

def initialize(key = nil)
  @orig_buf = nil
  @buf = nil
  reset(key)
end

Instance Attribute Details

#badcharsObject

:nodoc:



54
55
56
# File 'lib/msf/core/encoder.rb', line 54

def badchars
  @badchars
end

#bufObject

:nodoc:



50
51
52
# File 'lib/msf/core/encoder.rb', line 50

def buf
  @buf
end

#contextObject

:nodoc:



53
54
55
# File 'lib/msf/core/encoder.rb', line 53

def context
  @context
end

#context_addressObject

The address that contains they key on the target machine



59
60
61
# File 'lib/msf/core/encoder.rb', line 59

def context_address
  @context_address
end

#context_encodingObject

A boolean that indicates whether context encoding is enabled



57
58
59
# File 'lib/msf/core/encoder.rb', line 57

def context_encoding
  @context_encoding
end

#decoder_key_offsetObject

Decoder settings



62
63
64
# File 'lib/msf/core/encoder.rb', line 62

def decoder_key_offset
  @decoder_key_offset
end

#decoder_key_packObject

Decoder settings



62
63
64
# File 'lib/msf/core/encoder.rb', line 62

def decoder_key_pack
  @decoder_key_pack
end

#decoder_key_sizeObject

Decoder settings



62
63
64
# File 'lib/msf/core/encoder.rb', line 62

def decoder_key_size
  @decoder_key_size
end

#decoder_stubObject

:nodoc:



63
64
65
# File 'lib/msf/core/encoder.rb', line 63

def decoder_stub
  @decoder_stub
end

#encodedObject

:nodoc:



52
53
54
# File 'lib/msf/core/encoder.rb', line 52

def encoded
  @encoded
end

#keyObject

:nodoc:



48
49
50
# File 'lib/msf/core/encoder.rb', line 48

def key
  @key
end

#orig_bufObject (readonly)

:nodoc:



51
52
53
# File 'lib/msf/core/encoder.rb', line 51

def orig_buf
  @orig_buf
end

#orig_keyObject

:nodoc:



49
50
51
# File 'lib/msf/core/encoder.rb', line 49

def orig_key
  @orig_key
end

Instance Method Details

#init_key(key) ⇒ Object

Set the initial encoding key.



35
36
37
38
# File 'lib/msf/core/encoder.rb', line 35

def init_key(key)
  self.key      = key
  self.orig_key = key
end

#reset(key = nil) ⇒ Object

Reset the encoder state by initializing the encoded buffer to an empty string.



26
27
28
29
30
# File 'lib/msf/core/encoder.rb', line 26

def reset(key = nil)
  init_key(key)

  self.encoded  = ''
end