raise NotImplementedError

bug/bundler_fix
jvazquez-r7 2014-12-23 19:59:37 -06:00
parent 4493b3285c
commit 05a9ec05e8
14 changed files with 40 additions and 30 deletions

View File

@ -44,7 +44,7 @@ module Rex
when 'tcp'
self.connection = create_tcp_connection
when 'udp'
raise ::RuntimeError, 'Kerberos Client: UDP not supported'
raise ::NotImplementedError, 'Kerberos Client: UDP not supported'
else
raise ::RuntimeError, 'Kerberos Client: unknown transport protocol'
end
@ -66,7 +66,8 @@ module Rex
#
# @param req [Rex::Proto::Kerberos::Model::KdcRequest] the request to send
# @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)
connect
@ -89,6 +90,7 @@ module Rex
# response message
# @raise [RuntimeError] if the connection isn't established, the transport protocol is unknown, not supported
# or the response can't be parsed
# @raise [NotImplementedError] if the transport protocol isn't supported
def recv_response
if connection.nil?
raise ::RuntimeError, 'Kerberos Client: connection not established'
@ -111,7 +113,8 @@ module Rex
#
# @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
# @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)
send_request(req)
res = recv_response
@ -146,9 +149,9 @@ module Rex
# UDP isn't supported
#
# @raise [RuntimeError]
# @raise [NotImplementedError]
def send_request_udp(req)
raise ::RuntimeError, 'Kerberos Client: UDP unsupported'
raise ::NotImplementedError, 'Kerberos Client: UDP unsupported'
end
# Receives a Kerberos Response over a tcp connection
@ -175,9 +178,9 @@ module Rex
# UDP isn't supported
#
# @raise [RuntimeError]
# @raise [NotImplementedError]
def recv_response_udp
raise ::RuntimeError, 'Kerberos Client: UDP unsupported'
raise ::NotImplementedError, 'Kerberos Client: UDP unsupported'
end
private

View File

@ -101,10 +101,11 @@ module Rex
# Encodes the addrs field
#
# @return [String]
# @raise [NotImplementedError] if there are addresses to encode
def encode_addrs
encoded = ''
if addrs.length > 0
raise ::RuntimeError, 'CredentialCache: Credential addresses encoding not supported'
raise ::NotImplementedError, 'CredentialCache: Credential addresses encoding not supported'
end
encoded << [addrs.length].pack('N')
encoded

View File

@ -27,9 +27,9 @@ module Rex
# Rex::Proto::Kerberos::Model::ApReq decoding isn't supported
#
# @raise [RuntimeError]
# @raise [NotImplementedError]
def decode(input)
raise ::RuntimeError, 'AP-REQ decoding not supported'
raise ::NotImplementedError, 'AP-REQ decoding not supported'
end
# Encodes the Rex::Proto::Kerberos::Model::ApReq into an ASN.1 String

View File

@ -35,9 +35,9 @@ module Rex
# Rex::Proto::Kerberos::Model::Authenticator decoding isn't supported
#
# @raise [RuntimeError]
# @raise [NotImplementedError]
def decode(input)
raise ::RuntimeError, 'Authenticator decoding not supported'
raise ::NotImplementedError, 'Authenticator decoding not supported'
end
# 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 key [String] the key to encrypt
# @return [String] the encrypted result
# @raise [NotImplementedError] if the encryption schema isn't supported
def encrypt(etype, key)
data = self.encode
@ -72,7 +73,7 @@ module Rex
when RC4_HMAC
res = encrypt_rc4_hmac(data, key, 7)
else
raise ::RuntimeError, 'EncryptedData schema is not supported'
raise ::NotImplementedError, 'EncryptedData schema is not supported'
end
res

View File

@ -15,9 +15,9 @@ module Rex
# Rex::Proto::Kerberos::Model::AuthorizationData decoding isn't supported
#
# @raise [RuntimeError]
# @raise [NotImplementedError]
def decode(input)
raise ::RuntimeError, 'Authorization Data decoding not supported'
raise ::NotImplementedError, 'Authorization Data decoding not supported'
end
# 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 key [String] the key to encrypt
# @return [String] the encrypted result
# @raise [NotImplementedError] if encryption schema isn't supported
def encrypt(etype, key)
data = self.encode
@ -52,7 +53,7 @@ module Rex
when RC4_HMAC
res = encrypt_rc4_hmac(data, key, 5)
else
raise ::RuntimeError, 'EncryptedData schema is not supported'
raise ::NotImplementedError, 'EncryptedData schema is not supported'
end
res

View File

@ -16,9 +16,9 @@ module Rex
# Rex::Proto::Kerberos::Model::Checksum decoding isn't supported
#
# @raise [RuntimeError]
# @raise [NotImplementedError]
def decode(input)
raise ::RuntimeError, 'Checksum decoding not supported'
raise ::NotImplementedError, 'Checksum decoding not supported'
end
# Encodes a Rex::Proto::Kerberos::Model::Checksum into an ASN.1 String

View File

@ -65,9 +65,9 @@ module Rex
# Rex::Proto::Kerberos::Model::EncKdcResponse encoding isn't supported
#
# @raise [RuntimeError]
# @raise [NotImplementedError]
def encode
raise ::RuntimeError, 'EncKdcResponse encoding not supported'
raise ::NotImplementedError, 'EncKdcResponse encoding not supported'
end
private

View File

@ -61,6 +61,7 @@ module Rex
# @param msg_type [Fixnum] the message type
# @return [String] the decrypted `cipher`
# @raise [RuntimeError] if decryption doesn't succeed
# @raise [NotImplementedError] if encryption isn't supported
def decrypt(key, msg_type)
if cipher.nil? || cipher.empty?
return ''
@ -73,7 +74,7 @@ module Rex
raise ::RuntimeError, 'EncryptedData failed to decrypt' if res.length < 8
res = res[8, res.length - 1]
else
raise ::RuntimeError, 'EncryptedData schema is not supported'
raise ::NotImplementedError, 'EncryptedData schema is not supported'
end
res

View File

@ -82,6 +82,7 @@ module Rex
#
# @param etype [Fixnum] the crypto schema to checksum
# @return [String] the checksum
# @raise [NotImplementedError] if the encryption schema isn't supported
def checksum(etype)
data = self.encode
@ -90,7 +91,7 @@ module Rex
when RSA_MD5
res = checksum_rsa_md5(data)
else
raise ::RuntimeError, 'EncryptedData schema is not supported'
raise ::NotImplementedError, 'EncryptedData schema is not supported'
end
res

View File

@ -46,9 +46,9 @@ module Rex
# Rex::Proto::Kerberos::Model::KdcResponse encoding isn't supported
#
# @raise [RuntimeError]
# @raise [NotImplementedError]
def encode
raise ::RuntimeError, 'KdcResponse encoding not supported'
raise ::NotImplementedError, 'KdcResponse encoding not supported'
end
private

View File

@ -64,9 +64,9 @@ module Rex
# Rex::Proto::Kerberos::Model::KrbError encoding isn't supported
#
# @raise [RuntimeError]
# @raise [NotImplementedError]
def encode
raise ::RuntimeError, 'KrbError encoding not supported'
raise ::NotImplementedError, 'KrbError encoding not supported'
end
private

View File

@ -34,9 +34,9 @@ module Rex
# Rex::Proto::Kerberos::Model::LastRequest encoding isn't supported
#
# @raise [RuntimeError]
# @raise [NotImplementedError]
def encode
raise ::RuntimeError, 'LastRequest encoding not supported'
raise ::NotImplementedError, 'LastRequest encoding not supported'
end
private

View File

@ -52,6 +52,7 @@ module Rex
# @param etype [Fixnum] the crypto schema to encrypt
# @param key [String] the key to encrypt
# @return [String] the encrypted result
# @raise [NotImplementedError] if encryption schema isn't supported
def encrypt(etype, key)
data = self.encode
@ -60,7 +61,7 @@ module Rex
when RC4_HMAC
res = encrypt_rc4_hmac(data, key, CRYPTO_MSG_TYPE)
else
raise ::RuntimeError, 'EncryptedData schema is not supported'
raise ::NotImplementedError, 'EncryptedData schema is not supported'
end
res

View File

@ -102,13 +102,14 @@ module Rex
#
# @param data [String] the data to checksum
# @return [String] the checksum result
# @raise [NotImplementedError] if checksum schema isn't supported
def make_checksum(data)
res = ''
case checksum
when RSA_MD5
res = checksum_rsa_md5(data)
else
raise ::RuntimeError, 'PAC-TYPE checksum not supported'
raise ::NotImplementedError, 'PAC-TYPE checksum not supported'
end
res