Skip to content

V0.0.4 AS Info Lookup

Choose a tag to compare

@digizeph digizeph released this 18 Jul 01:22
· 382 commits to main since this release
ab2b611

New Features

monocle whois

This pull request adds a new subcommand monocle whois that allows querying AS and organization information with ASN or name text.

This function has the following features:

  • one bootstrap and offline use forever
    • 1 minute bootstrap time
  • "smart query": search based on input, 400644 -> search by ASN, bgpkit -> search by AS name
    • can always fall back for force searching by ASN or name
  • output to table and order entries by organizations' sizes
  • SQLite as storage backend, so users can always run queries directly on the database
    • The database is stored at ~/.monocle/monocle-data.sqlite3 by default
➜  ~ monocle whois --help
monocle-whois 0.0.4
ASN and organization lookup utility

USAGE:
    monocle whois [OPTIONS] <QUERY>

ARGS:
    <QUERY>    Search query, an ASN (e.g. "400644") or a name (e.g. "bgpkit")

OPTIONS:
    -a, --asn-only     Search by ASN only
    -h, --help         Print help information
    -n, --name-only    Search AS and Org name only
    -u, --update       Refresh local as2org database
    -V, --version      Print version information

Example queries:

➜  ~ monocle whois 400644
+--------+------------+------------+--------------+-------------+----------+
|  asn   |  as_name   |  org_name  |    org_id    | org_country | org_size |
+--------+------------+------------+--------------+-------------+----------+
| 400644 | BGPKIT-LLC | BGPKIT LLC | BL-1057-ARIN |     US      |    1     |
+--------+------------+------------+--------------+-------------+----------+

➜  ~ monocle whois bgpkit
+--------+------------+------------+--------------+-------------+----------+
|  asn   |  as_name   |  org_name  |    org_id    | org_country | org_size |
+--------+------------+------------+--------------+-------------+----------+
| 400644 | BGPKIT-LLC | BGPKIT LLC | BL-1057-ARIN |     US      |    1     |
+--------+------------+------------+--------------+-------------+----------+

Monocle Configration

This pull request also adds the initial support for configuring Monocle's behavior. There are two ways to pass configuration values to the function:

  1. by environment variable with prefix MONOCLE_
  2. by changing TOML configuration file at ~/.monocle/monocle.toml

Currently, we have one supported variable:

  • data_dir: the directory where the Monocle's SQLite datafile will be stored

Users can configure data_dir to ~/DATA in two ways: set environment variable MONOCLE_DATA_DIR=~/DATA or have a data_dir="~/DATA" in the ~/.monocle/monocle.toml file like below

### monocle configuration file

### directory for cached data used by monocle
data_dir="~/.monocle"

Pull Requests and Full Changelog

  • enable app-level configuration using toml file by @digizeph in #9
  • Feature AS inforomation lookup by @digizeph in #10

Full Changelog: v0.0.3...v0.0.4