forked from mboot-github/WhoisDomain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathta.sh
executable file
·54 lines (44 loc) · 819 Bytes
/
ta.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#! /usr/bin/env bash
TMPDIR="./tmp/A"
TMPDIR="./tmp/B"
CMD="./test2.py"
HOST=""
mkdir -p "${TMPDIR}"
NH="${TMPDIR}/nohost.txt"
getHost()
{
local domain="$1"
HOST=""
for j in meta google nic
do
local d="${j}.${domain}"
host -t soa "${d}" && {
HOST="$d"
return 0
}
done
HOST=""
}
main()
{
>"${NH}"
"${CMD}" -S |
while read domain
do
local f="${TMPDIR}/test-${domain}.txt"
[ -f "${f}" ] && {
echo "exists: $f" >&2
continue
}
getHost "${domain}"
[ -z "${HOST}" ] && {
echo "## no host for domain: '${domain}'" |
tee -a "${NH}"
continue
}
"${CMD}" -d "${HOST}" |
tee "${f}"
done
}
main 2>2 |
tee 1