Handle OpenSSL errors

This commit is contained in:
Alexandre Dulaunoy 2015-04-24 08:08:27 +02:00
parent e2c3629964
commit b54dc68991

View file

@ -55,7 +55,11 @@ for l in fileinput.input(args.r):
dercert = binascii.unhexlify(a) dercert = binascii.unhexlify(a)
except TypeError: except TypeError:
continue continue
x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_ASN1, dercert) try:
x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_ASN1, dercert)
except OpenSSL.crypto.Error:
continue
c['fp'] = x509.digest('sha1').replace(':','').lower() c['fp'] = x509.digest('sha1').replace(':','').lower()
if args.v: if args.v:
print "("+c['session']+") "+c['srcip']+"<->"+c['dstip']+":"+c['dstport'] print "("+c['session']+") "+c['srcip']+"<->"+c['dstip']+":"+c['dstport']