mirror of
https://github.com/adulau/crl-monitor.git
synced 2024-11-22 10:07:05 +00:00
Option to read from file added
This commit is contained in:
parent
9ba1adc8f4
commit
b1bdae9f89
1 changed files with 6 additions and 1 deletions
|
@ -11,6 +11,11 @@ import fileinput
|
||||||
import re
|
import re
|
||||||
import binascii
|
import binascii
|
||||||
import OpenSSL
|
import OpenSSL
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
argParser = argparse.ArgumentParser(description='Extract certificate to PEM format from an ssldump output')
|
||||||
|
argParser.add_argument('-r', default='-', help='Read from a file, default is stdin')
|
||||||
|
args = argParser.parse_args()
|
||||||
|
|
||||||
cert = None
|
cert = None
|
||||||
certstring = ""
|
certstring = ""
|
||||||
|
@ -18,7 +23,7 @@ certstring = ""
|
||||||
certtag = re.compile('^\s+Certificate\s*$')
|
certtag = re.compile('^\s+Certificate\s*$')
|
||||||
certtagend = re.compile('^\S+')
|
certtagend = re.compile('^\S+')
|
||||||
|
|
||||||
for l in fileinput.input():
|
for l in fileinput.input(args.r):
|
||||||
if certtag.match(l):
|
if certtag.match(l):
|
||||||
cert = True
|
cert = True
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in a new issue