Skip to content

Releases: bgpkit/monocle

V0.0.5 Multi-query whois; Humanized time string

29 Jul 23:03
aa5ef28
Compare
Choose a tag to compare

Quick glance

Search ASes and organizations with a single command call:

➜  monocle whois 13335 bgpkit               
╭────────┬───────────────┬──────────────────┬──────────────┬─────────────┬──────────╮
│ asn    │ as_name       │ org_name         │ org_id       │ org_country │ org_size │
├────────┼───────────────┼──────────────────┼──────────────┼─────────────┼──────────┤
│ 13335  │ CLOUDFLARENET │ Cloudflare, Inc. │ CLOUD14-ARIN │ US          │ 5        │
│ 400644 │ BGPKIT-LLC    │ BGPKIT LLC       │ BL-1057-ARIN │ US          │ 1        │
╰────────┴───────────────┴──────────────────┴──────────────┴─────────────┴──────────╯

Show humanized string for time since the queried time:

➜  monocle time 2022-01-01T00:00:00Z
╭────────────┬───────────────────────────┬──────────────╮
│ unix       │ rfc3339                   │ human        │
├────────────┼───────────────────────────┼──────────────┤
│ 1640995200 │ 2022-01-01T00:00:00+00:00 │ 6 months ago │
╰────────────┴───────────────────────────┴──────────────╯

What's Changed

  • allow search for multiple entries with whois by @digizeph in #18
  • Add humanized time difference string by @digizeph in #19

Full Changelog: v0.0.4...v0.0.5

V0.0.4 AS Info Lookup

18 Jul 01:22
ab2b611
Compare
Choose a tag to compare

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

V0.0.3 Time subcommand

15 Jul 02:15
5ba1567
Compare
Choose a tag to compare

New subcommand monocle time

monocle time prints out the UNIX timestamp and the corresponding RFC3339 time string. You can provide it a timestamp, a time string, or nothing.

➜  monocle time
+------------+---------------------------+
|    unix    |          rfc3339          |
+------------+---------------------------+
| 1657850362 | 2022-07-15T01:59:22+00:00 |
+------------+---------------------------+

➜  monocle time 0                               
+------+---------------------------+
| unix |          rfc3339          |
+------+---------------------------+
|  0   | 1970-01-01T00:00:00+00:00 |
+------+---------------------------+

➜  monocle time 2022-01-01T00:00:00Z
+------------+---------------------------+
|    unix    |          rfc3339          |
+------------+---------------------------+
| 1640995200 | 2022-01-01T00:00:00+00:00 |
+------------+---------------------------+

➜  monocle time 2022-01-01T00:00:00 
Input time must be either Unix timestamp or time string compliant with RFC3339

Enhanced RFC3339 support

It now validates and enforces RFC3339 everywhere when time string is used.

Issues closed

Pull requests and full changelog

Full Changelog: v0.0.2...v0.0.3

V0.0.2 Time string parsing!

13 Jul 03:02
4d02b02
Compare
Choose a tag to compare

RFC3339 EVERYWHERE

You can do queries using rfc3339 time strings now:

monocle search  --dry-run --start-ts 2022-01-01T00:00:00 --end-ts 2022-01-01T00:01:00

What's Changed

  • add time string formatting and validation by @digizeph in #4

Full Changelog: v0.0.1...v0.0.2

V0.0.1 Prototype

10 Jul 06:50
0cb49ca
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: https://github.com/bgpkit/monocle/commits/v0.0.1