My shell scripts #2 - WHOIS search

This time, we're going to get some informations about domains through WHOIS servers. All this via CLI interface and without the ubiquitous "whois" command (which is not available for my CPU architecture in OpenWrt package repository and I'm too lazy to cross-compile it myself). Used programs: "netcat", "sed", "grep".

The server automatically redirects you to the WHOIS server responsible for the supplied TLD, so you don't have to remember them (and it also simplifies this script).
if [ ! -n "$1" ]
  echo "Usage:"
  echo "  $0 domain.tld"
  exit 1
tld=`echo $1 | sed 's/\/.*//' | grep -o '[[:alpha:]]*$'`
echo "$1" | netcat -T $ 43
exit 0

No comments:

Post a Comment