-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfetch-all-domains-dnsrecords.bash
executable file
·65 lines (60 loc) · 1.58 KB
/
fetch-all-domains-dnsrecords.bash
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
QUIET=false
CURRENTDOMAIN=""
DOMAINSLIST=""
fetchDomainsList(){
./fetch-domains-list.bash -q
}
showUsage(){
# Display Help
echo "Hi! Please specify options."
echo
echo "Syntax: fetch-domains-list.bash [-q|h]"
echo "options:"
echo "-h --help Print this Help."
echo "-q --quiet Execute quietly."
echo
}
while getopts ":hq" option; do
case $option in
h) # display Help
showUsage
exit 1;;
q) # quiet
QUIET=true
shift;;
\?) # Invalid option
echo "Error: Invalid option"
showUsage
exit
esac
done
fetchDomainDnsRecords(){
if [ $QUIET = "true" ]; then #if QUIET supress output from subcommand
./fetch-domain-dnsrecords.bash -q -d $CURRENTDOMAIN &
else
./fetch-domain-dnsrecords.bash -d $CURRENTDOMAIN &
fi
#echo "Domain complete: $CURRENTDOMAIN"
}
fetchAllDomainsDnsRecords(){
# Populate or update the domains.list
fetchDomainsList
# read domainlist
domianListFile="data/domains.list"
DOMAINSLIST=$(cat $domianListFile)
# iterate through $DOMAINSLIST and find dnsrecords for each domain
#echo "$DOMAINSLIST"
for domain in $DOMAINSLIST
do
CURRENTDOMAIN="$domain"
# echo "Records for: $domain"
fetchDomainDnsRecords
# clean up global garbage
CURRENTDOMAIN=""
done
}
fetchAllDomainsDnsRecords
# using cloudflare-cli - install with `npm install cloudflare-cli`
# https://github.com/danielpigott/cloudflare-cli
# https://github.com/shakes80/cloudflare-cli