aboutsummaryrefslogtreecommitdiff
path: root/rp/utils/scan_routercerts
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2015-10-26 06:29:00 +0000
committerRob Austein <sra@hactrn.net>2015-10-26 06:29:00 +0000
commitb46deb1417dc3596e9ac9fe2fe8cc0b7f42457e7 (patch)
treeca0dc0276d1adc168bc3337ce0564c4ec4957c1b /rp/utils/scan_routercerts
parent397beaf6d9900dc3b3cb612c89ebf1d57b1d16f6 (diff)
"Any programmer who fails to comply with the standard naming, formatting,
or commenting conventions should be shot. If it so happens that it is inconvenient to shoot him, then he is to be politely requested to recode his program in adherence to the above standard." -- Michael Spier, Digital Equipment Corporation svn path=/branches/tk705/; revision=6152
Diffstat (limited to 'rp/utils/scan_routercerts')
-rwxr-xr-xrp/utils/scan_routercerts28
1 files changed, 14 insertions, 14 deletions
diff --git a/rp/utils/scan_routercerts b/rp/utils/scan_routercerts
index 081a6293..9a13d7a9 100755
--- a/rp/utils/scan_routercerts
+++ b/rp/utils/scan_routercerts
@@ -28,9 +28,9 @@ import rpki.POW
import rpki.oids
def check_dir(s):
- if not os.path.isdir(s):
- raise argparse.ArgumentTypeError("%r is not a directory" % s)
- return s
+ if not os.path.isdir(s):
+ raise argparse.ArgumentTypeError("%r is not a directory" % s)
+ return s
parser = argparse.ArgumentParser(description = __doc__)
parser.add_argument("rcynic_dir", type = check_dir, help = "rcynic authenticated output directory")
@@ -38,20 +38,20 @@ args = parser.parse_args()
for root, dirs, files in os.walk(args.rcynic_dir):
- for fn in files:
+ for fn in files:
- if not fn.endswith(".cer"):
- continue
+ if not fn.endswith(".cer"):
+ continue
- x = rpki.POW.X509.derReadFile(os.path.join(root, fn))
+ x = rpki.POW.X509.derReadFile(os.path.join(root, fn))
- if rpki.oids.id_kp_bgpsec_router not in (x.getEKU() or ()):
- continue
+ if rpki.oids.id_kp_bgpsec_router not in (x.getEKU() or ()):
+ continue
- sys.stdout.write(base64.urlsafe_b64encode(x.getSKI()).rstrip("="))
+ sys.stdout.write(base64.urlsafe_b64encode(x.getSKI()).rstrip("="))
- for min_asn, max_asn in x.getRFC3779()[0]:
- for asn in xrange(min_asn, max_asn + 1):
- sys.stdout.write(" %s" % asn)
+ for min_asn, max_asn in x.getRFC3779()[0]:
+ for asn in xrange(min_asn, max_asn + 1):
+ sys.stdout.write(" %s" % asn)
- sys.stdout.write(" %s\n" % base64.b64encode(x.getPublicKey().derWritePublic()))
+ sys.stdout.write(" %s\n" % base64.b64encode(x.getPublicKey().derWritePublic()))