Aslo - AS Lookup

Page content

ASLO

AS Lookup Helper Script. It’s written for OpenBSD and need’s some modification for Linux. It basically depends on Python, PIP Installer and Python Package “aslookup”. Have Fun !

Download

wget https://blog.stoege.net/scripts/aslo
chmod 755 aslo
./aslo 1.1.1.1

Script

… and the Content himelf. It basically check’s if pip is installed, if as-lookup is installed, and then does the as lookup for the given IP Adress

#!/usr/bin/env bash

# AS Lookup for IP Address

install_pip() {
  echo -e "\npip not found, install ?\n"
  read -rsp $'Press any key to continue...\n' -n1 key
  pkg_add py3-pip--
  ln -sf /usr/local/bin/pip3.9 /usr/local/bin/pip
  echo -e "\npip installed ...\n"
}

install_aslookup() {
  echo -e "\nas-lookup not found, install ?\n"
  read -rsp $'Press any key to continue...\n' -n1 key
  pip install aslookup
  echo -e "\naslookup installed ...\n"
}

aslo() {
  as-lookup -s cymru `getent hosts $1 |awk '!/:/{ print $1}'`
}

which pip &>/dev/null || install_pip
which as-lookup &>/dev/null || install_aslookup
aslo $1

exit 0

Usage

you can simply ask one ip …

./aslo 1.1.1.1
1.1.1.1          AS13335 | US | CLOUDFLARENET

Loop

or loop though all NS for a certain domain

$ for i in `dig +short facebook.com NS`; do aslo $i; done; echo
129.134.31.12    AS32934 | US | FACEBOOK
129.134.30.12    AS32934 | US | FACEBOOK
185.89.218.12    AS32934 | US | FACEBOOK
185.89.219.12    AS32934 | US | FACEBOOK

Any Comments ?

sha256: 84c3c03058a966ba4ce758cf6b7a0cceb6942d0fe9ca20f9b0c3bd3479b216a1