-
Notifications
You must be signed in to change notification settings - Fork 0
/
domain-checker-old-004.sh
32 lines (26 loc) · 1.26 KB
/
domain-checker-old-004.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# USAGE
# cd ~/sf_bash/domain-availability-checker && ./domain-checker.sh files/input.txt
# jwhois.conf
# https://github.com/jonasob/jwhois/blob/master/example/jwhois.conf
#cat /home/debuser/share/files/input-cache.txt > /home/debuser/share/files/input.txt
#cat files/input.txt > files/input-cache.txt
# .com regex
# Transferred Date|Updated Date|Creation Date|Registration Date|Expiration Date|REGISTRAR HOLD|REGISTRY HOLD|REDEMPTION GRACE PERIOD|REDEMPTIONPERIOD
#DOMAINS='.com' # simple, space-separated list of domain suffixes
# SLOW: .xyz
# No newline: .rocks
DOMAINS='.com .co .cm .net .info .biz .org .club .work .rocks .top'
while read input; do
for d in $DOMAINS; do
MATCH=$(jwhois --force-lookup --disable-cache --no-redirect -c jwhois.conf "$input$d" | grep -oPa '^.*\b(Transferred Date|Updated Date|Creation Date|Registration Date|Expiration Date|Expiry Date)\b.*$')
if [ $? -eq 0 ]; then
#echo "" |& tee --append files/registered.txt
echo -e "$input$d\tregistered\t"$(date +%y/%m/%d_%H:%M:%S)"\t$MATCH" | tr '\n' '\t' |& tee --append files/registered.txt
echo "" |& tee --append files/registered.txt
else
echo -e "$input$d" |& tee --append files/available.txt
fi
#sed -i "/$input/d" files/input.txt
done
done < "$1"