diff options
| author | Horus3 | 2015-08-18 11:43:51 +0200 |
|---|---|---|
| committer | Horus3 | 2015-08-18 11:43:51 +0200 |
| commit | 4a5a08dcc6cf209203efccad9cc2714beb9fdb50 (patch) | |
| tree | 251c7ddd10fb470110b8ace234cefbf97b8e354a | |
| parent | 5018d9f3aadfcbbac3c41c142fc2a29caac38b12 (diff) | |
| download | dotfiles-4a5a08dcc6cf209203efccad9cc2714beb9fdb50.tar.gz | |
Add zat and nwhois.
| -rw-r--r-- | bin/nwhois.sh | 83 | ||||
| -rwxr-xr-x | bin/zat | 20 |
2 files changed, 103 insertions, 0 deletions
diff --git a/bin/nwhois.sh b/bin/nwhois.sh new file mode 100644 index 0000000..9f0ea77 --- /dev/null +++ b/bin/nwhois.sh @@ -0,0 +1,83 @@ +_do_whois(){ + + if [[ $(whois -H -h "$1" "$2" | grep -o "$3") == "$3" ]]; then + echo "$(tput setaf 3)$(tput bold)$2$(tput sgr0) $(tput setaf 3)is available.$(tput sgr0)" + else + echo "$(tput setaf 1)Domain unavailable. ($(tput bold)$2$(tput sgr0)$(tput setaf 1))$(tput sgr0)" + fi +} + +getclick() { + _do_whois "whois.uniregistry.net" "$1.click" "is available for registration" +} + +getclub() { + _do_whois "whois.nic.club" "$1.club" "Not found:" +} + +getlink() { + _do_whois "whois.uniregistry.net" "$1.link" "is available for registration" +} + +getninja() { + _do_whois "whois.unitedtld.com" "$1.ninja" "Domain not found" +} + +gettop() { + _do_whois "whois.nic.top" "$1.top" "No match" +} + +getwork() { + _do_whois "whois-dub.mm-registry.com" "$1.work" "Not Registered" +} + +getxyz() { + _do_whois "whois.nic.xyz" "$1.xyz" "DOMAIN NOT FOUND" +} + +nwhois(){ + tld=$(echo "$1" | cut -d '.' -f 2) + if [ -z $tld ] || [[ "$tld" == "$1" ]]; then + #echo "No valid domain." 1>&2 + #return + tld='all' + fi + domain=$(echo "$1" | cut -d '.' -f 1) + + case $tld in + "click") + getclick $domain + ;; + "club") + getclub $domain + ;; + "link") + getlink $domain + ;; + "ninja") + getninja $domain + ;; + "top") + gettop $domain + ;; + "work") + getwork $domain + ;; + "xyz") + getxyz $domain + ;; + '*'|"all") + getclick $domain + getclub $domain + getlink $domain + getninja $domain + gettop $domain + getwork $domain + getxyz $domain + ;; + *) + echo "Unknown TLD. Falling back to standard whois." + whois -H "$1" + ;; + esac +} @@ -0,0 +1,20 @@ +#!/bin/bash + +if [ $# -eq 0 ]; then + echo "Usage: $0 [FILES]" + echo + echo "$0 is both cat as zcat." +fi + +while [ $# -ne 0 ]; do + case "$1" in + *.gz) + zcat "$1" + shift + ;; + *) + cat "$1" + shift + ;; + esac +done |
