Hurricane Electric's Network Looking Glass
Hurricane Electric as a root server does not provide any kind of API to request to. It does have telnet over route-server.he.net but is not so friendly to work with, thus you can think of this bash CLI as pseudo-API.
Before proceeding the bellow commands should already have been installed:
Plus you can check them using below option, and it shows you either [OK] or [Error].
./cli.sh --check cmd
check prerequisites:
curl .......................... [ OK ]
perl .......................... [ OK ]
pup ........................... [ OK ]
grep .......................... [ OK ]
printf ........................ [ OK ]
echo .......................... [ OK ]
clone the repository using git
:
git clone https://github.com/k-five/helg.git && cd helg
./cli.sh --check cmd
If all the check were [ OK ], then you can use or install it.
You can use the cli.sh
file or you may want to change the name and install it
with a proper name e.g. helg
and then mv
it to /usr/local/bin
so you can run
it everywhere on you machine.
sudo mv cli.sh /usr/local/usr/helg
# or
sudo cp cli.sh /usr/local/usr/helg
# or just use it
./cli.sh ...
First run the --help
to see available options. It has two main options:
--ip
--log
The --ip
option can read list of IPs/Mask from a file or from the Terminal as
many as you need. If the argument is a single one, first it checks if it is a
file or not, if it was a file, reads it, otherwise it will assume it is an IP.
the --log
option has three mode:
html
for log as html file (enabled by default)txt
for log as txt fileterm
for print on Terminal (stdout)json
for log as JSON file
# request for 8.8.8.8/24 , read from Terminal
./cli --ip 8.8.8.8/24
# or more then one ip/mask
./cli --ip 8.8.8.8/24 1.1.1.1/24
# request , read from a file
./cli --ip ips-sample
# request, enable txt log
./cli --ip ips-sample --log txt
# request, enable Terminal log
./cli --ip ips-sample --log term
# request, enable Terminal log and txt
./cli --ip ips-sample --log term txt
# note that HTML log is enable by default
It will be useful if we automate requests and later check the log.
# every hour at minute 0
# 12:00
# 13:00
# 14:00
# etc
WD='/add/your/working/directory'
0 */1 * * * cd $WD && ./cli.sh --ip ips-file --log txt
# or if you renamed the "cli.sh" to "helg"
WD='/add/your/working/directory'
0 */1 * * * cd $WD && helg --ip ips-file --log txt
Hurricane Electric website : https://lg.he.net/
Router (as default): Hurricane Electric Fremont 1
Address of this router: core3.fmt1.he.net
Commands: BGP Route
Contribution and feature request are welcome.