dot

packages and services management
Log | Files | Refs | README

commit d04fb06df0dec48dc23123c401a4439cacb5f8f0
parent 87d8931632142f90fea9b9db40a8c8e4264e8dc1
Author: Josuah Demangeon <josuah.demangeon@gandi.net>
Date:   Fri,  4 Aug 2017 21:15:23 +0200

shell/bin/dns-used-tld: tld lookup for a sld

Diffstat:
Ashell/bin/dns-used-tld | 36++++++++++++++++++++++++++++++++++++
Mshell/profile | 2+-
2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/shell/bin/dns-used-tld b/shell/bin/dns-used-tld @@ -0,0 +1,36 @@ +# Usage: used-tld.sh name +# +# list all used TLD for a given SLD + +# get the list of the domains + +[ -f /tmp/tlds.txt ] || +wget -O- http://data.iana.org/TLD/tlds-alpha-by-domain.txt 2> /dev/null | +sed 1d > /tmp/tlds.txt + + +# remove the false positive by checking a long random domain name +# though, we cannot check for these domains now + +if [ ! -f /tmp/tlds-false-positive.txt ] +then + touch /tmp/tlds-false-positive.txt + $0 "$( + tr -cd 0-9a-z < /dev/urandom | dd bs=32 count=1 2> /dev/null + )" > /tmp/tlds-false-positive.txt +fi + + +# check every domain, up to 5 at once + +i=0 +while read tld +do + i=$((i + 1)) + dig -t NS "$1.$tld" | grep -q 'ANSWER: 0' || echo "$tld" & + [ "$i" = 5 ] && wait +done << EOF +$(grep -vFf /tmp/tlds-false-positive.txt /tmp/tlds.txt) +EOF + +wait diff --git a/shell/profile b/shell/profile @@ -1,6 +1,6 @@ PS1='$([ $? = 0 ] || printf " \033[31;1mx\033[m\n ") $(hostname) $(pwd) $(type git-status > /dev/null 2>&1 && git-status) -$([ "$(whoami)" = root ] && printf "#" || printf "$") ' +::: ' PS2='... ' PS3='... '