-
Notifications
You must be signed in to change notification settings - Fork 16
/
automateSubdEnum.sh
218 lines (168 loc) · 5.17 KB
/
automateSubdEnum.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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
#!/bin/bash
clear
function logoMAIN() {
echo -e """\n
____ _ _ _ _
/ ___| _ _| |__ | | | |_ _ _ __ | |_
\___ \| | | | '_ \| |_| | | | | '_ \| __|
___) | |_| | |_) | _ | |_| | | | | |_
|____/ \__,_|_.__/|_| |_|\__,_|_| |_|\__|
\n"""
}
if [[ $1 == '-h' ]] || [[ $1 == '--help' ]]; then
logoMAIN
echo -e "Note: Make sure to run install.sh before running \n"
echo -e "[+] Useage: bash SubdomainHunter.sh --domain domain.com -output /path/folder/ \n"
echo -e "[+] bash SubdomainHunter.sh -d domain.com -o /path/folder/"
exit 1
fi
# Colors
RED='\033[0;31m'
BWhite='\033[1;37m'
GREEN="\033[0;32m"
RESET="\033[0m"
NC='\033[0m'
YELLO="\033[0;33m"
Purple='\033[0;35m'
IRed='\033[0;91m'
Cyan='\033[0;36m'
# QUOTES :D
QUOTES() {
QUOTES=(
"Activating 1337 mode!"
"Never underestimate the determination of a kid who is time-rich and cash-poor."
"Human Stupidity , that’s why Hackers always win."
"Hacking is less about technology for me and more about religion."
"Never tell everything you know…!"
"Never gonna give you up."
"Bounty pls."
"Sleep is for the weak."
"Haxor 1337 Detected"
"Grab a cuppa!"
"I am talking about the guys that no one knows about."
"I am 100 percent natural."
"A bug is never just a mistake. It represents something bigger. An error of thinking that makes you who you are."
"You hack people. I hack time."
"I hope you don't screw like you type."
"Hack the planet!"
"Happy Hunting!"
"The Quiter you become the more you are able to hear"
"yeyy, I earned $1500 for my submisson on @H1 & @BugCrowd. xD"
"I eat CORS in breakfast"
"Don't hate the hacker, hate the code"
"Hackerman detected."
)
rand=$[RANDOM % ${#QUOTES[@]}]
printf "\n${YELLO}\xF0\x9F\x9A\x80${NC} ${QUOTES[$rand]} \xF0\x9F\x98\x81\\n"
echo
}
# Clean Output folder :)
cd /root/
#rm -rf /root/results/*.txt
mainPATH=$(pwd)/
bar="---------------------------------------"
function automateSublist3r() {
echo -e "\n$bar\n\tRunning Sublist3r\n$bar\n"
cd $mainPATH
cd Sublist3r/
#source ./env/bin/activate
python3 sublist3r.py -v -t 100 -o $sublist3rPATH -d $HOST
}
function automateSubfinder() {
echo -e "\n$bar\n\tRunning Subfinder\n$bar\n"
cd $mainPATH
subfinder -o $subfinderPATH -t 100 -d $HOST
}
function automateAmass() {
echo -e "\n$bar\n\tRunning Amass\n$bar\n"
cd $mainPATH
amass enum -active -o $amassPATH -d $HOST
}
function automateOneForAll() {
echo -e "\n$bar\n\tRunning OneForAll\n$bar\n"
cd $mainPATH
cd OneForAll/
#source ./env/bin/activate
python3 oneforall.py --target $HOST run --path=$oneForAllPATH
cd $outputPATH
rm -rf *.csv
mv $outputPATH/all_subdomain_result* oneforall.txt
}
function automateAssetsFinder() {
echo -e "\n$bar\n\tRunning Assets finder\n$bar\n"
cd $mainPATH
assetfinder --subs-only $HOST | tee $assetfinderPATH
}
function automateFindomain() {
echo -e "\n$bar\n\tRunning Findomain\n$bar\n"
cd $mainPATH
findomain-linux -t $HOST -u $finddomainPATH
}
function automatePuredns () {
echo -e "\n$bar\n\tRunning PureDNS\n$bar\n"
cd $mainPATH
puredns bruteforce /root/wordlists/best-dns-wordlist.txt $HOST --wildcard-batch 1000000 -r /root/wordlists/resolvers.txt | tee $purednsPATH
}
function automateScilla () {
scillaPATH
echo -e "\n$bar\n\tRunning Scilla\n$bar\n"
cd $mainPATH
}
function automateGAU () {
echo -e "\n$bar\n\tRunning GAU\n$bar\n"
cd $mainPATH
gau --subs $HOST | unfurl -u domains | tee $gauPATH
}
function automateGihubSubdomains () {
echo -e "\n$bar\n\tRunning Github-Subdomains\n$bar\n"
cd $mainPATH
cd github-search/
python3 github-subdomains.py -d $HOST | tee $githubsearchPATH
}
function sortResults() {
cd $mainPATH
cd $outputPATH
cat *.txt | sed "s/www.//" | sed "s/nwww.//" | sort | uniq > results.txt
echo -e "\n$bar\nFinal Results:\n$bar\n"
echo -e "[#] Subdomains Count: $(wc -l < results.txt)\n"
cat results.txt
}
function resolveSubdomains() {
cd /root/massdns/
cat $outputPATH/results.txt | /root/massdns/bin/massdns -r /root/massdns/lists/resolvers.txt --quiet -t A -o S -w /root/massdns/results-resolved.txt
echo -e "\n$bar\nResolved Results:\n$bar\n"
echo -e "[#] Resolved Count: $(wc -l < /root/massdns/results-resolved.txt)\n"
cat /root/massdns/results-resolved.txt
}
if [[ $1 == "--domain" ]] || [[ $1 == "-d" ]]; then
logoMAIN
HOST=$2
if [[ $3 == "--output" ]] || [[ $3 == "-o" ]]; then
outputPATH=$4/subhunterRESULTS/
mkdir -p $outputPATH/$HOST
sublist3rPATH=$outputPATH/$HOST-sublist3r.txt
subfinderPATH=$outputPATH/$HOST-subfinder.txt
amassPATH=$outputPATH/$HOST-amass.txt
oneForAllPATH=$outputPATH/
assetfinderPATH=$outputPATH/$HOST-assetfinder.txt
finddomainPATH=$outputPATH/$HOST-findomain.txt
purednsPATH=$outputPATH/$HOST-puredns.txt
scillaPATH=$outputPATH/$HOST-scilla.txt
gauPATH=$outputPATH/$HOST-gau.txt
githubsearchPATH=$outputPATH/$HOST-githubsearch.txt
automateSublist3r $HOST
automateSubfinder $HOST
automateAmass $HOST
automateOneForAll $HOST
automateAssetsFinder $HOST
automateFindomain $HOST
automatePuredns $HOST
automateGAU $HOST
automateGihubSubdomains $HOST
sortResults
resolveSubdomains
QUOTES
mv $outputPATH/results.txt $outputPATH/$HOST/$HOST.txt
rm -rf $outputPATH/*.txt
fi
fi