Class: Rex::Proto::Kerberos::Model::Element

Inherits:
Object
  • Object
show all
Includes:
Crypto, Rex::Proto::Kerberos::Model
Defined in:
lib/rex/proto/kerberos/model/element.rb

Overview

This class provides a representation of a principal, an asset (e.g., a workstation user or a network server) on a network.

Constant Summary

Constants included from Rex::Proto::Kerberos::Model

AD_IF_RELEVANT, AP_REQ, AS_REP, AS_REQ, AUTHENTICATOR, ERROR_CODES, KDC_OPTION_ALLOW_POST_DATE, KDC_OPTION_ENC_TKT_IN_SKEY, KDC_OPTION_FORWARDABLE, KDC_OPTION_FORWARDED, KDC_OPTION_POST_DATED, KDC_OPTION_PROXIABLE, KDC_OPTION_PROXY, KDC_OPTION_RENEW, KDC_OPTION_RENEWABLE, KDC_OPTION_RENEWABLE_OK, KDC_OPTION_RESERVED, KDC_OPTION_UNUSED_10, KDC_OPTION_UNUSED_11, KDC_OPTION_UNUSED_7, KDC_OPTION_UNUSED_9, KDC_OPTION_VALIDATE, KRB_ERROR, NT_PRINCIPAL, NT_SRV_HST, NT_SRV_INST, NT_SRV_XHST, NT_UID, NT_UNKNOWN, PA_ENC_TIMESTAMP, PA_PAC_REQUEST, PA_PW_SALT, PA_TGS_REQ, TGS_REP, TGS_REQ, TICKET, VERSION

Constants included from Crypto

Crypto::ENC_AS_RESPONSE, Crypto::ENC_KDC_REQUEST_BODY, Crypto::ENC_TGS_RESPONSE, Crypto::RC4_HMAC, Crypto::RSA_MD5

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Crypto::RsaMd5

#checksum_rsa_md5

Methods included from Crypto::Rc4Hmac

#decrypt_rc4_hmac, #encrypt_rc4_hmac

Constructor Details

#initialize(options = {}) ⇒ Element

Returns a new instance of Element.


32
33
34
35
36
37
38
39
# File 'lib/rex/proto/kerberos/model/element.rb', line 32

def initialize(options = {})
  self.class.attributes.each do |attr|
    if options.has_key?(attr)
      m = (attr.to_s + '=').to_sym
      self.send(m, options[attr])
    end
  end
end

Class Method Details

.attr_accessor(*vars) ⇒ Object


14
15
16
17
18
# File 'lib/rex/proto/kerberos/model/element.rb', line 14

def self.attr_accessor(*vars)
  @attributes ||= []
  @attributes.concat vars
  super(*vars)
end

.attributesArray

Retrieves the element class fields

Returns:

  • (Array)

23
24
25
# File 'lib/rex/proto/kerberos/model/element.rb', line 23

def self.attributes
  @attributes
end

.decode(input) ⇒ Object


27
28
29
30
# File 'lib/rex/proto/kerberos/model/element.rb', line 27

def self.decode(input)
  elem = self.new
  elem.decode(input)
end

Instance Method Details

#attributesArray

Retrieves the element instance fields

Returns:

  • (Array)

44
45
46
# File 'lib/rex/proto/kerberos/model/element.rb', line 44

def attributes
  self.class.attributes
end

#decode(input) ⇒ Object

Decodes the Rex::Proto::Kerberos::Model::Element from the input. This method has been designed to be overridden by subclasses.

Raises:

  • (NoMethodError)

52
53
54
# File 'lib/rex/proto/kerberos/model/element.rb', line 52

def decode(input)
  raise ::NoMethodError, 'Method designed to be overridden'
end

#encodeObject

Encodes the Rex::Proto::Kerberos::Model::Element into an ASN.1 String. This method has been designed to be overridden by subclasses.

Raises:

  • (NoMethodError)

60
61
62
# File 'lib/rex/proto/kerberos/model/element.rb', line 60

def encode
  raise ::NoMethodError, 'Method designed to be overridden'
end