mirror of
https://github.com/adulau/crl-monitor.git
synced 2024-11-22 01:57:05 +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 OpenSSL
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
|
import base64
|
||||||
|
|
||||||
argParser = argparse.ArgumentParser(description='Extract certificate to PEM format from an ssldump output')
|
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('-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('-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')
|
argParser.add_argument('-r', default='-', help='Read from a file, default is stdin')
|
||||||
args = argParser.parse_args()
|
args = argParser.parse_args()
|
||||||
|
@ -61,6 +63,8 @@ for l in fileinput.input(args.r):
|
||||||
print (json.dumps(c))
|
print (json.dumps(c))
|
||||||
elif args.f:
|
elif args.f:
|
||||||
print (c['dstip']+","+c['fp']+","+x509.get_subject().CN)
|
print (c['dstip']+","+c['fp']+","+x509.get_subject().CN)
|
||||||
|
elif args.s:
|
||||||
|
print (c['fp']+","+base64.standard_b64encode(dercert))
|
||||||
else:
|
else:
|
||||||
print (c['pem'])
|
print (c['pem'])
|
||||||
certstring = ""
|
certstring = ""
|
||||||
|
|
Loading…
Reference in a new issue