diff --git a/bin/x509/icsi.py b/bin/x509/icsi.py new file mode 100644 index 0000000..9b0b3c6 --- /dev/null +++ b/bin/x509/icsi.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# ICSI Notary lookup of FP +# +# Software is free software released under the GNU General Public License version 3 and later +# +# Copyright (c) 2015 Alexandre Dulaunoy - a@foo.be + + +import dns.resolver +import argparse +import fileinput + +suffix = '.notary.icsi.berkeley.edu' + +resolver = dns.resolver.Resolver() +fp = '592978A72A9061F70AD7C44C4D449DCF258CD534' + +argParser = argparse.ArgumentParser(description='Lookup a series of certificate fingerprints ICSI Certificate Notary') +argParser.add_argument('-r', default='-', help='Read from a file, default is stdin') +args = argParser.parse_args() + +for l in fileinput.input(args.r): + fp = l.rstrip() + try: + r = resolver.query(fp+suffix, 'TXT')[0] + except: + print ("Non-existing certificate {}".format(fp)) + continue + print ("{},{}".format(fp,r))