ipv6.he.net Daily Tests script

Certification in ipv6.he.net have daily tests that give on 1 an extra point after passing all the basic tests. They have to be done 100 such tests for maximum score 😐 . The tests themselves are completely trivial

  • Traceroute
  • DIG AAAA
  • DIG PTR
  • Ping
  • Whois

The most unpleasant thing is that the tests themselves must be unique, ie you can't use one domain twice 🙂 Besides everything else, they are a bit annoying 🙄 – no challenge just slapping 5 commands in the cli and copy / paste of the result on their site.

As a lazy and administrator who likes to make his life easier, I quickly scratched an elementary bash that does the dirty work for me.

#!/bin/bash

hr() {
  local start=$'\e(0' end=$'\e(B' line='qqqqqqqqqqqqqqqq'
  local cols=${COLUMNS:-$(tput cols)}
  while ((${#line} < cols)); do line+="$line"; done
  printf '%s%s%s\n' "$start" "${line:0:cols}" "$end"
}

if [ -z $1 ]
then
  echo "Append domain afert the script name!!!"
  exit
fi

IP=$(dig $1 AAAA +short)

if [ -z ${IP} ]
then
  echo "$1 dont have valid IPv6 record"
else
  reset
  traceroute6 $1
  hr
  dig $1 AAAA
  hr
  dig -x ${IP}
  hr
  ping6 -c3 ${IP}
  hr 
  whois ${IP}
fi

As you can see, the script is insanely simple. You submit a domain and then validate it to see if there is an IPv6 record and if so, perform daily tests for it. The coolest part – function hr which prints a line across the entire width of the screen is taken from bash-hackers.

Leave a Reply

Your email address will not be published. Required fields are marked *

Anti SPAM *