1

ASPATH script

This commit is contained in:
Evan Pratten 2022-10-25 18:07:18 -04:00
parent b292a1bb08
commit 184f04cecf
3 changed files with 53 additions and 1 deletions

26
configs/scripts/aspath Executable file
View File

@ -0,0 +1,26 @@
#! /bin/bash
set -e
# Ensure we were passed a host argument
if [ -z "$1" ]; then
echo "Usage: $0 <host>"
exit 1
fi
# Parse out the ASNs
asns=$( mtr -jzc1 $1 | jq ".report.hubs[].ASN" | tr -d "\"" | uniq )
# For each line
for asn in $asns; do
# Skip "AS???" lines
if [[ $asn =~ ^AS\?\?\?$ ]]; then
echo "Private Hop"
continue
fi
# Get the AS name
as_name=$( whois -h whois.radb.net $asn | grep -i ^descr: | cut -d : -f 2- | grep -o -E '\S.*\S|\S' )
# Print the ASN and AS name
echo "$asn - $as_name"
done

View File

@ -8,6 +8,28 @@ alias p4='ping 8.8.8.8 -c 4'
alias quickhttp='sudo python -m SimpleHTTPServer 443'
alias zshreload="source ~/.zshrc"
alias wg-easykeys="wg genkey | tee >(wg pubkey)"
alias nvim-tmp="nvim $(mktemp)"
# WHOIS macros
alias whois-afrinic="whois -h whois.afrinic.net"
alias whois-altdb="whois -h whois.altdb.net"
alias whois-aoltw="whois -h whois.aoltw.net"
alias whois-ampr="whois -h whois.ampr.org"
alias whois-apnic="whois -h whois.apnic.net"
alias whois-arin="whois -h rr.arin.net"
alias whois-bell="whois -h whois.in.bell.ca"
alias whois-bboi="whois -h irr.bboi.net"
alias whois-bgptools="whois -h bgp.tools"
alias whois-canarie="whois -h whois.canarie.ca"
alias whois-epoch="whois -h whois.epoch.net"
alias whois-jpirr="whois -h jpirr.nic.ad.jp"
alias whois-lacnic="whois -h irr.lacnic.net"
alias whois-level3="whois -h rr.level3.net"
alias whois-nestegg="whois -h whois.nestegg.net"
alias whois-panix="whois -h rrdb.access.net"
alias whois-radb="whois -h whois.radb.net"
alias whois-reach="whois -h rr.telstraglobal.net"
alias whois-ripe="whois -h whois.ripe.net"
# Kill via pgrep
nkill() {

View File

@ -21,7 +21,11 @@
~/bin/catto:
path: configs/scripts/catto
mode: 755
~/bin/aspath:
path: configs/scripts/aspath
mode: 755
- shell:
- [git submodule update --init --recursive, Installing submodules]
- [chmod +x configs/scripts/catto, Making catto executable]
- [chmod +x configs/scripts/catto, Making catto executable]
- [chmod +x configs/scripts/aspath, Making aspath executable]