Class: Rex::Proto::Kerberos::Keytab::Krb5KeytabEntry

Inherits:
BinData::Record
  • Object
show all
Defined in:
lib/rex/proto/kerberos/keytab/krb5_keytab.rb

Constant Summary collapse

LEN_FIELD_BYTE_SIZE =

Returns The number of bytes for the len field.

Returns:

  • (Integer)

    The number of bytes for the len field

4

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#componentsArray<CountedOctetString>

Returns The components in the principal name, which can be joined by slashes to represent the SPN.

Returns:

  • (Array<CountedOctetString>)

    The components in the principal name, which can be joined by slashes to represent the SPN



95
# File 'lib/rex/proto/kerberos/keytab/krb5_keytab.rb', line 95

array :components, initial_length: :count_of_components, type: :counted_octet_string

#count_of_componentsInteger

Returns:

  • (Integer)


86
# File 'lib/rex/proto/kerberos/keytab/krb5_keytab.rb', line 86

uint16 :count_of_components, value: -> { components.length }

#flagsInteger

Returns:

  • (Integer)


123
124
125
# File 'lib/rex/proto/kerberos/keytab/krb5_keytab.rb', line 123

uint32 :flags,
# only present if >= 4 bytes left in entry
onlyif: -> { ((len + LEN_FIELD_BYTE_SIZE) - flags.rel_offset) >= 4 }

#keyblockKeytabKeyBlock

Returns:

  • (KeytabKeyBlock)


112
# File 'lib/rex/proto/kerberos/keytab/krb5_keytab.rb', line 112

keyblock :keyblock

#lenInteger

Returns The number of remaining bytes for this record. The length does not include the 4 bytes for this field.

Returns:

  • (Integer)

    The number of remaining bytes for this record. The length does not include the 4 bytes for this field



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/rex/proto/kerberos/keytab/krb5_keytab.rb', line 67

int32 :len,
 value: -> {
   size = [
     count_of_components,
     realm,
     components,
     name_type,
     timestamp,
     vno8,
     keyblock,
     vno,
     flags
   ].sum { |field| field.to_binary_s.bytes.count }

   size
}

#name_typeInteger

Returns:

  • (Integer)


100
# File 'lib/rex/proto/kerberos/keytab/krb5_keytab.rb', line 100

uint32 :name_type

#realm#CountedOctetString

Returns:

  • (CountedOctetString)


90
# File 'lib/rex/proto/kerberos/keytab/krb5_keytab.rb', line 90

counted_octet_string :realm

#timestampInteger

Returns The time the key entry was created; Can be 0 for keytabs generated by ktpass.

Returns:

  • (Integer)

    The time the key entry was created; Can be 0 for keytabs generated by ktpass



104
# File 'lib/rex/proto/kerberos/keytab/krb5_keytab.rb', line 104

epoch :timestamp

#vnoInteger

Returns:

  • (Integer)


116
117
118
119
# File 'lib/rex/proto/kerberos/keytab/krb5_keytab.rb', line 116

uint32 :vno,
initial_value: -> { vno8.to_i },
# only present if >= 4 bytes left in entry
onlyif: -> { ((len + LEN_FIELD_BYTE_SIZE) - vno.rel_offset) >= 4 }

#vno8Integer

Returns The lower 8 bits of the version number of the key.

Returns:

  • (Integer)

    The lower 8 bits of the version number of the key



108
# File 'lib/rex/proto/kerberos/keytab/krb5_keytab.rb', line 108

uint8 :vno8

Instance Method Details

#principalString

Returns The principal associated with this key tab entry.

Returns:

  • (String)

    The principal associated with this key tab entry



128
129
130
# File 'lib/rex/proto/kerberos/keytab/krb5_keytab.rb', line 128

def principal
  "#{components.to_a.join('/')}@#{realm}"
end