Skip to content

shakibamoshiri/helg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

helg

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.

prerequisites

Before proceeding the bellow commands should already have been installed:

  • perl
  • curl
  • echo
  • printf
  • grep
  • pup HTML parser for txt output
  • jq JSON parser for json output

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 ]

download

clone the repository using git:

git clone https://github.com/k-five/helg.git && cd helg

check if you have prerequisites

./cli.sh --check cmd

If all the check were [ OK ], then you can use or install it.

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 ...

how to use

First run the --help to see available options. It has two main options:

  1. --ip
  2. --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:

  1. html for log as html file (enabled by default)
  2. txt for log as txt file
  3. term for print on Terminal (stdout)
  4. json for log as JSON file

exampells

# 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

a shot

log term png file

automation

It will be useful if we automate requests and later check the log.

crontab

# 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

NOTE

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

developers

Contribution and feature request are welcome.