diff --git a/bin/x509/pcap-sslcert.py b/bin/x509/pcap-sslcert.py index 6f9d7a8..c05ae42 100644 --- a/bin/x509/pcap-sslcert.py +++ b/bin/x509/pcap-sslcert.py @@ -14,6 +14,7 @@ import OpenSSL import argparse argParser = argparse.ArgumentParser(description='Extract certificate to PEM format from an ssldump output') +argParser.add_argument('-v', default=False, action='store_true', help='Verbose output') argParser.add_argument('-r', default='-', help='Read from a file, default is stdin') args = argParser.parse_args() @@ -39,6 +40,9 @@ for l in fileinput.input(args.r): dercert = binascii.unhexlify(a) x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_ASN1, dercert) fp = x509.digest('sha1').replace(':','').lower() + if args.v: + print "Issuer: " + x509.get_issuer().CN + print "CN: " + x509.get_subject().CN print OpenSSL.crypto.dump_certificate(OpenSSL.crypto.FILETYPE_PEM, x509) certstring = "" y = ""