diff options
author | Rob Austein <sra@hactrn.net> | 2010-11-17 15:00:53 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2010-11-17 15:00:53 +0000 |
commit | 0e545af00064860f9ecf0122d063176f4a0fb3c9 (patch) | |
tree | 6231d8932831eadb23b417cecd8ebb228b5d843d /scripts/arin-to-csv.py | |
parent | 929cbfe19552161f32943b8f164a0e730aa937f7 (diff) |
Yet another set of tools attempting to deal with the RIPE mess
svn path=/scripts/arin-to-csv.py; revision=3555
Diffstat (limited to 'scripts/arin-to-csv.py')
-rw-r--r-- | scripts/arin-to-csv.py | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/scripts/arin-to-csv.py b/scripts/arin-to-csv.py index 98d99f9f..c862fd63 100644 --- a/scripts/arin-to-csv.py +++ b/scripts/arin-to-csv.py @@ -53,18 +53,38 @@ def do_asn(node): "%s-%s" % (find(node, tag_startAsNumber), find(node, tag_endAsNumber)))) +erx_table = { + "AF" : "AFRINIC", + "AP" : "APNIC", + "AR" : "ARIN", + "AV" : "ARIN", + "FX" : "AFRINIC", + "LN" : "LACNIC", + "LX" : "LACNIC", + "PV" : "APNIC", + "PX" : "APNIC", + "RN" : "RIPE", + "RV" : "RIPE", + "RX" : "RIPE" } + def do_net(node): handle = find(node, tag_orgHandle) for netblock in node.iter(tag_netBlock): - if find(netblock, tag_type) in ("DS", "DA", "IU"): + tag = find(netblock, tag_type) + if tag in ("DS", "DA", "IU"): prefixes.writerow((handle, - "%s-%s" % (find(netblock, tag_startAddress), - find(netblock, tag_endAddress)))) + "%s-%s" % (find(netblock, tag_startAddress), + find(netblock, tag_endAddress)))) + elif tag in erx_table: + erx.writerow((erx_table[tag], + "%s-%s" % (find(netblock, tag_startAddress), + find(netblock, tag_endAddress)))) dispatch = { tag_asn : do_asn, tag_net : do_net } asns = rpki.myrpki.csv_writer("asns.csv") prefixes = rpki.myrpki.csv_writer("prefixes.csv") +erx = rpki.myrpki.csv_writer("erx.csv") root = None @@ -86,3 +106,4 @@ for event, node in lxml.etree.iterparse(sys.stdin): asns.close() prefixes.close() +erx.close() |