-
Notifications
You must be signed in to change notification settings - Fork 1
/
hostrec.sh
executable file
·52 lines (51 loc) · 1.79 KB
/
hostrec.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
readarray -t timer < domain.txt
for ip in ${!timer[*]}
do
if (($ip%10!=0))
then
echo ${timer[$ip]}
echo "<================>"
soa=$(host -C ${timer[$ip]} 8.8.8.8)
echo $soa | sed s/^.*"record"/\\t/g | sed s/";;".*//g
any=$(echo $soa | sed s/^.*"record"//g | sed s/";;".*//g)
a=$(host -t A ${timer[$ip]} $any)
olo=$(echo $a | sed s/"${timer[$ip]} has address "//g | sed s/^.*":"//g)
ns=$(host -t NS ${timer[$ip]} $any)
mx=$(host -t MX ${timer[$ip]} $any)
txt=$(host -t TXT ${timer[$ip]} $any)
echo $a | sed s/"${timer[$ip]} has address "//g | sed s/^.*":"/"A= \\t"/g
echo $ns | sed s/"${timer[$ip]} name server"//g | sed s/^.*":"/"NS= \\t"/g
echo $mx | sed s/"${timer[$ip]} mail is handled by"//g | sed s/^.*":"/"MX= \\t"/g
echo $txt | sed s/"${timer[$ip]} descriptive text"//g | sed s/^.*":"/"TXT= \\t"/g
for i in $olo
do
ptr=$(host $i)
echo "PTR= "$ptr | sed s/"PTR= "/"PTR= \\t"/g
done
echo "<================>"
else
echo "10 element"
sleep 10
echo ${timer[$ip]}
echo "<================>"
soa=$(host -C ${timer[$ip]} 8.8.8.8)
echo $soa | sed s/^.*"record"/\\t/g | sed s/";;".*//g
any=$(echo $soa | sed s/^.*"record"//g | sed s/";;".*//g)
a=$(host -t A ${timer[$ip]} $any)
olo=$(echo $a | sed s/"${timer[$ip]} has address "//g | sed s/^.*":"//g)
ns=$(host -t NS ${timer[$ip]} $any)
mx=$(host -t MX ${timer[$ip]} $any)
txt=$(host -t TXT ${timer[$ip]} $any)
echo $a | sed s/"${timer[$ip]} has address "//g | sed s/^.*":"/"A= \\t"/g
echo $ns | sed s/"${timer[$ip]} name server"//g | sed s/^.*":"/"NS= \\t"/g
echo $mx | sed s/"${timer[$ip]} mail is handled by"//g | sed s/^.*":"/"MX= \\t"/g
echo $txt | sed s/"${timer[$ip]} descriptive text"//g | sed s/^.*":"/"TXT= \\t"/g
for i in $olo
do
ptr=$(host $i)
echo "PTR= "$ptr | sed s/"PTR= "/"PTR= \\t"/g
done
echo "<================>"
fi
done>hostrec.csv
pandoc -s hostrec.csv -o hostrec.pdf