Class: Msf::Exploit::Remote::LDAP::EntryCache::LDAPEntryCache

Inherits:
LruRedux::Cache
  • Object
show all
Defined in:
lib/msf/core/exploit/remote/ldap/entry_cache.rb

Instance Method Summary collapse

Instance Method Details

#<<(entry) ⇒ Object

Raises:

  • (TypeError)


12
13
14
15
16
# File 'lib/msf/core/exploit/remote/ldap/entry_cache.rb', line 12

def <<(entry)
  raise TypeError unless entry.is_a? Net::LDAP::Entry

  self[entry.dn] = entry
end

#get_by_dn(dn) ⇒ Object



18
19
20
# File 'lib/msf/core/exploit/remote/ldap/entry_cache.rb', line 18

def get_by_dn(dn)
  self[dn]
end

#get_by_samaccountname(samaccountname) ⇒ Object



22
23
24
25
26
# File 'lib/msf/core/exploit/remote/ldap/entry_cache.rb', line 22

def get_by_samaccountname(samaccountname)
  entry = @data.values.reverse_each.find { _1[:sAMAccountName]&.first == samaccountname }
  @data[entry.dn] = entry if entry # update it as recently used
  entry
end

#get_by_sid(sid) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/msf/core/exploit/remote/ldap/entry_cache.rb', line 28

def get_by_sid(sid)
  sid = Rex::Proto::MsDtyp::MsDtypSid.new(sid)

  entry = @data.values.reverse_each.find { _1[:objectSid]&.first == sid.to_binary_s  }
  @data[entry.dn] = entry if entry # update it as recently used
  entry
end