Return Time from #extract_logon_time

This commit is contained in:
Spencer McIntyre 2023-01-27 09:11:43 -05:00
parent f4976a0f9f
commit 647cf1d402
3 changed files with 5 additions and 7 deletions

View File

@ -42,16 +42,14 @@ module Msf
#
# @param res [Rex::Proto::Kerberos::Model::KdcResponse]
# @param key [String]
# @return [Integer]
# @return [Time]
# @see Rex::Proto::Kerberos::Model::KdcResponse
# @see Rex::Proto::Kerberos::Model::EncryptedData.decrypt
# @see Rex::Proto::Kerberos::Model::EncKdcResponse
# @see Rex::Proto::Kerberos::Model::EncKdcResponse.decode
def extract_logon_time(res, key)
kdc_res = decrypt_kdc_as_rep_enc_part(res, key)
auth_time = kdc_res.auth_time
auth_time.to_i
kdc_res.auth_time
end
# Format from

View File

@ -92,7 +92,7 @@ class MetasploitModule < Msf::Auxiliary
print_status("#{peer} - Parsing AS-REP...")
session_key = extract_session_key(res, password_digest)
logon_time = decrypt_kdc_as_rep_enc_part(res, password_digest).auth_time
logon_time = extract_logon_time(res, password_digest)
ticket = res.ticket
pre_auth = []

View File

@ -173,13 +173,13 @@ RSpec.describe Msf::Exploit::Remote::Kerberos::Client::AsResponse do
context "when using a valid key" do
it "returns the extracted Rex::Proto::Kerberos::CredentialCache::Cache" do
response = Rex::Proto::Kerberos::Model::KdcResponse.decode(as_response)
expect(subject.extract_logon_time(response, valid_key)).to be_a(Integer)
expect(subject.extract_logon_time(response, valid_key)).to be_a(Time)
end
it "extracts the correct time" do
response = Rex::Proto::Kerberos::Model::KdcResponse.decode(as_response)
time = subject.extract_logon_time(response, valid_key)
expect(time).to eq(1419128917)
expect(time).to eq(Time.new(2014, 12, 21, 02, 28, 37, "+00:00"))
end
end