class Rex::Proto::Kerberos::CredentialCache::Credential

This class provides a representation of a Credential stored in the Kerberos Credential Cache.

Attributes

addrs[RW]

@!attribute addrs

@return [Array]
auth_data[RW]

@!attribute auth_data

@return [Array]
client[RW]

@!attribute client

@return [Rex::Proto::Kerberos::CredentialCache::Principal]
is_skey[RW]

@!attribute is_skey

@return [Fixnum]
key[RW]

@!attribute key

@return [Rex::Proto::Kerberos::CredentialCache::KeyBlock]
second_ticket[RW]

@!attribute second_ticket

@return [String]
server[RW]

@!attribute server

@return [Rex::Proto::Kerberos::CredentialCache::Principal]
ticket[RW]

@!attribute ticket

@return [String]
time[RW]

@!attribute time

@return [Rex::Proto::Kerberos::CredentialCache::Time]
tkt_flags[RW]

@!attribute tkt_flags

@return [Fixnum]

Public Instance Methods

encode() click to toggle source

Encodes the Rex::Proto::Kerberos::CredentialCache::Credential into an String

@return [String] encoded credential

# File lib/rex/proto/kerberos/credential_cache/credential.rb, line 42
def encode
  encoded = ''
  encoded << encode_client
  encoded << encode_server
  encoded << encode_key
  encoded << encode_time
  encoded << encode_is_skey
  encoded << encode_tkt_flags
  encoded << encode_addrs
  encoded << encode_auth_data
  encoded << encode_ticket
  encoded << encode_second_ticket
end

Private Instance Methods

encode_addrs() click to toggle source

Encodes the addrs field

@return [String] @raise [NotImplementedError] if there are addresses to encode

# File lib/rex/proto/kerberos/credential_cache/credential.rb, line 104
def encode_addrs
  encoded = ''
  if addrs.length > 0
    raise ::NotImplementedError, 'CredentialCache: Credential addresses encoding not supported'
  end
  encoded << [addrs.length].pack('N')
  encoded
end
encode_auth_data() click to toggle source

Encodes the auth_data field

@return [String]

# File lib/rex/proto/kerberos/credential_cache/credential.rb, line 116
def encode_auth_data
  encoded = ''
  if auth_data.length > 0
    raise ::RuntimeError, 'CredentialCache: Credential auth_data encoding not supported'
  end
  encoded << [auth_data.length].pack('N')
  encoded
end
encode_client() click to toggle source

Encodes the client field

@return [String]

# File lib/rex/proto/kerberos/credential_cache/credential.rb, line 61
def encode_client
  client.encode
end
encode_is_skey() click to toggle source

Encodes the is_skey field

@return [String]

# File lib/rex/proto/kerberos/credential_cache/credential.rb, line 89
def encode_is_skey
  [is_skey].pack('C')
end
encode_key() click to toggle source

Encodes the key field

@return [String]

# File lib/rex/proto/kerberos/credential_cache/credential.rb, line 75
def encode_key
  key.encode
end
encode_second_ticket() click to toggle source

Encodes the second_ticket field

@return [String]

# File lib/rex/proto/kerberos/credential_cache/credential.rb, line 139
def encode_second_ticket
  encoded = ''
  encoded << [second_ticket.length].pack('N')
  encoded << second_ticket

  encoded
end
encode_server() click to toggle source

Encodes the server field

@return [String]

# File lib/rex/proto/kerberos/credential_cache/credential.rb, line 68
def encode_server
  server.encode
end
encode_ticket() click to toggle source

Encodes the ticket field

@return [String]

# File lib/rex/proto/kerberos/credential_cache/credential.rb, line 128
def encode_ticket
  encoded = ''
  encoded << [ticket.length].pack('N')
  encoded << ticket

  encoded
end
encode_time() click to toggle source

Encodes the time field

@return [String]

# File lib/rex/proto/kerberos/credential_cache/credential.rb, line 82
def encode_time
  time.encode
end
encode_tkt_flags() click to toggle source

Encodes the tkt_flags field

@return [String]

# File lib/rex/proto/kerberos/credential_cache/credential.rb, line 96
def encode_tkt_flags
  [tkt_flags].pack('N')
end