Class: Rex::Proto::Kerberos::Pac::Krb5UpnDnsInfo

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

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dns_domain_nameString

Returns The DNS Domain Name (e.g. WINDOMAIN.LOCAL).

Returns:

  • (String)

    The DNS Domain Name (e.g. WINDOMAIN.LOCAL)



730
731
732
# File 'lib/rex/proto/kerberos/pac/krb5_pac.rb', line 730

delayed_io :dns_domain_name, read_abs_offset: -> { self.abs_offset + dns_domain_name_offset } do
  string16 read_length: :dns_domain_name_length
end

#dns_domain_name_lengthInteger

Returns The length of the DNS domain name.

Returns:

  • (Integer)

    The length of the DNS domain name



689
# File 'lib/rex/proto/kerberos/pac/krb5_pac.rb', line 689

uint16 :dns_domain_name_length, value: -> { dns_domain_name.num_bytes }

#dns_domain_name_offsetInteger

Returns The relative offset of the DNS domain name from the beginning of this structure.

Returns:

  • (Integer)

    The relative offset of the DNS domain name from the beginning of this structure



693
# File 'lib/rex/proto/kerberos/pac/krb5_pac.rb', line 693

uint16 :dns_domain_name_offset

#flagsInteger

U flag (bit 0) The user account object does not have the userPrincipalName attribute. S flag (bit 1) The structure has been extended with the user account’s SAM Name and SID. The remaining bits are ignored.

Returns:

  • (Integer)


700
# File 'lib/rex/proto/kerberos/pac/krb5_pac.rb', line 700

uint32 :flags

#sam_nameString

Returns The SAM Name (e.g. test).

Returns:

  • (String)

    The SAM Name (e.g. test)



736
737
738
# File 'lib/rex/proto/kerberos/pac/krb5_pac.rb', line 736

delayed_io :sam_name, read_abs_offset: -> { self.abs_offset + sam_name_offset }, onlyif: -> { has_s_flag? } do
  string16 read_length: :sam_name_length
end

#sam_name_lengthInteger

Only available if the S flag is set

Returns:

  • (Integer)

    The length of the SAM name



705
# File 'lib/rex/proto/kerberos/pac/krb5_pac.rb', line 705

uint16 :sam_name_length, value: -> { sam_name.num_bytes }, onlyif: :has_s_flag?

#sam_name_offsetInteger

Only available if the S flag is set

Returns:

  • (Integer)

    The relative offset of the SAM name from the beginning of this structure



710
# File 'lib/rex/proto/kerberos/pac/krb5_pac.rb', line 710

uint16 :sam_name_offset, onlyif: :has_s_flag?

#sidMsDtypSid

Returns The SID (e.g. S-1-5-32-544).

Returns:

  • (MsDtypSid)

    The SID (e.g. S-1-5-32-544)



742
743
744
# File 'lib/rex/proto/kerberos/pac/krb5_pac.rb', line 742

delayed_io :sid, read_abs_offset: -> { self.abs_offset + sid_offset }, onlyif: -> { has_s_flag? } do
  ms_dtyp_sid
end

#sid_lengthInteger

Only available if the S flag is set

Returns:

  • (Integer)

    The length of the SID



715
# File 'lib/rex/proto/kerberos/pac/krb5_pac.rb', line 715

uint16 :sid_length, value: -> { sid.num_bytes }, onlyif: :has_s_flag?

#sid_offsetInteger

Only available if the S flag is set

Returns:

  • (Integer)

    The relative offset of the SID from the beginning of this structure



720
# File 'lib/rex/proto/kerberos/pac/krb5_pac.rb', line 720

uint16 :sid_offset, onlyif: :has_s_flag?

#ul_typeInteger (readonly)

Returns Describes the type of data present in the buffer.

Returns:

  • (Integer)

    Describes the type of data present in the buffer



677
# File 'lib/rex/proto/kerberos/pac/krb5_pac.rb', line 677

virtual :ul_type, value: Krb5PacElementType::USER_PRINCIPAL_NAME_AND_DNS_INFORMATION

#upnString

Returns The UPN (User Principal Name) (e.g. [email protected]).

Returns:



724
725
726
# File 'lib/rex/proto/kerberos/pac/krb5_pac.rb', line 724

delayed_io :upn, read_abs_offset: -> { self.abs_offset + upn_offset } do
  string16 read_length: :upn_length
end

#upn_lengthInteger

Returns The length of the UPN.

Returns:

  • (Integer)

    The length of the UPN



681
# File 'lib/rex/proto/kerberos/pac/krb5_pac.rb', line 681

uint16 :upn_length, value: -> { upn.num_bytes }

#upn_offsetInteger

Returns The relative offset of the UPN from the beginning of this structure.

Returns:

  • (Integer)

    The relative offset of the UPN from the beginning of this structure



685
# File 'lib/rex/proto/kerberos/pac/krb5_pac.rb', line 685

uint16 :upn_offset

Instance Method Details

#do_num_bytesObject



746
747
748
749
750
751
752
753
# File 'lib/rex/proto/kerberos/pac/krb5_pac.rb', line 746

def do_num_bytes
  if has_s_flag?
    result = sid_offset + sid_length
  else
    result = dns_domain_name_offset + dns_domain_name_length
  end
  result
end

#has_s_flag?Boolean

def initialize_instance(*args)

super
set_offsets!

end

Returns:

  • (Boolean)

    Returns the value of the S flag



760
761
762
# File 'lib/rex/proto/kerberos/pac/krb5_pac.rb', line 760

def has_s_flag?
  flags.anybits?(0b10)
end

#has_u_flag?Boolean

Returns the value of the U flag

Returns:

  • (Boolean)

    Returns the value of the U flag



771
772
773
# File 'lib/rex/proto/kerberos/pac/krb5_pac.rb', line 771

def has_u_flag?
  flags.anybits?(0b01)
end

#set_offsets!(upn: nil, dns_domain_name: nil, sam_name: nil, sid: nil) ⇒ void

This method returns an undefined value.

Allows you to specify the offsets for the contents, otherwise defaults them

Parameters:

  • upn (Integer) (defaults to: nil)

    The relative offset for the upn

  • dns_domain_name (Integer) (defaults to: nil)

    The relative offset for the dns_domain_name

  • sam_name (Integer) (defaults to: nil)

    The relative offset for the sam_name

  • sid (Integer) (defaults to: nil)

    The relative offset for the sid



788
789
790
791
792
793
# File 'lib/rex/proto/kerberos/pac/krb5_pac.rb', line 788

def set_offsets!(upn: nil, dns_domain_name: nil, sam_name: nil, sid: nil)
  self.upn_offset = upn || calc_upn_offset
  self.dns_domain_name_offset = dns_domain_name || calc_dns_domain_name_offset
  self.sam_name_offset = sam_name || calc_sam_name_offset
  self.sid_offset = sid || calc_sid_offset
end

#set_s_flag(bool) ⇒ void

This method returns an undefined value.

Parameters:

  • bool (Boolean)

    The value to set the S flag to



766
767
768
# File 'lib/rex/proto/kerberos/pac/krb5_pac.rb', line 766

def set_s_flag(bool)
  set_flag_bit(1, bool)
end

#set_u_flag(bool) ⇒ void

This method returns an undefined value.

Parameters:

  • bool (Boolean)

    The value to set the U flag to



777
778
779
# File 'lib/rex/proto/kerberos/pac/krb5_pac.rb', line 777

def set_u_flag(bool)
  set_flag_bit(0, bool)
end