-
-
Notifications
You must be signed in to change notification settings - Fork 776
/
mass_axfr.sh
executable file
·102 lines (84 loc) · 1.66 KB
/
mass_axfr.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/bash
NC='\033[0m'
BLACK='0;30'
RED='0;31'
GREEN='0;32'
ORANGE='0;33'
BLUE='0;34'
PURPLE='0;35'
CYAN='0;36'
LIGHT_GRAY='0;37'
DARK_GRAY='1;30'
LIGHT_RED='1;31'
LIGHT_GREEN='1;32'
YELLOW='1;33'
LIGHT_BLUE='1;34'
LIGHT_PURPLE='1;35'
LIGHT_CYAN='1;36'
WHITE='1;37'
function _print() {
if [ -n "$2" ] ; then
c=$2
else
c='WHITE'
fi
color="\033[${!c}m"
printf ${color}"$1"
printf ${NC}
}
dec2ip() {
local ip dec=$@
for e in {3..0}
do
((octet = dec / (256 ** e) ))
((dec -= octet * 256 ** e))
ip+=$delim$octet
delim=.
done
printf '%s\n' "$ip"
}
ip2dec() {
local a b c d ip=$@
IFS=. read -r a b c d <<< "$ip"
printf '%d\n' "$((a * 256 ** 3 + b * 256 ** 2 + c * 256 + d))"
}
function usage() {
echo "Usage: "$0" <domain_file>"
if [ -n "$1" ] ; then
echo "Error: "$1"!"
fi
exit
}
if [ ! $# -eq 1 ] ; then
usage
fi
file=$1
if [ ! -f $file ] ; then
usage "file not found"
fi
n=0
domains=$(cat $file)
#domains=$(cat $file | sort -fu)
echo "Running "$(cat $file | wc -l)" zone transfer..."
echo
for d in $domains ; do
echo -ne " \r"
echo -ne $d"\r"
axfr=`host -t axfr $d | grep 'Transfer failed' &`
if [ ! -n "$axfr" ] ; then
_print "$d successful!" GREEN
echo
n=$[$n+1]
fi
# axfr=`fierce -tcptimeout 3 -dns $d -wordlist /tmp/null | grep 'Whoah, it worked' &`
# if [ -n "$axfr" ] ; then
# _print "$d successful!" GREEN
# echo
# n=$[$n+1]
# fi
done
echo
echo
echo $n" zone transfer performed."
echo
exit