Tools to Work With Autonomous System (‘AS’) Network and Organization Data

Description

A collection of utilities for downloading, parsing, reading and analyzing autonomous system (‘AS’) network and organization data from various internet sources including ‘CAIDA’ (https://caida.org) and ‘BGP Routing Table Analysis Reports’ https://bgp.potaroo.net

What’s Inside The Tin

The following functions are implemented:

  • asnames_current: Retrive current ‘asnames.txt’ from ‘bgp.poraroo.net’
  • read_asnames: Retrieve an historical asnames.txt from local cache
  • parse_asnames: Parse arbitrary ‘asnames.txt’ downloaded from ‘bgp.poraroo.net’
  • parse_asorg2info: Parses CAIDA ‘asorg2info’ Files
  • parse_routeviews: Parses Arbitrary RouteViews “Prefix-to-AS” Files
  • as_asntrie: Convert a ‘routeviews’ data frame to a trie
  • routeviews_latest: Caches & Returns the latest CAIDA-processed RouteViews “Prefix-to-AS” File

Installation

devtools::install_github("hrbrmstr/astools")

Usage

library(astools)
library(tidyverse)

# current verison
packageVersion("astools")
## [1] '0.1.0'

RouteViews Prefix-to-AS

(rv_df <- routeviews_latest())
## # A tibble: 798,646 x 6
##    cidr         asn   minimum_ip maximum_ip  min_numeric max_numeric
##    <chr>        <chr> <chr>      <chr>             <dbl>       <dbl>
##  1 1.0.0.0/24   13335 1.0.0.0    1.0.0.255      16777216    16777471
##  2 1.0.4.0/22   56203 1.0.4.0    1.0.7.255      16778240    16779263
##  3 1.0.4.0/24   56203 1.0.4.0    1.0.4.255      16778240    16778495
##  4 1.0.5.0/24   56203 1.0.5.0    1.0.5.255      16778496    16778751
##  5 1.0.6.0/24   56203 1.0.6.0    1.0.6.255      16778752    16779007
##  6 1.0.7.0/24   56203 1.0.7.0    1.0.7.255      16779008    16779263
##  7 1.0.16.0/24  2519  1.0.16.0   1.0.16.255     16781312    16781567
##  8 1.0.64.0/18  18144 1.0.64.0   1.0.127.255    16793600    16809983
##  9 1.0.128.0/17 23969 1.0.128.0  1.0.255.255    16809984    16842751
## 10 1.0.128.0/18 23969 1.0.128.0  1.0.191.255    16809984    16826367
## # … with 798,636 more rows

Which can work with iptools::ip_to_asn():

rv_trie <- as_asntrie(rv_df)

iptools::ip_to_asn(rv_trie, "174.62.167.97")
## [1] "7922"

AS Org-to-Info

parse_asorg2info("~/Data/20180703.as-org2info.txt.gz")
## NULL

AS Names

## Creating ~/.asnames to hold timestamped asnames.txt downloads...
## # A tibble: 64,226 x 4
##    asn   handle       asinfo                                                iso2c
##    <chr> <chr>        <chr>                                                 <chr>
##  1 1     LVLT-1       Level 3 Parent, LLC                                   US   
##  2 2     UDEL-DCN     University of Delaware                                US   
##  3 3     MIT-GATEWAYS Massachusetts Institute of Technology                 US   
##  4 4     ISI-AS       University of Southern California                     US   
##  5 5     SYMBOLICS    Symbolics, Inc.                                       US   
##  6 6     BULL-HN      Bull HN Information Systems Inc.                      US   
##  7 7     DSTL         DSTL                                                  GB   
##  8 8     RICE-AS      Rice University                                       US   
##  9 9     CMU-ROUTER   Carnegie Mellon University                            US   
## 10 10    CSNET-EXT-AS CSNET Coordination and Information Center (CSNET-CIC) US   
## # … with 64,216 more rows

Combining RouteViews & AS Names

These are now cached so there is no re-downloading.

## Joining, by = "asn"
## # A tibble: 798,646 x 9
##    cidr         asn   minimum_ip maximum_ip  min_numeric max_numeric handle             asinfo                     iso2c
##    <chr>        <chr> <chr>      <chr>             <dbl>       <dbl> <chr>              <chr>                      <chr>
##  1 1.0.0.0/24   13335 1.0.0.0    1.0.0.255      16777216    16777471 CLOUDFLARENET      Cloudflare, Inc.           US   
##  2 1.0.4.0/22   56203 1.0.4.0    1.0.7.255      16778240    16779263 GTELECOM-AUSTRALIA Gtelecom-AUSTRALIA         AU   
##  3 1.0.4.0/24   56203 1.0.4.0    1.0.4.255      16778240    16778495 GTELECOM-AUSTRALIA Gtelecom-AUSTRALIA         AU   
##  4 1.0.5.0/24   56203 1.0.5.0    1.0.5.255      16778496    16778751 GTELECOM-AUSTRALIA Gtelecom-AUSTRALIA         AU   
##  5 1.0.6.0/24   56203 1.0.6.0    1.0.6.255      16778752    16779007 GTELECOM-AUSTRALIA Gtelecom-AUSTRALIA         AU   
##  6 1.0.7.0/24   56203 1.0.7.0    1.0.7.255      16779008    16779263 GTELECOM-AUSTRALIA Gtelecom-AUSTRALIA         AU   
##  7 1.0.16.0/24  2519  1.0.16.0   1.0.16.255     16781312    16781567 VECTANT            ARTERIA Networks Corporat… JP   
##  8 1.0.64.0/18  18144 1.0.64.0   1.0.127.255    16793600    16809983 AS-ENECOM          Energia Communications,In… JP   
##  9 1.0.128.0/17 23969 1.0.128.0  1.0.255.255    16809984    16842751 TOT-NET            TOT Public Company Limited TH   
## 10 1.0.128.0/18 23969 1.0.128.0  1.0.191.255    16809984    16826367 TOT-NET            TOT Public Company Limited TH   
## # … with 798,636 more rows