~shabbyrobe/asnine

Look up ASNs
704fb84c — Blake Williams 4 months ago
ASN data 20240123
e4a200d2 — Blake Williams 6 months ago
Update embedded data
79b3eab7 — Blake Williams 9 months ago
Clarify the README a bit

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~shabbyrobe/asnine
read/write
git@git.sr.ht:~shabbyrobe/asnine

You can also use your local clone with git send-email.

#🚫🐎 ASNine 🐎🚫

Look up ASNs. Can be used as a library or a CLI.

Comes with (possibly out of date) versions of the ASN database from APNIC embedded:

Or you can download and parse new versions yourself with asn.ParseReference and asn.ParseMappings.

Install the CLI:

go install go.shabbyrobe.org/asnine/cmd/asnine@latest

You can look up individual IPs like so:

asnine lookup 8.8.8.8

But it's really slow to do it this way because the data is slow to parse and I don't have a good intermediate format yet.

There's also a scan mode that works with stdin, and is most useful with a streaming pipe input:

$ </some/log jq -r .ipAddress | asnine scan -

scan can also be used with rlwrap to create a cheap interactive shell. You can get rlwrap from homebrew, apt, or where all good action toys are sold. (NOTE: There may be a delay before the first input produces an output):

$ rlwrap -S 'ip> ' asnine scan -
ip> 8.8.8.8
{"success":true,"ip":"8.8.8.8", ...}
ip> 1.1.1.1
{"success":true,"ip":"8.8.8.8", ...}

If you're really adventurous, there's a crap linewise TCP server you can use like so:

go run asnine serve 127.0.0.1:9876

Then you can use rlwrap, just as with scan, from another terminal, and it'll behave pretty much the same way:

$ rlwrap -S 'ip> ' nc 127.0.0.1 9876

#Expectation management

This is a tool I hack on for my own amusement in an ad-hoc fashion. No stability guarantees are made, the code is not guaranteed to work, and anything may be changed, renamed or removed at any time as I see fit.

If you wish to use any of this, I strongly recommend you copy-paste pieces as-needed (including tests and license/attribution) into your own project, or fork it for your own purposes.

Bug reports are welcome, feature requests discouraged, and code contributions will not be accepted.

#License

asnine is Copyright Blake Williams code@shabbyrobe.org 2023. It is licensed under a 3-clause BSD license.