Module: Msf::Exploit::Remote::Kerberos::Ticket::Storage::ReadMixin
- Defined in:
- lib/msf/core/exploit/remote/kerberos/ticket/storage/read_mixin.rb
Overview
A mixin providing the ability to read previously stored tickets.
Instance Method Summary collapse
-
#load_credential(options = {}) ⇒ Rex::Proto::Kerberos::CredentialCache::Krb5CcacheCredential?
Load a stored credential object that is suitable for authentication.
-
#tickets(options = {}, &block) ⇒ Array<StoredTicket>
Get stored tickets matching the options query.
Instance Method Details
#load_credential(options = {}) ⇒ Rex::Proto::Kerberos::CredentialCache::Krb5CcacheCredential?
Load a stored credential object that is suitable for authentication.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/msf/core/exploit/remote/kerberos/ticket/storage/read_mixin.rb', line 5 def load_credential( = {}) return nil unless active_db? now = Time.now.utc available_tickets = tickets().select do |ticket| !ticket.expired?(now) end return unless available_tickets.any? if [:offered_etypes].present? # Prefer etypes mentioned first [:offered_etypes].each do |etype| available_tickets.each do |t| if t.enctype == etype return t.ccache.credentials.first end end end else return available_tickets.first.ccache.credentials.first end nil end |
#tickets(options = {}, &block) ⇒ Array<StoredTicket>
Get stored tickets matching the options query.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/msf/core/exploit/remote/kerberos/ticket/storage/read_mixin.rb', line 31 def tickets( = {}, &block) mapped = objects().map do |stored_loot| stored_ticket = StoredTicket.new(stored_loot) end mapped.select do |stored_ticket| # If we were provided a set of etypes to look for, restrict to that if [:offered_etypes].nil? || [:offered_etypes].include?(stored_ticket.enctype) block.call(stored_ticket) if block_given? true else false end end end |