mirror of
https://github.com/adulau/crl-monitor.git
synced 2024-12-22 16:56:01 +00:00
Output compatible with scans.io format (host and certs)
This commit is contained in:
parent
41c032b930
commit
8ea59f8a68
1 changed files with 5 additions and 1 deletions
|
@ -13,10 +13,12 @@ import binascii
|
|||
import OpenSSL
|
||||
import argparse
|
||||
import json
|
||||
import base64
|
||||
|
||||
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('-f', default=False, action='store_true', help='Print certificate SHA1 fingerprint and destination IP addresses only')
|
||||
argParser.add_argument('-f', default=False, action='store_true', help='CSV format - IP, certificate fingerprint, CN (scans.io host format)')
|
||||
argParser.add_argument('-s', default=False, action='store_true', help='CSV format - certificate fingerprint, base64 DER encoded certificate (scans.io certs format)')
|
||||
argParser.add_argument('-j', default=False, action='store_true', help='Dump JSON object per certificate')
|
||||
argParser.add_argument('-r', default='-', help='Read from a file, default is stdin')
|
||||
args = argParser.parse_args()
|
||||
|
@ -61,6 +63,8 @@ for l in fileinput.input(args.r):
|
|||
print (json.dumps(c))
|
||||
elif args.f:
|
||||
print (c['dstip']+","+c['fp']+","+x509.get_subject().CN)
|
||||
elif args.s:
|
||||
print (c['fp']+","+base64.standard_b64encode(dercert))
|
||||
else:
|
||||
print (c['pem'])
|
||||
certstring = ""
|
||||
|
|
Loading…
Reference in a new issue