diff --git a/lib/rex/proto/kerberos/client.rb b/lib/rex/proto/kerberos/client.rb index 603c5b0fac..48af233ddb 100644 --- a/lib/rex/proto/kerberos/client.rb +++ b/lib/rex/proto/kerberos/client.rb @@ -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 [] 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 diff --git a/lib/rex/proto/kerberos/credential_cache/credential.rb b/lib/rex/proto/kerberos/credential_cache/credential.rb index dc6fcdfb77..3b9ecd8db3 100644 --- a/lib/rex/proto/kerberos/credential_cache/credential.rb +++ b/lib/rex/proto/kerberos/credential_cache/credential.rb @@ -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 diff --git a/lib/rex/proto/kerberos/model/ap_req.rb b/lib/rex/proto/kerberos/model/ap_req.rb index 2788dcc62e..e50896d475 100644 --- a/lib/rex/proto/kerberos/model/ap_req.rb +++ b/lib/rex/proto/kerberos/model/ap_req.rb @@ -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 diff --git a/lib/rex/proto/kerberos/model/authenticator.rb b/lib/rex/proto/kerberos/model/authenticator.rb index 1517786f39..f849830b99 100644 --- a/lib/rex/proto/kerberos/model/authenticator.rb +++ b/lib/rex/proto/kerberos/model/authenticator.rb @@ -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 diff --git a/lib/rex/proto/kerberos/model/authorization_data.rb b/lib/rex/proto/kerberos/model/authorization_data.rb index a63ff55260..ef8c74990c 100644 --- a/lib/rex/proto/kerberos/model/authorization_data.rb +++ b/lib/rex/proto/kerberos/model/authorization_data.rb @@ -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 diff --git a/lib/rex/proto/kerberos/model/checksum.rb b/lib/rex/proto/kerberos/model/checksum.rb index 6dbdeb70c4..ccd4f9c6b7 100644 --- a/lib/rex/proto/kerberos/model/checksum.rb +++ b/lib/rex/proto/kerberos/model/checksum.rb @@ -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 diff --git a/lib/rex/proto/kerberos/model/enc_kdc_response.rb b/lib/rex/proto/kerberos/model/enc_kdc_response.rb index b960d48b83..dd8868f68e 100644 --- a/lib/rex/proto/kerberos/model/enc_kdc_response.rb +++ b/lib/rex/proto/kerberos/model/enc_kdc_response.rb @@ -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 diff --git a/lib/rex/proto/kerberos/model/encrypted_data.rb b/lib/rex/proto/kerberos/model/encrypted_data.rb index 9fb8a4f754..17425adb35 100644 --- a/lib/rex/proto/kerberos/model/encrypted_data.rb +++ b/lib/rex/proto/kerberos/model/encrypted_data.rb @@ -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 diff --git a/lib/rex/proto/kerberos/model/kdc_request_body.rb b/lib/rex/proto/kerberos/model/kdc_request_body.rb index fce0b59328..d9f2baacf7 100644 --- a/lib/rex/proto/kerberos/model/kdc_request_body.rb +++ b/lib/rex/proto/kerberos/model/kdc_request_body.rb @@ -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 diff --git a/lib/rex/proto/kerberos/model/kdc_response.rb b/lib/rex/proto/kerberos/model/kdc_response.rb index 8d43a9e123..02c119d5b7 100644 --- a/lib/rex/proto/kerberos/model/kdc_response.rb +++ b/lib/rex/proto/kerberos/model/kdc_response.rb @@ -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 diff --git a/lib/rex/proto/kerberos/model/krb_error.rb b/lib/rex/proto/kerberos/model/krb_error.rb index d4a58a55dc..e20772e86d 100644 --- a/lib/rex/proto/kerberos/model/krb_error.rb +++ b/lib/rex/proto/kerberos/model/krb_error.rb @@ -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 diff --git a/lib/rex/proto/kerberos/model/last_request.rb b/lib/rex/proto/kerberos/model/last_request.rb index adcd01c2f9..cd9bdd4837 100644 --- a/lib/rex/proto/kerberos/model/last_request.rb +++ b/lib/rex/proto/kerberos/model/last_request.rb @@ -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 diff --git a/lib/rex/proto/kerberos/model/pre_auth_enc_time_stamp.rb b/lib/rex/proto/kerberos/model/pre_auth_enc_time_stamp.rb index 62c24c0ccd..76415db244 100644 --- a/lib/rex/proto/kerberos/model/pre_auth_enc_time_stamp.rb +++ b/lib/rex/proto/kerberos/model/pre_auth_enc_time_stamp.rb @@ -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 diff --git a/lib/rex/proto/kerberos/pac/type.rb b/lib/rex/proto/kerberos/pac/type.rb index 7643ad8115..980461ea02 100644 --- a/lib/rex/proto/kerberos/pac/type.rb +++ b/lib/rex/proto/kerberos/pac/type.rb @@ -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