aboutsummaryrefslogtreecommitdiff
path: root/rp/utils/print_roa.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2014-05-02 04:36:10 +0000
committerRob Austein <sra@hactrn.net>2014-05-02 04:36:10 +0000
commitbf789ce9905c72eb26bcdfde9093ccf428ac432f (patch)
tree3ea3e6d5fcc542d9658ca5b07bc3f548422be4ec /rp/utils/print_roa.py
parent01bf6e0fe2904a26261b55d725d2fe2599834982 (diff)
Switch all rp/utils/ programs to use the Python script versions
instead of the nasty old C versions. C code retained in source tree for the moment, but will go away soon. svn path=/trunk/; revision=5825
Diffstat (limited to 'rp/utils/print_roa.py')
-rwxr-xr-xrp/utils/print_roa.py75
1 files changed, 0 insertions, 75 deletions
diff --git a/rp/utils/print_roa.py b/rp/utils/print_roa.py
deleted file mode 100755
index fd7308d1..00000000
--- a/rp/utils/print_roa.py
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/usr/bin/env python
-#
-# $Id$
-#
-# Copyright (C) 2014 Dragon Research Labs ("DRL")
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND DRL DISCLAIMS ALL WARRANTIES WITH
-# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-# AND FITNESS. IN NO EVENT SHALL DRL BE LIABLE FOR ANY SPECIAL, DIRECT,
-# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-# PERFORMANCE OF THIS SOFTWARE.
-
-"""
-Pretty-print the content of a ROA. Does NOT attempt to verify the
-signature.
-"""
-
-import os
-import sys
-import argparse
-import rpki.POW
-
-class ROA(rpki.POW.ROA):
-
- @staticmethod
- def _format_prefix(prefix):
- if prefix[2] is None or prefix[1] == prefix[2]:
- return "%s/%d" % (prefix[0], prefix[1])
- else:
- return "%s/%d-%d" % (prefix[0], prefix[1], prefix[2])
-
- def parse(self):
- self.extractWithoutVerifying()
- v4, v6 = self.getPrefixes()
- self.v4_prefixes = [self._format_prefix(p) for p in (v4 or ())]
- self.v6_prefixes = [self._format_prefix(p) for p in (v6 or ())]
-
-parser = argparse.ArgumentParser(description = __doc__)
-parser.add_argument("-b", "--brief", action = "store_true", help = "show only ASN and prefix(es)")
-parser.add_argument("-c", "--cms", action = "store_true", help = "print text representation of entire CMS blob")
-parser.add_argument("-s", "--signing-time", action = "store_true", help = "show SigningTime in brief mode")
-parser.add_argument("roas", nargs = "+", type = ROA.derReadFile, help = "ROA(s) to print")
-args = parser.parse_args()
-
-for roa in args.roas:
- roa.parse()
- if args.brief:
- if args.signing_time:
- print roa.signingTime(),
- print roa.getASID(), " ".join(roa.v4_prefixes + roa.v6_prefixes)
- else:
- print "ROA Version: ", roa.getVersion()
- print "SigningTime: ", roa.signingTime()
- print "asID: ", roa.getASID()
- if roa.v4_prefixes:
- print " addressFamily:", 1
- for p in roa.v4_prefixes:
- print " IPAddress:", p
- if roa.v6_prefixes:
- print " addressFamily:", 2
- for p in roa.v6_prefixes:
- print " IPAddress:", p
- if args.cms:
- print roa.pprint()
- for cer in roa.certs():
- print cer.pprint()
- for crl in roa.crls():
- print crl.pprint()
- print