From 4a5a08dcc6cf209203efccad9cc2714beb9fdb50 Mon Sep 17 00:00:00 2001 From: Horus3 Date: Tue, 18 Aug 2015 11:43:51 +0200 Subject: Add zat and nwhois. --- bin/nwhois.sh | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ bin/zat | 20 ++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 bin/nwhois.sh create mode 100755 bin/zat 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 +} diff --git a/bin/zat b/bin/zat new file mode 100755 index 0000000..0d2ae17 --- /dev/null +++ b/bin/zat @@ -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 -- cgit v1.2.3