diff --git a/scripts/ssl-cert.nse b/scripts/ssl-cert.nse index b878a80ce..e785dc4d7 100644 --- a/scripts/ssl-cert.nse +++ b/scripts/ssl-cert.nse @@ -25,13 +25,13 @@ With -v it adds the issuer name and fingerprints. | ssl-cert: Subject: commonName=www.paypal.com/organizationName=PayPal, Inc.\ /stateOrProvinceName=California/countryName=US | Issuer: commonName=VeriSign Class 3 Extended Validation SSL CA\ -/organizationName=VeriSign, Inc./countryName=US -| Public Key type: rsa -| Public Key bits: 2048 -| Signature Algorithm: sha1WithRSAEncryption -| Not valid before: 2011-03-23 00:00:00 -| Not valid after: 2013-04-01 23:59:59 -| MD5: bf47 ceca d861 efa7 7d14 88ad 4a73 cb5b +/organizationName=VeriSign, Inc./countryName=US +| Public Key type: rsa +| Public Key bits: 2048 +| Signature Algorithm: sha1WithRSAEncryption +| Not valid before: 2011-03-23 00:00:00 +| Not valid after: 2013-04-01 23:59:59 +| MD5: bf47 ceca d861 efa7 7d14 88ad 4a73 cb5b |_SHA-1: d846 5221 467a 0d15 3df0 9f2e af6d 4390 0213 9a68 @@ -47,13 +47,13 @@ certificate. /organizationalUnitName=PayPal Production/businessCategory=Private Organization | Issuer: commonName=VeriSign Class 3 Extended Validation SSL CA\ /organizationName=VeriSign, Inc./countryName=US\ -/organizationalUnitName=Terms of use at https://www.verisign.com/rpa (c)06 -| Public Key type: rsa -| Public Key bits: 2048 -| Signature Algorithm: sha1WithRSAEncryption -| Not valid before: 2011-03-23 00:00:00 -| Not valid after: 2013-04-01 23:59:59 -| MD5: bf47 ceca d861 efa7 7d14 88ad 4a73 cb5b +/organizationalUnitName=Terms of use at https://www.verisign.com/rpa (c)06 +| Public Key type: rsa +| Public Key bits: 2048 +| Signature Algorithm: sha1WithRSAEncryption +| Not valid before: 2011-03-23 00:00:00 +| Not valid after: 2013-04-01 23:59:59 +| MD5: bf47 ceca d861 efa7 7d14 88ad 4a73 cb5b | SHA-1: d846 5221 467a 0d15 3df0 9f2e af6d 4390 0213 9a68 | -----BEGIN CERTIFICATE----- | MIIGSzCCBTOgAwIBAgIQLjOHT2/i1B7T//819qTJGDANBgkqhkiG9w0BAQUFADCB @@ -93,13 +93,13 @@ certificate. -- US -- -- --- rsa --- 2048 ---
--- sha1WithRSAEncryption --- --- 2011-03-23T00:00:00+00:00 --- 2013-04-01T23:59:59+00:00 +-- rsa +-- 2048 +--
+-- sha1WithRSAEncryption +-- +-- 2011-03-23T00:00:00+00:00 +-- 2013-04-01T23:59:59+00:00 --
-- bf47cecad861efa77d1488ad4a73cb5b -- d8465221467a0d153df09f2eaf6d439002139a68 @@ -187,13 +187,13 @@ end local function output_tab(cert) local o = stdnse.output_table() - o.subject = name_to_table(cert.subject) - o.issuer = name_to_table(cert.issuer) - o.pubkey = cert.pubkey - o.sig_algo = cert.sig_algorithm - o.validity = {} - for k, v in pairs(cert.validity) do - if type(v)=="string" then + o.subject = name_to_table(cert.subject) + o.issuer = name_to_table(cert.issuer) + o.pubkey = cert.pubkey + o.sig_algo = cert.sig_algorithm + o.validity = {} + for k, v in pairs(cert.validity) do + if type(v)=="string" then o.validity[k] = v else o.validity[k] = stdnse.format_timestamp(v) @@ -214,13 +214,13 @@ local function output_str(cert) lines[#lines + 1] = "Issuer: " .. stringify_name(cert.issuer) end - if nmap.verbosity() > 0 then - lines[#lines + 1] = "Public Key type: " .. cert.pubkey.type - lines[#lines + 1] = "Public Key bits: " .. cert.pubkey.bits - lines[#lines + 1] = "Signature Algorithm: " .. cert.sig_algorithm - end - - lines[#lines + 1] = "Not valid before: " .. + if nmap.verbosity() > 0 then + lines[#lines + 1] = "Public Key type: " .. cert.pubkey.type + lines[#lines + 1] = "Public Key bits: " .. cert.pubkey.bits + lines[#lines + 1] = "Signature Algorithm: " .. cert.sig_algorithm + end + + lines[#lines + 1] = "Not valid before: " .. date_to_string(cert.validity.notBefore) lines[#lines + 1] = "Not valid after: " .. date_to_string(cert.validity.notAfter)