Skip to content

Commit 29d1022

Browse files
committed
Fix the rake spec failures under ruby 2.4.
Ths typo3_spec is giving some errors under ruby 2.4+ and OpenSSL 1.1+.
1 parent 10cedf8 commit 29d1022

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/msf/core/exploit/http/typo3/login.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,13 @@ def typo3_helper_login_rsa(e, n, password)
100100
key = OpenSSL::PKey::RSA.new
101101
exponent = OpenSSL::BN.new e.hex.to_s
102102
modulus = OpenSSL::BN.new n.hex.to_s
103-
key.e = exponent
104-
key.n = modulus
103+
if key.respond_to?(:set_key)
104+
# Ruby 2.4+
105+
key.set_key(modulus, exponent, nil)
106+
else
107+
key.e = exponent
108+
key.n = modulus
109+
end
105110
enc = key.public_encrypt(password)
106111
enc_b64 = Rex::Text.encode_base64(enc)
107112
"rsa:#{enc_b64}"

0 commit comments

Comments
 (0)