raise NotImplementedError
parent
4493b3285c
commit
05a9ec05e8
|
@ -44,7 +44,7 @@ module Rex
|
||||||
when 'tcp'
|
when 'tcp'
|
||||||
self.connection = create_tcp_connection
|
self.connection = create_tcp_connection
|
||||||
when 'udp'
|
when 'udp'
|
||||||
raise ::RuntimeError, 'Kerberos Client: UDP not supported'
|
raise ::NotImplementedError, 'Kerberos Client: UDP not supported'
|
||||||
else
|
else
|
||||||
raise ::RuntimeError, 'Kerberos Client: unknown transport protocol'
|
raise ::RuntimeError, 'Kerberos Client: unknown transport protocol'
|
||||||
end
|
end
|
||||||
|
@ -66,7 +66,8 @@ module Rex
|
||||||
#
|
#
|
||||||
# @param req [Rex::Proto::Kerberos::Model::KdcRequest] the request to send
|
# @param req [Rex::Proto::Kerberos::Model::KdcRequest] the request to send
|
||||||
# @return [Fixnum] the number of bytes sent
|
# @return [Fixnum] the number of bytes sent
|
||||||
# @raise [RuntimeError] if the transport protocol is unknown or not supported
|
# @raise [RuntimeError] if the transport protocol is unknown
|
||||||
|
# @raise [NotImplementedError] if the transport protocol isn't supported
|
||||||
def send_request(req)
|
def send_request(req)
|
||||||
connect
|
connect
|
||||||
|
|
||||||
|
@ -89,6 +90,7 @@ module Rex
|
||||||
# response message
|
# response message
|
||||||
# @raise [RuntimeError] if the connection isn't established, the transport protocol is unknown, not supported
|
# @raise [RuntimeError] if the connection isn't established, the transport protocol is unknown, not supported
|
||||||
# or the response can't be parsed
|
# or the response can't be parsed
|
||||||
|
# @raise [NotImplementedError] if the transport protocol isn't supported
|
||||||
def recv_response
|
def recv_response
|
||||||
if connection.nil?
|
if connection.nil?
|
||||||
raise ::RuntimeError, 'Kerberos Client: connection not established'
|
raise ::RuntimeError, 'Kerberos Client: connection not established'
|
||||||
|
@ -111,7 +113,8 @@ module Rex
|
||||||
#
|
#
|
||||||
# @param req [Rex::Proto::Kerberos::Model::KdcRequest] the request to send
|
# @param req [Rex::Proto::Kerberos::Model::KdcRequest] the request to send
|
||||||
# @return [<Rex::Proto::Kerberos::Model::KrbError, Rex::Proto::Kerberos::Model::KdcResponse>] The kerberos message
|
# @return [<Rex::Proto::Kerberos::Model::KrbError, Rex::Proto::Kerberos::Model::KdcResponse>] The kerberos message
|
||||||
# @raise [RuntimeError] if the transport protocol is unknown, not supported, or the response can't be parsed.
|
# @raise [RuntimeError] if the transport protocol is unknown or the response can't be parsed.
|
||||||
|
# @raise [NotImplementedError] if the transport protocol isn't supported
|
||||||
def send_recv(req)
|
def send_recv(req)
|
||||||
send_request(req)
|
send_request(req)
|
||||||
res = recv_response
|
res = recv_response
|
||||||
|
@ -146,9 +149,9 @@ module Rex
|
||||||
|
|
||||||
# UDP isn't supported
|
# UDP isn't supported
|
||||||
#
|
#
|
||||||
# @raise [RuntimeError]
|
# @raise [NotImplementedError]
|
||||||
def send_request_udp(req)
|
def send_request_udp(req)
|
||||||
raise ::RuntimeError, 'Kerberos Client: UDP unsupported'
|
raise ::NotImplementedError, 'Kerberos Client: UDP unsupported'
|
||||||
end
|
end
|
||||||
|
|
||||||
# Receives a Kerberos Response over a tcp connection
|
# Receives a Kerberos Response over a tcp connection
|
||||||
|
@ -175,9 +178,9 @@ module Rex
|
||||||
|
|
||||||
# UDP isn't supported
|
# UDP isn't supported
|
||||||
#
|
#
|
||||||
# @raise [RuntimeError]
|
# @raise [NotImplementedError]
|
||||||
def recv_response_udp
|
def recv_response_udp
|
||||||
raise ::RuntimeError, 'Kerberos Client: UDP unsupported'
|
raise ::NotImplementedError, 'Kerberos Client: UDP unsupported'
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -101,10 +101,11 @@ module Rex
|
||||||
# Encodes the addrs field
|
# Encodes the addrs field
|
||||||
#
|
#
|
||||||
# @return [String]
|
# @return [String]
|
||||||
|
# @raise [NotImplementedError] if there are addresses to encode
|
||||||
def encode_addrs
|
def encode_addrs
|
||||||
encoded = ''
|
encoded = ''
|
||||||
if addrs.length > 0
|
if addrs.length > 0
|
||||||
raise ::RuntimeError, 'CredentialCache: Credential addresses encoding not supported'
|
raise ::NotImplementedError, 'CredentialCache: Credential addresses encoding not supported'
|
||||||
end
|
end
|
||||||
encoded << [addrs.length].pack('N')
|
encoded << [addrs.length].pack('N')
|
||||||
encoded
|
encoded
|
||||||
|
|
|
@ -27,9 +27,9 @@ module Rex
|
||||||
|
|
||||||
# Rex::Proto::Kerberos::Model::ApReq decoding isn't supported
|
# Rex::Proto::Kerberos::Model::ApReq decoding isn't supported
|
||||||
#
|
#
|
||||||
# @raise [RuntimeError]
|
# @raise [NotImplementedError]
|
||||||
def decode(input)
|
def decode(input)
|
||||||
raise ::RuntimeError, 'AP-REQ decoding not supported'
|
raise ::NotImplementedError, 'AP-REQ decoding not supported'
|
||||||
end
|
end
|
||||||
|
|
||||||
# Encodes the Rex::Proto::Kerberos::Model::ApReq into an ASN.1 String
|
# Encodes the Rex::Proto::Kerberos::Model::ApReq into an ASN.1 String
|
||||||
|
|
|
@ -35,9 +35,9 @@ module Rex
|
||||||
|
|
||||||
# Rex::Proto::Kerberos::Model::Authenticator decoding isn't supported
|
# Rex::Proto::Kerberos::Model::Authenticator decoding isn't supported
|
||||||
#
|
#
|
||||||
# @raise [RuntimeError]
|
# @raise [NotImplementedError]
|
||||||
def decode(input)
|
def decode(input)
|
||||||
raise ::RuntimeError, 'Authenticator decoding not supported'
|
raise ::NotImplementedError, 'Authenticator decoding not supported'
|
||||||
end
|
end
|
||||||
|
|
||||||
# Encodes the Rex::Proto::Kerberos::Model::Authenticator into an ASN.1 String
|
# Encodes the Rex::Proto::Kerberos::Model::Authenticator into an ASN.1 String
|
||||||
|
@ -64,6 +64,7 @@ module Rex
|
||||||
# @param etype [Fixnum] the crypto schema to encrypt
|
# @param etype [Fixnum] the crypto schema to encrypt
|
||||||
# @param key [String] the key to encrypt
|
# @param key [String] the key to encrypt
|
||||||
# @return [String] the encrypted result
|
# @return [String] the encrypted result
|
||||||
|
# @raise [NotImplementedError] if the encryption schema isn't supported
|
||||||
def encrypt(etype, key)
|
def encrypt(etype, key)
|
||||||
data = self.encode
|
data = self.encode
|
||||||
|
|
||||||
|
@ -72,7 +73,7 @@ module Rex
|
||||||
when RC4_HMAC
|
when RC4_HMAC
|
||||||
res = encrypt_rc4_hmac(data, key, 7)
|
res = encrypt_rc4_hmac(data, key, 7)
|
||||||
else
|
else
|
||||||
raise ::RuntimeError, 'EncryptedData schema is not supported'
|
raise ::NotImplementedError, 'EncryptedData schema is not supported'
|
||||||
end
|
end
|
||||||
|
|
||||||
res
|
res
|
||||||
|
|
|
@ -15,9 +15,9 @@ module Rex
|
||||||
|
|
||||||
# Rex::Proto::Kerberos::Model::AuthorizationData decoding isn't supported
|
# Rex::Proto::Kerberos::Model::AuthorizationData decoding isn't supported
|
||||||
#
|
#
|
||||||
# @raise [RuntimeError]
|
# @raise [NotImplementedError]
|
||||||
def decode(input)
|
def decode(input)
|
||||||
raise ::RuntimeError, 'Authorization Data decoding not supported'
|
raise ::NotImplementedError, 'Authorization Data decoding not supported'
|
||||||
end
|
end
|
||||||
|
|
||||||
# Encodes a Rex::Proto::Kerberos::Model::AuthorizationData into an ASN.1 String
|
# Encodes a Rex::Proto::Kerberos::Model::AuthorizationData into an ASN.1 String
|
||||||
|
@ -44,6 +44,7 @@ module Rex
|
||||||
# @param etype [Fixnum] the crypto schema to encrypt
|
# @param etype [Fixnum] the crypto schema to encrypt
|
||||||
# @param key [String] the key to encrypt
|
# @param key [String] the key to encrypt
|
||||||
# @return [String] the encrypted result
|
# @return [String] the encrypted result
|
||||||
|
# @raise [NotImplementedError] if encryption schema isn't supported
|
||||||
def encrypt(etype, key)
|
def encrypt(etype, key)
|
||||||
data = self.encode
|
data = self.encode
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ module Rex
|
||||||
when RC4_HMAC
|
when RC4_HMAC
|
||||||
res = encrypt_rc4_hmac(data, key, 5)
|
res = encrypt_rc4_hmac(data, key, 5)
|
||||||
else
|
else
|
||||||
raise ::RuntimeError, 'EncryptedData schema is not supported'
|
raise ::NotImplementedError, 'EncryptedData schema is not supported'
|
||||||
end
|
end
|
||||||
|
|
||||||
res
|
res
|
||||||
|
|
|
@ -16,9 +16,9 @@ module Rex
|
||||||
|
|
||||||
# Rex::Proto::Kerberos::Model::Checksum decoding isn't supported
|
# Rex::Proto::Kerberos::Model::Checksum decoding isn't supported
|
||||||
#
|
#
|
||||||
# @raise [RuntimeError]
|
# @raise [NotImplementedError]
|
||||||
def decode(input)
|
def decode(input)
|
||||||
raise ::RuntimeError, 'Checksum decoding not supported'
|
raise ::NotImplementedError, 'Checksum decoding not supported'
|
||||||
end
|
end
|
||||||
|
|
||||||
# Encodes a Rex::Proto::Kerberos::Model::Checksum into an ASN.1 String
|
# Encodes a Rex::Proto::Kerberos::Model::Checksum into an ASN.1 String
|
||||||
|
|
|
@ -65,9 +65,9 @@ module Rex
|
||||||
|
|
||||||
# Rex::Proto::Kerberos::Model::EncKdcResponse encoding isn't supported
|
# Rex::Proto::Kerberos::Model::EncKdcResponse encoding isn't supported
|
||||||
#
|
#
|
||||||
# @raise [RuntimeError]
|
# @raise [NotImplementedError]
|
||||||
def encode
|
def encode
|
||||||
raise ::RuntimeError, 'EncKdcResponse encoding not supported'
|
raise ::NotImplementedError, 'EncKdcResponse encoding not supported'
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -61,6 +61,7 @@ module Rex
|
||||||
# @param msg_type [Fixnum] the message type
|
# @param msg_type [Fixnum] the message type
|
||||||
# @return [String] the decrypted `cipher`
|
# @return [String] the decrypted `cipher`
|
||||||
# @raise [RuntimeError] if decryption doesn't succeed
|
# @raise [RuntimeError] if decryption doesn't succeed
|
||||||
|
# @raise [NotImplementedError] if encryption isn't supported
|
||||||
def decrypt(key, msg_type)
|
def decrypt(key, msg_type)
|
||||||
if cipher.nil? || cipher.empty?
|
if cipher.nil? || cipher.empty?
|
||||||
return ''
|
return ''
|
||||||
|
@ -73,7 +74,7 @@ module Rex
|
||||||
raise ::RuntimeError, 'EncryptedData failed to decrypt' if res.length < 8
|
raise ::RuntimeError, 'EncryptedData failed to decrypt' if res.length < 8
|
||||||
res = res[8, res.length - 1]
|
res = res[8, res.length - 1]
|
||||||
else
|
else
|
||||||
raise ::RuntimeError, 'EncryptedData schema is not supported'
|
raise ::NotImplementedError, 'EncryptedData schema is not supported'
|
||||||
end
|
end
|
||||||
|
|
||||||
res
|
res
|
||||||
|
|
|
@ -82,6 +82,7 @@ module Rex
|
||||||
#
|
#
|
||||||
# @param etype [Fixnum] the crypto schema to checksum
|
# @param etype [Fixnum] the crypto schema to checksum
|
||||||
# @return [String] the checksum
|
# @return [String] the checksum
|
||||||
|
# @raise [NotImplementedError] if the encryption schema isn't supported
|
||||||
def checksum(etype)
|
def checksum(etype)
|
||||||
data = self.encode
|
data = self.encode
|
||||||
|
|
||||||
|
@ -90,7 +91,7 @@ module Rex
|
||||||
when RSA_MD5
|
when RSA_MD5
|
||||||
res = checksum_rsa_md5(data)
|
res = checksum_rsa_md5(data)
|
||||||
else
|
else
|
||||||
raise ::RuntimeError, 'EncryptedData schema is not supported'
|
raise ::NotImplementedError, 'EncryptedData schema is not supported'
|
||||||
end
|
end
|
||||||
|
|
||||||
res
|
res
|
||||||
|
|
|
@ -46,9 +46,9 @@ module Rex
|
||||||
|
|
||||||
# Rex::Proto::Kerberos::Model::KdcResponse encoding isn't supported
|
# Rex::Proto::Kerberos::Model::KdcResponse encoding isn't supported
|
||||||
#
|
#
|
||||||
# @raise [RuntimeError]
|
# @raise [NotImplementedError]
|
||||||
def encode
|
def encode
|
||||||
raise ::RuntimeError, 'KdcResponse encoding not supported'
|
raise ::NotImplementedError, 'KdcResponse encoding not supported'
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -64,9 +64,9 @@ module Rex
|
||||||
|
|
||||||
# Rex::Proto::Kerberos::Model::KrbError encoding isn't supported
|
# Rex::Proto::Kerberos::Model::KrbError encoding isn't supported
|
||||||
#
|
#
|
||||||
# @raise [RuntimeError]
|
# @raise [NotImplementedError]
|
||||||
def encode
|
def encode
|
||||||
raise ::RuntimeError, 'KrbError encoding not supported'
|
raise ::NotImplementedError, 'KrbError encoding not supported'
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -34,9 +34,9 @@ module Rex
|
||||||
|
|
||||||
# Rex::Proto::Kerberos::Model::LastRequest encoding isn't supported
|
# Rex::Proto::Kerberos::Model::LastRequest encoding isn't supported
|
||||||
#
|
#
|
||||||
# @raise [RuntimeError]
|
# @raise [NotImplementedError]
|
||||||
def encode
|
def encode
|
||||||
raise ::RuntimeError, 'LastRequest encoding not supported'
|
raise ::NotImplementedError, 'LastRequest encoding not supported'
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -52,6 +52,7 @@ module Rex
|
||||||
# @param etype [Fixnum] the crypto schema to encrypt
|
# @param etype [Fixnum] the crypto schema to encrypt
|
||||||
# @param key [String] the key to encrypt
|
# @param key [String] the key to encrypt
|
||||||
# @return [String] the encrypted result
|
# @return [String] the encrypted result
|
||||||
|
# @raise [NotImplementedError] if encryption schema isn't supported
|
||||||
def encrypt(etype, key)
|
def encrypt(etype, key)
|
||||||
data = self.encode
|
data = self.encode
|
||||||
|
|
||||||
|
@ -60,7 +61,7 @@ module Rex
|
||||||
when RC4_HMAC
|
when RC4_HMAC
|
||||||
res = encrypt_rc4_hmac(data, key, CRYPTO_MSG_TYPE)
|
res = encrypt_rc4_hmac(data, key, CRYPTO_MSG_TYPE)
|
||||||
else
|
else
|
||||||
raise ::RuntimeError, 'EncryptedData schema is not supported'
|
raise ::NotImplementedError, 'EncryptedData schema is not supported'
|
||||||
end
|
end
|
||||||
|
|
||||||
res
|
res
|
||||||
|
|
|
@ -102,13 +102,14 @@ module Rex
|
||||||
#
|
#
|
||||||
# @param data [String] the data to checksum
|
# @param data [String] the data to checksum
|
||||||
# @return [String] the checksum result
|
# @return [String] the checksum result
|
||||||
|
# @raise [NotImplementedError] if checksum schema isn't supported
|
||||||
def make_checksum(data)
|
def make_checksum(data)
|
||||||
res = ''
|
res = ''
|
||||||
case checksum
|
case checksum
|
||||||
when RSA_MD5
|
when RSA_MD5
|
||||||
res = checksum_rsa_md5(data)
|
res = checksum_rsa_md5(data)
|
||||||
else
|
else
|
||||||
raise ::RuntimeError, 'PAC-TYPE checksum not supported'
|
raise ::NotImplementedError, 'PAC-TYPE checksum not supported'
|
||||||
end
|
end
|
||||||
|
|
||||||
res
|
res
|
||||||
|
|
Loading…
Reference in New Issue