-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubenum.sh
194 lines (168 loc) · 5.94 KB
/
subenum.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
#!/bin/bash
clear
#red='tput setaf 1'
#green='tput setaf 2' #using tput pkg to set colour in foreground
#blue='tput setaf 4'
#reset='tput sgr0'
#bold='tput bold'
banner()
{
#P=$(tput setaf 125)
#red='tput setaf 1'
#green='tput setaf 2' #using tput pkg to set colour in foreground
#blue='tput setaf 4'
#reset='tput sgr0'
#bold='tput bold'
echo -e \n"
██╗██╗███████╗███████╗ ███████╗██╗ ██╗██████╗ ███████╗███╗ ██╗██╗ ██╗███╗ ███╗███████╗██████╗
██║██║██╔════╝██╔════╝ ██╔════╝██║ ██║██╔══██╗██╔════╝████╗ ██║██║ ██║████╗ ████║██╔════╝██╔══██╗
██║██║███████╗███████╗ ███████╗██║ ██║██████╔╝█████╗ ██╔██╗ ██║██║ ██║██╔████╔██║█████╗ ██████╔╝
██ ██║██║╚════██║╚════██║ ╚════██║██║ ██║██╔══██╗██╔══╝ ██║╚██╗██║██║ ██║██║╚██╔╝██║██╔══╝ ██╔══██╗
╚█████╔╝██║███████║███████║ ███████║╚██████╔╝██████╔╝███████╗██║ ╚████║╚██████╔╝██║ ╚═╝ ██║███████╗██║ ██║
╚═══╝ ╚═╝╚══════╝╚══════╝ ╚══════╝ ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝"
echo "Credits:Jiss Jose"
}
#echo "Installing dependencies"
#
checkersubl=$(command -v sublist3r | wc -l)
checkerrobe=$(command -v httprobe | wc -l)
if [[ checkersubl -eq 0 ]] || [[ checkerrobe -eq 0 ]]; then
installer()
{
echo "sublist3r installing..."
sudo apt-get update -y;
sudo apt-get install assetfinder -y;
sudo apt-get install subfinder httprobe -y;
apt-get install ncurses-bin -y;
apt-get update;
echo "if any problem run "apt-get --fix-missing""
echo "Done ready to go";
echo "rerunning"
exit
}
installer
echo "or check completed"
exit
elif [[ checkerrobe -eq 1 ]] && [[ checkersubl -eq 1 ]]; then
echo "done installing dependencies check"
echo "and check completed"
clear
banner
#banner
echo "What do you want to enumerate or OSINT.Enter your choice"
echo "1 : for Checking ipv4,ipv6,CNAME"
echo "2 : for subdomain enumerate"
echo "Check DNS info,ipv4,ipv6,CNAME record";
fi #for working 1
read -p "Please enter your choice::" ch;
if [[ $ch -eq 1 ]]; then
echo "case 1 executed via ifelse"
dns_enum()
{
read -p "Enter domain name::" domain
echo "Target domain=" "$domain"
echo "Checking DNS info using digtool"
ipv4=$(dig $domain A +short)
echo "ipv4 is" \n "$ipv4";
echo "++++++++++++finished++++++++";
echo -e "Ipv4 Checked" \n "Next checking ipv6"
ipv6=$(dig $domain AAAA +short)
echo -e "$ipv6 is" \n $ipv6
echo "++++++++++++finished++++++++";
echo "CNAME Record"
cname=$(dig $domain CNAME +short)
echo -e "$cname is" \n $cname
echo "-******finished---****"
echo "MX Record"
mx=$(dig $domain MX +short)
echo -e "MX record of $domain is" \n "$mx"
echo "----Finished DNS info records---"
}
dns_enum
exit
elif [[ $ch -eq 2 ]]; then
echo "Case 2 executed via if else2"
# #begin replaced with dev #calling another function within function
path=$(pwd);
begin()
{
echo "Enter domain name for subdomain enumeration"
read -p "Enter domain:" subenum
rm -rf subs.txt;
}
begin
#assetfinder()
#{
#assetfinder -subs-only $subenum >> $path/tmp/subs.txt | tee
#sleep 30
#count=$(assetfinder -subs-only $subenum | wc -l)
#sleep 2
#echo "subdomains found using assetfinder for $subenum is $count"
#}
#assetfinder;
#echo "assetfinder ended"
sublist3re()
{
echo "Sublist3r"
sleep 5
sublist3r -d $subenum -o subl.txt
count=$(sublist3r -d $subenum | wc -l)
echo "subdomains found using sublist3r for $subenum is $count"
}
sublist3re
sleep 5
echo "Sublist3r ended"
subfindere()
{
echo "Subfinder"
subfinder -d $subenum -o subf.txt | tee;
count=$(subfinder -d $subenum | wc -l)
echo "subdomains found using subfinder for $subenum is $count"
}
subfindere
echo "subfinder ended"
#amassed()
#{
# echo "Amass scan started"
#amass enum -d $subenum -passive -o output.txt
#echo "Amass scan finished"
#}
#amassed
#sleep 5;
sleep 4
sed -n p subl.txt subf.txt > $(pwd)/subs.txt
echo "Now sorting the list using sort tool"
rm -rf subf subl
fi
#check file name
alived()
{
alive=$(cat subs.txt | httprobe | tee $path/alive.txt);
count2=$(cat alive.txt | wc -l) #for no of words
echo "alive subdomains is $count2"
}
alived
#string=(cat alive.txt | grep http)
#if [[ $string -eq http ]]; then
#touch urls.txt;
fileread()
{
file=alive.txt #take 1st argument as file
while read urls;do #read and save to url variable
echo "${urls#*//}" >> urls.txt; #test to see url printing and strip https and http
done < alive.txt; #take input file
sleep 3;
}
fileread
duper()
{
echo "Removing dupes"
sort -u urls.txt > sorted_subs.txt; # to sort remove dupes
count3=$(cat sorted_subs.txt | wc -l);
echo "$count3 number is left after sorting out duplicates "
rm -rf tmp_file.txt tmp_file #remove tmp file created
rm -rf url.txt #remove url file
}
duper
#fi
echo "Script execution completed successfully"