2014-12-20 00:41:27 +00:00
|
|
|
# -*- coding: binary -*-
|
|
|
|
require 'rex/proto/kerberos'
|
|
|
|
|
|
|
|
module Msf
|
|
|
|
module Kerberos
|
|
|
|
module Client
|
|
|
|
module AsResponse
|
|
|
|
|
2014-12-21 00:57:49 +00:00
|
|
|
# Extracts the session key from a Kerberos AS Response
|
|
|
|
#
|
2014-12-20 00:41:27 +00:00
|
|
|
# @param res [Rex::Proto::Kerberos::Model::KdcResponse]
|
|
|
|
# @param key [String]
|
|
|
|
# @return [Rex::Proto::Kerberos::Model::EncryptionKey]
|
|
|
|
def extract_session_key(res, key)
|
|
|
|
decrypt_res = res.enc_part.decrypt(key, 8)
|
|
|
|
enc_kdc_res = Rex::Proto::Kerberos::Model::EncKdcResponse.decode(decrypt_res)
|
|
|
|
|
|
|
|
enc_kdc_res.key
|
|
|
|
end
|
|
|
|
|
2014-12-21 00:57:49 +00:00
|
|
|
# Extracts the logon time from a Kerberos AS Response
|
|
|
|
#
|
2014-12-20 00:41:27 +00:00
|
|
|
# @param res [Rex::Proto::Kerberos::Model::KdcResponse]
|
|
|
|
# @param key [String]
|
|
|
|
# @return [Fixnum]
|
|
|
|
def extract_logon_time(res, key)
|
|
|
|
decrypt_res = res.enc_part.decrypt(key, 8)
|
|
|
|
enc_kdc_res = Rex::Proto::Kerberos::Model::EncKdcResponse.decode(decrypt_res)
|
|
|
|
|
|
|
|
auth_time = enc_kdc_res.auth_time
|
|
|
|
|
|
|
|
auth_time.to_i
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|