Fix the rake spec failures under ruby 2.4.

Ths typo3_spec is giving some errors under ruby 2.4+
and OpenSSL 1.1+.
bug/bundler_fix
Renato Piccoli 2017-05-19 21:57:28 +02:00
parent 10cedf81b3
commit 29d1022ae2
1 changed files with 7 additions and 2 deletions

View File

@ -100,8 +100,13 @@ module Msf::Exploit::Remote::HTTP::Typo3::Login
key = OpenSSL::PKey::RSA.new
exponent = OpenSSL::BN.new e.hex.to_s
modulus = OpenSSL::BN.new n.hex.to_s
key.e = exponent
key.n = modulus
if key.respond_to?(:set_key)
# Ruby 2.4+
key.set_key(modulus, exponent, nil)
else
key.e = exponent
key.n = modulus
end
enc = key.public_encrypt(password)
enc_b64 = Rex::Text.encode_base64(enc)
"rsa:#{enc_b64}"