Skip to content

Commit 05a9ec0

Browse files
committed
raise NotImplementedError
1 parent 4493b32 commit 05a9ec0

14 files changed

+40
-30
lines changed

lib/rex/proto/kerberos/client.rb

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def connect
4444
when 'tcp'
4545
self.connection = create_tcp_connection
4646
when 'udp'
47-
raise ::RuntimeError, 'Kerberos Client: UDP not supported'
47+
raise ::NotImplementedError, 'Kerberos Client: UDP not supported'
4848
else
4949
raise ::RuntimeError, 'Kerberos Client: unknown transport protocol'
5050
end
@@ -66,7 +66,8 @@ def close
6666
#
6767
# @param req [Rex::Proto::Kerberos::Model::KdcRequest] the request to send
6868
# @return [Fixnum] the number of bytes sent
69-
# @raise [RuntimeError] if the transport protocol is unknown or not supported
69+
# @raise [RuntimeError] if the transport protocol is unknown
70+
# @raise [NotImplementedError] if the transport protocol isn't supported
7071
def send_request(req)
7172
connect
7273

@@ -89,6 +90,7 @@ def send_request(req)
8990
# response message
9091
# @raise [RuntimeError] if the connection isn't established, the transport protocol is unknown, not supported
9192
# or the response can't be parsed
93+
# @raise [NotImplementedError] if the transport protocol isn't supported
9294
def recv_response
9395
if connection.nil?
9496
raise ::RuntimeError, 'Kerberos Client: connection not established'
@@ -111,7 +113,8 @@ def recv_response
111113
#
112114
# @param req [Rex::Proto::Kerberos::Model::KdcRequest] the request to send
113115
# @return [<Rex::Proto::Kerberos::Model::KrbError, Rex::Proto::Kerberos::Model::KdcResponse>] The kerberos message
114-
# @raise [RuntimeError] if the transport protocol is unknown, not supported, or the response can't be parsed.
116+
# @raise [RuntimeError] if the transport protocol is unknown or the response can't be parsed.
117+
# @raise [NotImplementedError] if the transport protocol isn't supported
115118
def send_recv(req)
116119
send_request(req)
117120
res = recv_response
@@ -146,9 +149,9 @@ def send_request_tcp(req)
146149

147150
# UDP isn't supported
148151
#
149-
# @raise [RuntimeError]
152+
# @raise [NotImplementedError]
150153
def send_request_udp(req)
151-
raise ::RuntimeError, 'Kerberos Client: UDP unsupported'
154+
raise ::NotImplementedError, 'Kerberos Client: UDP unsupported'
152155
end
153156

154157
# Receives a Kerberos Response over a tcp connection
@@ -175,9 +178,9 @@ def recv_response_tcp
175178

176179
# UDP isn't supported
177180
#
178-
# @raise [RuntimeError]
181+
# @raise [NotImplementedError]
179182
def recv_response_udp
180-
raise ::RuntimeError, 'Kerberos Client: UDP unsupported'
183+
raise ::NotImplementedError, 'Kerberos Client: UDP unsupported'
181184
end
182185

183186
private

lib/rex/proto/kerberos/credential_cache/credential.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,11 @@ def encode_tkt_flags
101101
# Encodes the addrs field
102102
#
103103
# @return [String]
104+
# @raise [NotImplementedError] if there are addresses to encode
104105
def encode_addrs
105106
encoded = ''
106107
if addrs.length > 0
107-
raise ::RuntimeError, 'CredentialCache: Credential addresses encoding not supported'
108+
raise ::NotImplementedError, 'CredentialCache: Credential addresses encoding not supported'
108109
end
109110
encoded << [addrs.length].pack('N')
110111
encoded

lib/rex/proto/kerberos/model/ap_req.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ class ApReq < Element
2727

2828
# Rex::Proto::Kerberos::Model::ApReq decoding isn't supported
2929
#
30-
# @raise [RuntimeError]
30+
# @raise [NotImplementedError]
3131
def decode(input)
32-
raise ::RuntimeError, 'AP-REQ decoding not supported'
32+
raise ::NotImplementedError, 'AP-REQ decoding not supported'
3333
end
3434

3535
# Encodes the Rex::Proto::Kerberos::Model::ApReq into an ASN.1 String

lib/rex/proto/kerberos/model/authenticator.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ class Authenticator < Element
3535

3636
# Rex::Proto::Kerberos::Model::Authenticator decoding isn't supported
3737
#
38-
# @raise [RuntimeError]
38+
# @raise [NotImplementedError]
3939
def decode(input)
40-
raise ::RuntimeError, 'Authenticator decoding not supported'
40+
raise ::NotImplementedError, 'Authenticator decoding not supported'
4141
end
4242

4343
# Encodes the Rex::Proto::Kerberos::Model::Authenticator into an ASN.1 String
@@ -64,6 +64,7 @@ def encode
6464
# @param etype [Fixnum] the crypto schema to encrypt
6565
# @param key [String] the key to encrypt
6666
# @return [String] the encrypted result
67+
# @raise [NotImplementedError] if the encryption schema isn't supported
6768
def encrypt(etype, key)
6869
data = self.encode
6970

@@ -72,7 +73,7 @@ def encrypt(etype, key)
7273
when RC4_HMAC
7374
res = encrypt_rc4_hmac(data, key, 7)
7475
else
75-
raise ::RuntimeError, 'EncryptedData schema is not supported'
76+
raise ::NotImplementedError, 'EncryptedData schema is not supported'
7677
end
7778

7879
res

lib/rex/proto/kerberos/model/authorization_data.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ class AuthorizationData < Element
1515

1616
# Rex::Proto::Kerberos::Model::AuthorizationData decoding isn't supported
1717
#
18-
# @raise [RuntimeError]
18+
# @raise [NotImplementedError]
1919
def decode(input)
20-
raise ::RuntimeError, 'Authorization Data decoding not supported'
20+
raise ::NotImplementedError, 'Authorization Data decoding not supported'
2121
end
2222

2323
# Encodes a Rex::Proto::Kerberos::Model::AuthorizationData into an ASN.1 String
@@ -44,6 +44,7 @@ def encode
4444
# @param etype [Fixnum] the crypto schema to encrypt
4545
# @param key [String] the key to encrypt
4646
# @return [String] the encrypted result
47+
# @raise [NotImplementedError] if encryption schema isn't supported
4748
def encrypt(etype, key)
4849
data = self.encode
4950

@@ -52,7 +53,7 @@ def encrypt(etype, key)
5253
when RC4_HMAC
5354
res = encrypt_rc4_hmac(data, key, 5)
5455
else
55-
raise ::RuntimeError, 'EncryptedData schema is not supported'
56+
raise ::NotImplementedError, 'EncryptedData schema is not supported'
5657
end
5758

5859
res

lib/rex/proto/kerberos/model/checksum.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class Checksum < Element
1616

1717
# Rex::Proto::Kerberos::Model::Checksum decoding isn't supported
1818
#
19-
# @raise [RuntimeError]
19+
# @raise [NotImplementedError]
2020
def decode(input)
21-
raise ::RuntimeError, 'Checksum decoding not supported'
21+
raise ::NotImplementedError, 'Checksum decoding not supported'
2222
end
2323

2424
# Encodes a Rex::Proto::Kerberos::Model::Checksum into an ASN.1 String

lib/rex/proto/kerberos/model/enc_kdc_response.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ def decode(input)
6565

6666
# Rex::Proto::Kerberos::Model::EncKdcResponse encoding isn't supported
6767
#
68-
# @raise [RuntimeError]
68+
# @raise [NotImplementedError]
6969
def encode
70-
raise ::RuntimeError, 'EncKdcResponse encoding not supported'
70+
raise ::NotImplementedError, 'EncKdcResponse encoding not supported'
7171
end
7272

7373
private

lib/rex/proto/kerberos/model/encrypted_data.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def encode
6161
# @param msg_type [Fixnum] the message type
6262
# @return [String] the decrypted `cipher`
6363
# @raise [RuntimeError] if decryption doesn't succeed
64+
# @raise [NotImplementedError] if encryption isn't supported
6465
def decrypt(key, msg_type)
6566
if cipher.nil? || cipher.empty?
6667
return ''
@@ -73,7 +74,7 @@ def decrypt(key, msg_type)
7374
raise ::RuntimeError, 'EncryptedData failed to decrypt' if res.length < 8
7475
res = res[8, res.length - 1]
7576
else
76-
raise ::RuntimeError, 'EncryptedData schema is not supported'
77+
raise ::NotImplementedError, 'EncryptedData schema is not supported'
7778
end
7879

7980
res

lib/rex/proto/kerberos/model/kdc_request_body.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def encode
8282
#
8383
# @param etype [Fixnum] the crypto schema to checksum
8484
# @return [String] the checksum
85+
# @raise [NotImplementedError] if the encryption schema isn't supported
8586
def checksum(etype)
8687
data = self.encode
8788

@@ -90,7 +91,7 @@ def checksum(etype)
9091
when RSA_MD5
9192
res = checksum_rsa_md5(data)
9293
else
93-
raise ::RuntimeError, 'EncryptedData schema is not supported'
94+
raise ::NotImplementedError, 'EncryptedData schema is not supported'
9495
end
9596

9697
res

lib/rex/proto/kerberos/model/kdc_response.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ def decode(input)
4646

4747
# Rex::Proto::Kerberos::Model::KdcResponse encoding isn't supported
4848
#
49-
# @raise [RuntimeError]
49+
# @raise [NotImplementedError]
5050
def encode
51-
raise ::RuntimeError, 'KdcResponse encoding not supported'
51+
raise ::NotImplementedError, 'KdcResponse encoding not supported'
5252
end
5353

5454
private

0 commit comments

Comments
 (0)