Skip to content

Commit 8e80f5e

Browse files
committed
Public key size determined properly
1 parent 3da4c4f commit 8e80f5e

File tree

1 file changed

+1
-7
lines changed
  • modules/auxiliary/scanner/http

1 file changed

+1
-7
lines changed

modules/auxiliary/scanner/http/ssl.rb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,7 @@ def run_host(ip)
5353
print_status("#{ip}:#{rport} Subject: #{cert.subject}")
5454
print_status("#{ip}:#{rport} Issuer: #{cert.issuer}")
5555
print_status("#{ip}:#{rport} Signature Alg: #{cert.signature_algorithm}")
56-
public_key = cert.public_key.to_pem()
57-
# removing header and footer
58-
public_key = public_key.sub("-----BEGIN RSA PUBLIC KEY-----","")
59-
public_key = public_key.sub("-----END RSA PUBLIC KEY-----","")
60-
public_key_size = Rex::Text.decode_base64(public_key).size
61-
# removing 12 bytes for some shmoo of exponent and modulus and turn bytes into bits
62-
public_key_size = (public_key_size - 12) * 8
56+
public_key_size = cert.public_key.n.num_bytes * 8
6357
print_status("#{ip}:#{rport} Public Key Size: #{public_key_size} bits")
6458
print_status("#{ip}:#{rport} Not Valid Before: #{cert.not_before}")
6559
print_status("#{ip}:#{rport} Not Valid After: #{cert.not_after}")

0 commit comments

Comments
 (0)