Skip to content

Commit ad97457

Browse files
committed
Move more constants to Crypto
1 parent 75a2846 commit ad97457

File tree

6 files changed

+7
-11
lines changed

6 files changed

+7
-11
lines changed

lib/msf/kerberos/client/as_response.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module AsResponse
1717
# @see Rex::Proto::Kerberos::Model::EncKdcResponse.decode
1818
# @see Rex::Proto::Kerberos::Model::EncryptionKey
1919
def extract_session_key(res, key)
20-
decrypt_res = res.enc_part.decrypt(key, 8)
20+
decrypt_res = res.enc_part.decrypt(key, Rex::Proto::Kerberos::Crypto::ENC_AS_RESPONSE)
2121
enc_kdc_res = Rex::Proto::Kerberos::Model::EncKdcResponse.decode(decrypt_res)
2222

2323
enc_kdc_res.key
@@ -33,7 +33,7 @@ def extract_session_key(res, key)
3333
# @see Rex::Proto::Kerberos::Model::EncKdcResponse
3434
# @see Rex::Proto::Kerberos::Model::EncKdcResponse.decode
3535
def extract_logon_time(res, key)
36-
decrypt_res = res.enc_part.decrypt(key, 8)
36+
decrypt_res = res.enc_part.decrypt(key, Rex::Proto::Kerberos::Crypto::ENC_AS_RESPONSE)
3737
enc_kdc_res = Rex::Proto::Kerberos::Model::EncKdcResponse.decode(decrypt_res)
3838

3939
auth_time = enc_kdc_res.auth_time

lib/msf/kerberos/client/tgs_response.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module TgsResponse
1717
# @see Msf::Kerberos::Client::CacheCredential
1818
# @see Rex::Proto::Kerberos::CredentialCache::Cache
1919
def extract_kerb_creds(res, key)
20-
decrypt_res = res.enc_part.decrypt(key, 9)
20+
decrypt_res = res.enc_part.decrypt(key, Rex::Proto::Kerberos::Crypto::ENC_TGS_RESPONSE)
2121
enc_res = Rex::Proto::Kerberos::Model::EncKdcResponse.decode(decrypt_res)
2222

2323
client = create_cache_principal(

lib/rex/proto/kerberos/crypto.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ module Crypto
1212

1313
RSA_MD5 = 7
1414
RC4_HMAC = 23
15+
ENC_KDC_REQUEST_BODY = 10
16+
ENC_AS_RESPONSE = 8
17+
ENC_TGS_RESPONSE = 9
1518
end
1619
end
1720
end

lib/rex/proto/kerberos/model.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@ module Model
1717
AUTHENTICATOR = 2
1818
AP_REQ = 14
1919

20-
# Encrypted Message Id's
21-
22-
ENC_KDC_REQUEST_BODY = 10
23-
ENC_AS_RESPONSE = 8
24-
ENC_TGS_RESPONSE = 9
25-
2620
KDC_OPTION_RESERVED = 0
2721
KDC_OPTION_FORWARDABLE = 1
2822
KDC_OPTION_FORWARDED = 2

lib/rex/proto/kerberos/pac/type.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module Pac
99
class Type < Element
1010

1111
# @!attribute buffers
12-
# @return [Array<Rex::Text::Proto::Kerberos::Pac::Element>] The array of PAC_INFO_BUFFER structures
12+
# @return [Array<Rex::Proto::Kerberos::Pac::Element>] The array of PAC_INFO_BUFFER structures
1313
attr_accessor :buffers
1414
# @!attribute checksum
1515
# @return [Fixnum] The type of checksum to use when encoding PAC-TYPE

spec/lib/rex/proto/kerberos/model/encrypted_data_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@
129129
"\x9f\x5e\xb7\xb8\x9b\x57\xc5\xc9\xc5\xea\x90\x89\xc3\x63\x58"
130130
end
131131
let(:msg_type) { 1 }
132-
#let(:known_password) { 'juan' }
133132
let(:known_password) { OpenSSL::Digest.digest('MD4', Rex::Text.to_unicode('juan')) }
134133

135134
describe "#decode" do

0 commit comments

Comments
 (0)