forked from cehkunal/pentest-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
arpa.sh
executable file
·46 lines (37 loc) · 794 Bytes
/
arpa.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
#!/bin/bash
function usage() {
echo "Usage: "$0" <arpa_file> [domain]"
if [ -n "$1" ] ; then
echo "Error: "$1"!"
fi
exit
}
if [ $# -lt 1 ] || [ $# -gt 2 ] ; then
usage
fi
file=$1
if [ ! -f $file ] ; then
usage "file not found"
fi
arpa=`cat $file | grep arpa`
if [ $# -eq 2 ] ; then
domain=$2
arpa=`cat $file | grep $domain`
fi
#echo $arpa
arpa=$(echo $arpa | sed "s/ /YYY/g")
#echo $arpa
arpa=$(echo $arpa | sed "s/\.YYY/\.WWW/g")
#echo $arpa
arpa=$(echo $arpa | sed "s/WWW/ /g")
#echo $arpa
for a in $arpa ; do
str=$(echo "$a" | awk -F "YYY" '{print $1}')
ip=$(echo "$str" | awk -F "." '{print $4"."$3"."$2"."$1}')
#echo $ip
dom=$(echo "$a" | awk -F "YYY" '{print $2}')
dom=${dom:0:-1}
#echo $dom
echo $ip" "$dom
done
exit