forked from six2dez/reconftw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·662 lines (595 loc) · 32.9 KB
/
install.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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
#!/usr/bin/env bash
. ./reconftw.cfg
dir=${tools}
double_check=false
# ARM Detection
if [ -f "/proc/cpuinfo" ]; then
if grep -q "Raspberry Pi 3" /proc/cpuinfo; then
IS_ARM="True"
RPI_3="True"
RPI_4="False"
elif grep -q "Raspberry Pi 4" /proc/cpuinfo; then
IS_ARM="True"
RPI_4="True"
RPI_3="False"
else
IS_ARM="False"
fi
elif grep -iq "arm" <<< "$(/usr/bin/arch)";then
IS_ARM="True"
else
IS_ARM="False"
fi
#Mac Osx Detecting
if [[ "$OSTYPE" == "darwin"* ]]; then
IS_MAC="True"
else
IS_MAC="False"
fi
# Check Bash version
#(bash --version | awk 'NR==1{print $4}' | cut -d'.' -f1) 2&>/dev/null || echo "Unable to get bash version, for MacOS run 'brew install bash' and rerun installer in a new terminal" && exit 1
BASH_VERSION=$(bash --version | awk 'NR==1{print $4}' | cut -d'.' -f1)
if [ "${BASH_VERSION}" -lt 4 ]; then
printf "${bred} Your Bash version is lower than 4, please update${reset}\n"
printf "%s Your Bash version is lower than 4, please update%s\n" "${bred}" "${reset}"
if [ "True" = "$IS_MAC" ]; then
printf "${yellow} For MacOS run 'brew install bash' and rerun installer in a new terminal${reset}\n\n"
exit 1;
fi
fi
declare -A gotools
gotools["gf"]="go install -v github.com/tomnomnom/gf@latest"
gotools["qsreplace"]="go install -v github.com/tomnomnom/qsreplace@latest"
gotools["amass"]="go install -v github.com/owasp-amass/amass/v3/...@master"
gotools["ffuf"]="go install -v github.com/ffuf/ffuf/v2@latest"
gotools["github-subdomains"]="go install -v github.com/gwen001/github-subdomains@latest"
gotools["gitlab-subdomains"]="go install github.com/gwen001/gitlab-subdomains@latest"
gotools["nuclei"]="go install -v github.com/projectdiscovery/nuclei/v2/cmd/nuclei@latest"
gotools["anew"]="go install -v github.com/tomnomnom/anew@latest"
gotools["notify"]="go install -v github.com/projectdiscovery/notify/cmd/notify@latest"
gotools["unfurl"]="go install -v github.com/tomnomnom/[email protected]"
gotools["httpx"]="go install -v github.com/projectdiscovery/httpx/cmd/httpx@latest"
gotools["github-endpoints"]="go install -v github.com/gwen001/github-endpoints@latest"
gotools["dnsx"]="go install -v github.com/projectdiscovery/dnsx/cmd/dnsx@latest"
gotools["subjs"]="go install -v github.com/lc/subjs@latest"
gotools["Gxss"]="go install -v github.com/KathanP19/Gxss@latest"
gotools["katana"]="go install github.com/projectdiscovery/katana/cmd/katana@latest"
gotools["crlfuzz"]="go install -v github.com/dwisiswant0/crlfuzz/cmd/crlfuzz@latest"
gotools["dalfox"]="go install -v github.com/hahwul/dalfox/v2@latest"
gotools["puredns"]="go install -v github.com/d3mondev/puredns/v2@latest"
gotools["interactsh-client"]="go install -v github.com/projectdiscovery/interactsh/cmd/interactsh-client@latest"
gotools["analyticsrelationships"]="go install -v github.com/Josue87/analyticsrelationships@latest"
gotools["gotator"]="go install -v github.com/Josue87/gotator@latest"
gotools["roboxtractor"]="go install -v github.com/Josue87/roboxtractor@latest"
gotools["mapcidr"]="go install -v github.com/projectdiscovery/mapcidr/cmd/mapcidr@latest"
gotools["cdncheck"]="go install -v github.com/projectdiscovery/cdncheck/cmd/cdncheck@latest"
gotools["dnstake"]="go install -v github.com/pwnesia/dnstake/cmd/dnstake@latest"
gotools["gowitness"]="go install -v github.com/sensepost/gowitness@latest"
gotools["tlsx"]="go install github.com/projectdiscovery/tlsx/cmd/tlsx@latest"
gotools["gitdorks_go"]="go install -v github.com/damit5/gitdorks_go@latest"
gotools["smap"]="go install -v github.com/s0md3v/smap/cmd/smap@latest"
gotools["dsieve"]="go install -v github.com/trickest/dsieve@master"
gotools["inscope"]="go install github.com/tomnomnom/hacks/inscope@latest"
gotools["enumerepo"]="go install github.com/trickest/enumerepo@latest"
gotools["Web-Cache-Vulnerability-Scanner"]="go install -v github.com/Hackmanit/Web-Cache-Vulnerability-Scanner@latest"
gotools["subfinder"]="go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest"
gotools["byp4xx"]="go install -v github.com/lobuhi/byp4xx@latest"
gotools["hakip2host"]="go install github.com/hakluke/hakip2host@latest"
gotools["gau"]="go install -v github.com/lc/gau/v2/cmd/gau@latest"
declare -A repos
repos["dorks_hunter"]="six2dez/dorks_hunter"
repos["pwndb"]="davidtavarez/pwndb"
repos["dnsvalidator"]="vortexau/dnsvalidator"
repos["interlace"]="codingo/Interlace"
repos["brutespray"]="x90skysn3k/brutespray"
repos["wafw00f"]="EnableSecurity/wafw00f"
repos["gf"]="tomnomnom/gf"
repos["Gf-Patterns"]="1ndianl33t/Gf-Patterns"
repos["ctfr"]="UnaPibaGeek/ctfr"
repos["xnLinkFinder"]="xnl-h4ck3r/xnLinkFinder"
repos["waymore"]="xnl-h4ck3r/waymore"
repos["Corsy"]="s0md3v/Corsy"
repos["CMSeeK"]="Tuhinshubhra/CMSeeK"
repos["fav-up"]="pielco11/fav-up"
repos["massdns"]="blechschmidt/massdns"
repos["Oralyzer"]="r0075h3ll/Oralyzer"
repos["testssl"]="drwetter/testssl.sh"
repos["commix"]="commixproject/commix"
repos["JSA"]="w9w/JSA"
repos["cloud_enum"]="initstring/cloud_enum"
repos["ultimate-nmap-parser"]="shifty0g/ultimate-nmap-parser"
repos["pydictor"]="LandGrey/pydictor"
repos["gitdorks_go"]="damit5/gitdorks_go"
repos["urless"]="xnl-h4ck3r/urless"
repos["trufflehog"]="trufflesecurity/trufflehog"
repos["smuggler"]="defparam/smuggler"
repos["Web-Cache-Vulnerability-Scanner"]="Hackmanit/Web-Cache-Vulnerability-Scanner"
repos["regulator"]="cramppet/regulator"
repos["byp4xx"]="lobuhi/byp4xx"
repos["Infoga"]="m4ll0k/Infoga"
repos["ghauri"]="r0oth3x49/ghauri"
function banner_web(){
echo -en "\033c"
printf "\n${bgreen}"
printf " ██▀███ ▓█████ ▄████▄ ▒█████ ███▄ █ █████▒▄▄▄█████▓ █ █░\n"
printf " ▓██ ▒ ██▒▓█ ▀ ▒██▀ ▀█ ▒██▒ ██▒ ██ ▀█ █ ▓██ ▒ ▓ ██▒ ▓▒▓█░ █ ░█░\n"
printf " ▓██ ░▄█ ▒▒███ ▒▓█ ▄ ▒██░ ██▒▓██ ▀█ ██▒▒████ ░ ▒ ▓██░ ▒░▒█░ █ ░█ \n"
printf " ▒██▀▀█▄ ▒▓█ ▄ ▒▓▓▄ ▄██▒▒██ ██░▓██▒ ▐▌██▒░▓█▒ ░ ░ ▓██▓ ░ ░█░ █ ░█ \n"
printf " ░██▓ ▒██▒░▒████▒▒ ▓███▀ ░░ ████▓▒░▒██░ ▓██░░▒█░ ▒██▒ ░ ░░██▒██▓ \n"
printf " ░ ▒▓ ░▒▓░░░ ▒░ ░░ ░▒ ▒ ░░ ▒░▒░▒░ ░ ▒░ ▒ ▒ ▒ ░ ▒ ░░ ░ ▓░▒ ▒ \n"
printf " ░▒ ░ ▒░ ░ ░ ░ ░ ▒ ░ ▒ ▒░ ░ ░░ ░ ▒░ ░ ░ ▒ ░ ░ \n"
printf " ░░ ░ ░ ░ ░ ░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░ \n"
printf " ░ ░ ░░ ░ ░ ░ ░ ░ \n"
printf " ░ \n"
printf " ${reconftw_version} by @six2dez\n"
}
install_webserver(){
printf "${bblue} Running: Installing web reconftw ${reset}\n\n"
printf "${yellow} Installing python libraries...${reset}\n\n"
# Install venv
printf "${yellow} python virtualenv install...${reset}\n\n"
$SUDO rm -rf /web/.venv/
$SUDO pip3 install virtualenv &>/dev/null
$SUDO virtualenv web/.venv/ &>/dev/null
if [ $? -eq 0 ]; then
printf "${yellow} Activating virtualenv...${reset}\n\n"
$SUDO source web/.venv/bin/activate
$SUDO pip3 install --upgrade pip &>/dev/null
else
printf '[ERROR] Failed to create virtualenv. Please install requirements mentioned in Documentation.'
exit 1
fi
printf "${yellow} Installing Requirements...${reset}\n\n"
$SUDO pip3 install -r $SCRIPTPATH/web/requirements.txt &>/dev/null
#$SUDO virtualenv web/env &>/dev/null
#$SUDO source web/env/bin/activate
#$SUDO pip3 install -r web/requirements.txt &>/dev/null
printf "${yellow} Installing tools...${reset}\n\n"
$SUDO apt install redis-server -y &>/dev/null
#$SUDO apt install postgresql -y &>/dev/null
# printf "${yellow} Database configuration...${reset}\n\n"
#$SUDO service postgresql restart &>/dev/null
#$SUDO su postgres -c 'psql -c "DROP DATABASE web;"' &>/dev/null
#$SUDO su postgres -c 'psql -c "CREATE DATABASE web;"' &>/dev/null
#read -p ' What Username is used in db: ' DBUser
#read -s -p ' What Password is used in db: ' DBPass
#$SUDO su postgres 'psql -c "DROP USER "'$DBUser &> /dev/null
#sed -i "s/'USER': '.*/'USER': '$DBUser',/" web/web/settings.py
#sed -i "s/'PASSWORD': '.*/'PASSWORD': '$DBPass',/" web/web/settings.py
#echo ""
#printf "${yellow} Creating DB User...${reset}\n\n"
#$SUDO su postgres -c "psql -c \"CREATE USER $DBUser with PASSWORD '$DBPass';\""
#$SUDO su postgres -c "psql -c \"ALTER ROLE $DBUser SET client_encoding TO 'utf8';\""
#$SUDO su postgres -c "psql -c \"ALTER ROLE $DBUser SET default_transaction_isolation TO 'read committed';\""
#$SUDO su postgres -c "psql -c \"ALTER ROLE $DBUser SET timezone TO 'UTC';\""
#$SUDO su postgres -c "psql -c \"GRANT ALL PRIVILEGES ON DATABASE web TO $DBUser;\""
printf "${yellow} Creating WEB User...${reset}\n\n"
$SUDO rm $SCRIPTPATH/web/db.sqlite3 &>/dev/null
$SUDO python3 $SCRIPTPATH/web/manage.py makemigrations &>/dev/null
$SUDO python3 $SCRIPTPATH/web/manage.py migrate &>/dev/null
$SUDO python3 $SCRIPTPATH/web/manage.py createsuperuser
printf "\n\n"
}
banner_web
printf "\n${bgreen} reconFTW installer/updater script ${reset}\n\n"
if [[ -d $dir && -d ~/.gf && -d ~/.config/notify/ && -d ~/.config/amass/ && -d ~/.config/nuclei/ && -f $dir/.github_tokens ]]; then
rftw_installed=true
else
rftw_installed=false
fi
# Display menu and wait for user input
while true; do
printf "${bblue} Choose one of the following options: ${reset}\n\n"
if $rftw_installed; then
printf "${bblue} 1. Install/Update ReconFTW (without Web Interface)${reset}\n\n"
printf "${bblue} 2. Install/Update ReconFTW + Install Web Interface${reset} ${yellow}(User Interaction needed!)${reset}\n\n"
printf "${bblue} 3. Setup Web Interface${reset}\n\n"
printf "${bblue} 4. Exit${reset}\n\n"
printf "${bgreen}#######################################################################${reset}\n\n"
read -p "$(echo -e ${bblue} "Insert option: "${reset})" option
printf "\n\n${bgreen}#######################################################################${reset}\n\n"
case $option in
1)
web=false
break
;;
2)
web=true
break
;;
3)
install_webserver
exit 1
;;
4)
printf "${bblue} Exiting...${reset}\n\n"
exit 1
;;
*)
printf "${bblue} Invalid option. Exiting...${reset}\n\n"
exit 1
;;
esac
else
printf "${bblue} 1. Install/Update ReconFTW${reset}\n\n"
printf "${bblue} 2. Install/Update ReconFTW + Install Web Interface${reset} ${yellow}(User Interaction needed!)${reset}\n\n"
printf "${bred} 3. Can't install Web Interface without ReconFTW${reset}\n\n"
printf "${bblue} 4. Exit${reset}\n\n"
printf "${bgreen}#######################################################################${reset}\n\n"
read -p "$(echo -e ${bblue} "Insert option: "${reset})" option
printf "\n${bgreen}#######################################################################${reset}\n\n"
case $option in
1)
web=false
break
;;
2)
web=true
break
;;
4)
printf "${bblue} Exiting...${reset}\n\n"
exit 1
;;
*)
printf "${bblue} Invalid option. Exiting...${reset}\n\n"
exit 1
;;
esac
fi
done
printf "${yellow} This may take time. So, go grab a coffee! ${reset}\n\n"
if [[ $(id -u | grep -o '^0$') == "0" ]]; then
SUDO=""
else
if sudo -n false 2>/dev/null; then
printf "${bred} Is strongly recommended to add your user to sudoers${reset}\n"
printf "${bred} This will avoid prompts for sudo password in the middle of the installation${reset}\n"
printf "${bred} And more important, in the middle of the scan (needed for nmap SYN scan)${reset}\n\n"
printf "${bred} echo \"${USERNAME} ALL=(ALL:ALL) NOPASSWD: ALL\" > /etc/sudoers.d/reconFTW${reset}\n\n"
fi
SUDO="sudo"
fi
install_apt(){
eval $SUDO apt update -y $DEBUG_STD
eval $SUDO DEBIAN_FRONTEND="noninteractive" apt install chromium-browser -y $DEBUG_STD
eval $SUDO DEBIAN_FRONTEND="noninteractive" apt install chromium -y $DEBUG_STD
eval $SUDO DEBIAN_FRONTEND="noninteractive" apt install python3 python3-pip build-essential gcc cmake ruby whois git curl libpcap-dev wget zip python3-dev pv dnsutils libssl-dev libffi-dev libxml2-dev libxslt1-dev zlib1g-dev nmap jq apt-transport-https lynx medusa xvfb libxml2-utils procps bsdmainutils libdata-hexdump-perl -y $DEBUG_STD
curl https://sh.rustup.rs -sSf | sh -s -- -y >/dev/null 2>&1
eval source "$HOME/.cargo/env $DEBUG_STD"
eval cargo install ripgen $DEBUG_STD
eval source "$HOME/.cargo/env $DEBUG_STD"
}
install_brew(){
if brew --version &>/dev/null; then
printf "${bgreen} brew is already installed ${reset}\n\n"
else
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
eval brew update -$DEBUG_STD
eval brew install --cask chromium $DEBUG_STD
eval brew install bash coreutils python massdns jq gcc cmake ruby git curl libpcap-dev wget zip python3-dev pv dnsutils whois libssl-dev libffi-dev libxml2-dev libxslt1-dev zlib1g-dev nmap jq apt-transport-https lynx medusa xvfb libxml2-utils libdata-hexdump-perl gnu-getopt $DEBUG_STD
export PATH="/opt/homebrew/opt/gnu-getopt/bin:$PATH"
echo 'export PATH="/opt/homebrew/opt/gnu-getopt/bin:$PATH"' >> ~/.zshrc
brew install rustup
rustup-init
eval cargo install ripgen $DEBUG_STD
}
install_yum(){
eval $SUDO yum groupinstall "Development Tools" -y $DEBUG_STD
eval $SUDO yum install python3 python3-pip gcc cmake ruby git curl libpcap-dev wget whois zip python3-devel pv bind-utils libopenssl-devel libffi-devel libxml2-devel libxslt-devel zlib-devel nmap jq lynx medusa xorg-x11-server-xvfb -y $DEBUG_STD
curl https://sh.rustup.rs -sSf | sh -s -- -y >/dev/null 2>&1
eval source "$HOME/.cargo/env $DEBUG_STD"
eval cargo install ripgen $DEBUG_STD
}
install_pacman(){
eval $SUDO pacman -Sy install python python-pip base-devel gcc cmake ruby git curl libpcap whois wget zip pv bind openssl libffi libxml2 libxslt zlib nmap jq lynx medusa xorg-server-xvfb -y $DEBUG_STD
curl https://sh.rustup.rs -sSf | sh -s -- -y >/dev/null 2>&1
eval source "$HOME/.cargo/env $DEBUG_STD"
eval cargo install ripgen $DEBUG_STD
}
eval git config --global --unset http.proxy $DEBUG_STD
eval git config --global --unset https.proxy $DEBUG_STD
printf "${bblue} Running: Looking for new reconFTW version${reset}\n\n"
eval git fetch $DEBUG_STD
BRANCH=$(git rev-parse --abbrev-ref HEAD)
HEADHASH=$(git rev-parse HEAD)
UPSTREAMHASH=$(git rev-parse "${BRANCH}@{upstream}")
if [ "$HEADHASH" != "$UPSTREAMHASH" ]
then
printf "${yellow} There is a new version, updating...${reset}\n\n"
if git status --porcelain | grep -q 'reconftw.cfg$'; then
mv reconftw.cfg reconftw.cfg_bck
printf "${yellow} reconftw.cfg has been backed up in reconftw.cfg_bck${reset}\n\n"
fi
eval git reset --hard $DEBUG_STD
eval git pull $DEBUG_STD
printf "${bgreen} Updated! Running new installer version...${reset}\n\n"
else
printf "${bgreen} reconFTW is already up to date!${reset}\n\n"
fi
printf "${bblue} Running: Installing system packages ${reset}\n\n"
if [ -f /etc/debian_version ]; then install_apt;
elif [ -f /etc/redhat-release ]; then install_yum;
elif [ -f /etc/arch-release ]; then install_pacman;
elif [ "True" = "$IS_MAC" ]; then install_brew;
elif [ -f /etc/os-release ]; then install_yum; #/etc/os-release fall in yum for some RedHat and Amazon Linux instances
fi
# Installing latest Golang version
version=$(curl -L -s https://golang.org/VERSION?m=text)
[[ $version = g* ]] || version="go1.20.3"
printf "${bblue} Running: Installing/Updating Golang ${reset}\n\n"
if [ "$install_golang" = "true" ]; then
if [[ $(eval type go $DEBUG_ERROR | grep -o 'go is') == "go is" ]] && [[ "$version" = $(go version | cut -d " " -f3) ]]
then
printf "${bgreen} Golang is already installed and updated ${reset}\n\n"
else
eval $SUDO rm -rf /usr/local/go $DEBUG_STD
if [ "True" = "$IS_ARM" ]; then
if [ "True" = "$RPI_3" ]; then
eval wget "https://dl.google.com/go/${version}.linux-armv6l.tar.gz" -O /tmp/${version}.linux-armv6l.tar.gz $DEBUG_STD
eval $SUDO tar -C /usr/local -xzf /tmp/"${version}.linux-armv6l.tar.gz" $DEBUG_STD
elif [ "True" = "$RPI_4" ]; then
eval wget "https://dl.google.com/go/${version}.linux-arm64.tar.gz" -O /tmp/${version}.linux-arm64.tar.gz $DEBUG_STD
eval $SUDO tar -C /usr/local -xzf /tmp/"${version}.linux-arm64.tar.gz" $DEBUG_STD
fi
elif [ "True" = "$IS_MAC" ]; then
if [ "True" = "$IS_ARM" ]; then
eval wget "https://dl.google.com/go/${version}.darwin-arm64.tar.gz" -O /tmp/${version}.darwin-arm64.tar.gz $DEBUG_STD
eval $SUDO tar -C /usr/local -xzf /tmp/"${version}.darwin-arm64.tar.gz" $DEBUG_STD
else
eval wget "https://dl.google.com/go/${version}.darwin-amd64.tar.gz" -O /tmp/${version}.darwin-amd64.tar.gz $DEBUG_STD
eval $SUDO tar -C /usr/local -xzf /tmp/"${version}.darwin-amd64.tar.gz" $DEBUG_STD
fi
else
eval wget "https://dl.google.com/go/${version}.linux-amd64.tar.gz" -O /tmp/${version}.linux-amd64.tar.gz $DEBUG_STD
eval $SUDO tar -C /usr/local -xzf /tmp/"${version}.linux-amd64.tar.gz" $DEBUG_STD
fi
eval $SUDO ln -sf /usr/local/go/bin/go /usr/local/bin/
#rm -rf $version*
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$HOME/.local/bin:$PATH
cat << EOF >> ~/"${profile_shell}"
# Golang vars
export GOROOT=/usr/local/go
export GOPATH=\$HOME/go
export PATH=\$GOPATH/bin:\$GOROOT/bin:\$HOME/.local/bin:\$PATH
EOF
fi
else
printf "${byellow} Golang will not be configured according to the user's prefereneces (reconftw.cfg install_golang var)${reset}\n";
fi
[ -n "$GOPATH" ] || { printf "${bred} GOPATH env var not detected, add Golang env vars to your \$HOME/.bashrc or \$HOME/.zshrc:\n\n export GOROOT=/usr/local/go\n export GOPATH=\$HOME/go\n export PATH=\$GOPATH/bin:\$GOROOT/bin:\$PATH\n\n"; exit 1; }
[ -n "$GOROOT" ] || { printf "${bred} GOROOT env var not detected, add Golang env vars to your \$HOME/.bashrc or \$HOME/.zshrc:\n\n export GOROOT=/usr/local/go\n export GOPATH=\$HOME/go\n export PATH=\$GOPATH/bin:\$GOROOT/bin:\$PATH\n\n"; exit 1; }
printf "${bblue} Running: Installing requirements ${reset}\n\n"
mkdir -p ~/.gf
mkdir -p $tools
mkdir -p ~/.config/notify/
mkdir -p ~/.config/amass/
mkdir -p ~/.config/nuclei/
touch $dir/.github_tokens
touch $dir/.gitlab_tokens
eval wget -N -c https://bootstrap.pypa.io/get-pip.py $DEBUG_STD && eval python3 get-pip.py $DEBUG_STD
eval rm -f get-pip.py $DEBUG_STD
#eval ln -s /usr/local/bin/pip3 /usr/local/bin/pip3 $DEBUG_STD
eval pip3 install -I -r requirements.txt $DEBUG_STD
printf "${bblue} Running: Installing Golang tools (${#gotools[@]})${reset}\n\n"
go env -w GO111MODULE=auto
go_step=0
for gotool in "${!gotools[@]}"; do
go_step=$((go_step + 1))
if [ "$upgrade_tools" = "false" ]; then
res=$(command -v "$gotool") && {
echo -e "[${yellow}SKIPPING${reset}] $gotool already installed in...${blue}${res}${reset}"
continue
}
fi
eval ${gotools[$gotool]} $DEBUG_STD
exit_status=$?
if [ $exit_status -eq 0 ]
then
printf "${yellow} $gotool installed (${go_step}/${#gotools[@]})${reset}\n"
else
printf "${red} Unable to install $gotool, try manually (${go_step}/${#gotools[@]})${reset}\n"
double_check=true
fi
done
printf "${bblue}\n Running: Installing repositories (${#repos[@]})${reset}\n\n"
# Repos with special configs
eval git clone https://github.com/projectdiscovery/nuclei-templates ~/nuclei-templates $DEBUG_STD
eval git clone https://github.com/geeknik/the-nuclei-templates.git ~/nuclei-templates/extra_templates $DEBUG_STD
eval wget -q -O - https://raw.githubusercontent.com/NagliNagli/BountyTricks/main/ssrf.yaml > ~/nuclei-templates/ssrf_nagli.yaml $DEBUG_STD
eval wget -q -O - https://raw.githubusercontent.com/NagliNagli/BountyTricks/main/sap-redirect.yaml > ~/nuclei-templates/sap-redirect_nagli.yaml $DEBUG_STD
eval nuclei -update-templates $DEBUG_STD
cd ~/nuclei-templates/extra_templates && eval git pull $DEBUG_STD
cd "$dir" || { echo "Failed to cd to $dir in ${FUNCNAME[0]} @ line ${LINENO}"; exit 1; }
eval git clone --depth 1 https://github.com/sqlmapproject/sqlmap.git $dir/sqlmap $DEBUG_STD
eval git clone --depth 1 https://github.com/drwetter/testssl.sh.git $dir/testssl.sh $DEBUG_STD
eval $SUDO git clone https://gitlab.com/exploit-database/exploitdb /opt/exploitdb $DEBUG_STD
eval $SUDO ln -sf /opt/exploitdb/searchsploit /usr/local/bin/searchsploit $DEBUG_STD
# Standard repos installation
repos_step=0
for repo in "${!repos[@]}"; do
repos_step=$((repos_step + 1))
if [ "$upgrade_tools" = "false" ]; then
unset is_installed
unset is_need_dl
[[ $repo == "Gf-Patterns" ]] && is_need_dl=1
[[ $repo == "gf" ]] && is_need_dl=1
res=$(command -v "$repo") && is_installed=1
[[ -z $is_need_dl ]] && [[ -n $is_installed ]] && {
# HERE: not installed yet.
echo -e "[${yellow}SKIPPING${reset}] $repo already installed in...${blue}${res}${reset}"
continue
}
fi
eval git clone https://github.com/${repos[$repo]} $dir/$repo $DEBUG_STD
eval cd $dir/$repo $DEBUG_STD
eval git pull $DEBUG_STD
exit_status=$?
if [ $exit_status -eq 0 ]
then
printf "${yellow} $repo installed (${repos_step}/${#repos[@]})${reset}\n"
else
printf "${red} Unable to install $repo, try manually (${repos_step}/${#repos[@]})${reset}\n"
double_check=true
fi
if ( [ -z $is_installed ] && [ "$upgrade_tools" = "false" ] ) || [ "$upgrade_tools" = "true" ] ; then
if [ -s "requirements.txt" ]; then
eval $SUDO pip3 install -r requirements.txt $DEBUG_STD
fi
if [ -s "setup.py" ]; then
eval $SUDO pip3 install . $DEBUG_STD
fi
if [ "massdns" = "$repo" ]; then
eval make $DEBUG_STD && strip -s bin/massdns && eval $SUDO cp bin/massdns /usr/local/bin/ $DEBUG_ERROR
fi
fi
if [ "gf" = "$repo" ]; then
eval cp -r examples ~/.gf $DEBUG_ERROR
elif [ "Gf-Patterns" = "$repo" ]; then
eval mv ./*.json ~/.gf $DEBUG_ERROR
elif [ "trufflehog" = "$repo" ]; then
eval go install $DEBUG_STD
fi
cd "$dir" || { echo "Failed to cd to $dir in ${FUNCNAME[0]} @ line ${LINENO}"; exit 1; }
done
if [ "True" = "$IS_ARM" ]; then
if [ "True" = "$RPI_3" ]; then
eval wget -N -c https://github.com/Edu4rdSHL/unimap/releases/latest/download/unimap-armv7 $DEBUG_STD
eval wget -N -c https://github.com/dwisiswant0/ppfuzz/releases/download/v1.0.1/ppfuzz-v1.0.1-armv7-unknown-linux-gnueabihf.tar.gz $DEBUG_STD
eval $SUDO tar -C /usr/local/bin/ -xzf ppfuzz-v1.0.1-armv7-unknown-linux-gnueabihf.tar.gz $DEBUG_STD
eval $SUDO rm -rf ppfuzz-v1.0.1-armv7-unknown-linux-gnueabihf.tar.gz $DEBUG_STD
eval $SUDO mv unimap-armv7 /usr/local/bin/unimap
elif [ "True" = "$RPI_4" ] || [ "True" = "$IS_MAC" ]; then
eval wget -N -c https://github.com/Edu4rdSHL/unimap/releases/latest/download/unimap-aarch64 $DEBUG_STD
eval wget -N -c https://github.com/dwisiswant0/ppfuzz/releases/download/v1.0.1/ppfuzz-v1.0.1-aarch64-unknown-linux-gnueabihf.tar.gz $DEBUG_STD
eval $SUDO tar -C /usr/local/bin/ -xzf ppfuzz-v1.0.1-aarch64-unknown-linux-gnueabihf.tar.gz $DEBUG_STD
eval $SUDO rm -rf ppfuzz-v1.0.1-aarch64-unknown-linux-gnueabihf.tar.gz $DEBUG_STD
eval $SUDO mv unimap-aarch64 /usr/local/bin/unimap
fi
elif [ "True" = "$IS_MAC" ]; then
if [ "True" = "$IS_ARM" ]; then
eval wget -N -c https://github.com/Edu4rdSHL/unimap/releases/latest/download/unimap-armv7 $DEBUG_STD
eval wget -N -c https://github.com/dwisiswant0/ppfuzz/releases/download/v1.0.1/ppfuzz-v1.0.1-armv7-unknown-linux-gnueabihf.tar.gz $DEBUG_STD
eval $SUDO tar -C /usr/local/bin/ -xzf ppfuzz-v1.0.1-armv7-unknown-linux-gnueabihf.tar.gz $DEBUG_STD
eval $SUDO rm -rf ppfuzz-v1.0.1-armv7-unknown-linux-gnueabihf.tar.gz $DEBUG_STD
eval $SUDO mv unimap-armv7 /usr/local/bin/unimap
else
eval wget -N -c https://github.com/Edu4rdSHL/unimap/releases/latest/download/unimap-osx $DEBUG_STD
eval wget -N -c https://github.com/dwisiswant0/ppfuzz/releases/download/v1.0.1/ppfuzz-v1.0.1-x86_64-apple-darwin.tar.gz $DEBUG_STD
eval $SUDO tar -C /usr/local/bin/ -xzf ppfuzz-v1.0.1-x86_64-apple-darwin.tar.gz $DEBUG_STD
eval $SUDO rm -rf ppfuzz-v1.0.1-x86_64-apple-darwin.tar.gz $DEBUG_STD
eval $SUDO mv unimap-osx /usr/local/bin/unimap
fi
else
eval wget -N -c https://github.com/Edu4rdSHL/unimap/releases/download/0.4.0/unimap-linux $DEBUG_STD
eval wget -N -c https://github.com/dwisiswant0/ppfuzz/releases/download/v1.0.1/ppfuzz-v1.0.1-x86_64-unknown-linux-musl.tar.gz $DEBUG_STD
eval $SUDO tar -C /usr/local/bin/ -xzf ppfuzz-v1.0.1-x86_64-unknown-linux-musl.tar.gz $DEBUG_STD
eval $SUDO rm -rf ppfuzz-v1.0.1-x86_64-unknown-linux-musl.tar.gz $DEBUG_STD
eval $SUDO mv unimap-linux /usr/local/bin/unimap
fi
eval $SUDO chmod 755 /usr/local/bin/unimap
eval $SUDO strip -s /usr/local/bin/unimap $DEBUG_STD
eval $SUDO chmod 755 /usr/local/bin/ppfuzz
eval $SUDO strip -s /usr/local/bin/ppfuzz $DEBUG_STD
eval notify $DEBUG_STD
eval subfinder $DEBUG_STD
eval subfinder $DEBUG_STD
printf "${bblue}\n Running: Downloading required files ${reset}\n\n"
## Downloads
[ ! -f ~/.config/amass/config.ini ] && wget -q -O ~/.config/amass/config.ini https://raw.githubusercontent.com/owasp-amass/amass/master/examples/config.ini
[ ! -f ~/.config/notify/provider-config.yaml ] && wget -q -O ~/.config/notify/provider-config.yaml https://gist.githubusercontent.com/six2dez/23a996bca189a11e88251367e6583053/raw
wget -q -O - https://raw.githubusercontent.com/devanshbatham/ParamSpider/master/gf_profiles/potential.json > ~/.gf/potential.json
wget -q -O - https://raw.githubusercontent.com/m4ll0k/Bug-Bounty-Toolz/master/getjswords.py > ${tools}/getjswords.py
wget -q -O - https://raw.githubusercontent.com/n0kovo/n0kovo_subdomains/main/n0kovo_subdomains_huge.txt > ${subs_wordlist_big}
wget -q -O - https://raw.githubusercontent.com/six2dez/resolvers_reconftw/main/resolvers_trusted.txt > ${resolvers_trusted}
wget -q -O - https://raw.githubusercontent.com/trickest/resolvers/main/resolvers.txt > ${resolvers}
wget -q -O - https://gist.github.com/six2dez/a307a04a222fab5a57466c51e1569acf/raw > ${subs_wordlist}
wget -q -O - https://gist.github.com/six2dez/ffc2b14d283e8f8eff6ac83e20a3c4b4/raw > ${tools}/permutations_list.txt
wget -q -O - https://raw.githubusercontent.com/six2dez/OneListForAll/main/onelistforallmicro.txt > ${fuzz_wordlist}
wget -q -O - https://gist.githubusercontent.com/six2dez/a89a0c7861d49bb61a09822d272d5395/raw > ${lfi_wordlist}
wget -q -O - https://gist.githubusercontent.com/six2dez/ab5277b11da7369bf4e9db72b49ad3c1/raw > ${ssti_wordlist}
wget -q -O - https://gist.github.com/six2dez/d62ab8f8ffd28e1c206d401081d977ae/raw > ${tools}/headers_inject.txt
wget -q -O - https://gist.githubusercontent.com/six2dez/6e2d9f4932fd38d84610eb851014b26e/raw > ${tools}/axiom_config.sh
wget -q -O - https://raw.githubusercontent.com/NagliNagli/BountyTricks/main/ssrf.yaml > ~/nuclei-templates/extra_templates/ssrf.yaml
wget -q -O - https://raw.githubusercontent.com/NagliNagli/BountyTricks/main/sap-redirect.yaml > ~/nuclei-templates/extra_templates/sap-redirect.yaml
eval $SUDO chmod +x $tools/axiom_config.sh
## Last check
if [ "$double_check" = "true" ]; then
printf "${bblue} Running: Double check for installed tools ${reset}\n\n"
go_step=0
for gotool in "${!gotools[@]}"; do
go_step=$((go_step + 1))
eval type -P $gotool $DEBUG_STD || { eval ${gotools[$gotool]} $DEBUG_STD; }
exit_status=$?
done
repos_step=0
for repo in "${!repos[@]}"; do
repos_step=$((repos_step + 1))
eval cd $dir/$repo $DEBUG_STD || { eval git clone https://github.com/${repos[$repo]} $dir/$repo $DEBUG_STD && cd $dir/$repo; }
eval git pull $DEBUG_STD
exit_status=$?
if [ -s "setup.py" ]; then
eval $SUDO python3 setup.py install $DEBUG_STD
fi
if [ "massdns" = "$repo" ]; then
eval make $DEBUG_STD && strip -s bin/massdns && eval $SUDO cp bin/massdns /usr/local/bin/ $DEBUG_ERROR
elif [ "gf" = "$repo" ]; then
eval cp -r examples ~/.gf $DEBUG_ERROR
elif [ "Gf-Patterns" = "$repo" ]; then
eval mv ./*.json ~/.gf $DEBUG_ERROR
fi
cd "$dir" || { echo "Failed to cd to $dir in ${FUNCNAME[0]} @ line ${LINENO}"; exit 1; }
done
fi
# BBRF Setup
if [ ! -d "$HOME/.bbrf/" ] ; then
mkdir "$HOME/.bbrf/"
fi
if [ -d "$HOME/.bbrf/" ] && [ ! -s "$HOME/.bbrf/config.json" ]; then
cat > "$HOME/.bbrf/config.json" << EOF
{
"username": "$BBRF_USERNAME",
"password": "$BBRF_PASSWORD",
"couchdb": "https://$BBRF_SERVER/bbrf",
"slack_token": "<a slack token to receive notifications>",
"discord_webhook": "<your discord webhook if you want one>",
"ignore_ssl_errors": false
}
EOF
fi
printf "${bblue} Running: Performing last configurations ${reset}\n\n"
## Last steps
if [ "$generate_resolvers" = true ]; then
if [ ! -s "$resolvers" ] || [[ $(find "$resolvers" -mtime +1 -print) ]] ; then
${reset}\n\n"Checking resolvers lists...\n Accurate resolvers are the key to great results\n This may take around 10 minutes if it's not updated ${reset}\n\n"
eval rm -f $resolvers 2>>"$LOGFILE"
dnsvalidator -tL https://public-dns.info/nameservers.txt -threads $DNSVALIDATOR_THREADS -o $resolvers &>/dev/null
dnsvalidator -tL https://raw.githubusercontent.com/blechschmidt/massdns/master/lists/resolvers.txt -threads $DNSVALIDATOR_THREADS -o tmp_resolvers &>/dev/null
[ -s "tmp_resolvers" ] && cat tmp_resolvers | anew -q $resolvers
[ -s "tmp_resolvers" ] && rm -f tmp_resolvers &>/dev/null
[ ! -s "$resolvers" ] && wget -q -O - https://raw.githubusercontent.com/trickest/resolvers/main/resolvers.txt > ${resolvers}
[ ! -s "$resolvers_trusted" ] && wget -q -O - https://raw.githubusercontent.com/six2dez/resolvers_reconftw/main/resolvers_trusted.txt > ${resolvers_trusted}
printf "${yellow} Resolvers updated\n ${reset}\n\n"
fi
generate_resolvers=false
else
[ ! -s "$resolvers" ] || if [[ $(find "$resolvers" -mtime +1 -print) ]] ; then
${reset}"\n\nChecking resolvers lists...\n Accurate resolvers are the key to great results\n Downloading new resolvers ${reset}\n\n"
wget -q -O - https://raw.githubusercontent.com/trickest/resolvers/main/resolvers.txt > ${resolvers}
wget -q -O - https://raw.githubusercontent.com/six2dez/resolvers_reconftw/main/resolvers_trusted.txt > ${resolvers_trusted}
printf "${yellow} Resolvers updated\n ${reset}\n\n"
fi
fi
#eval h8mail -g $DEBUG_STD
## Stripping all Go binaries
eval strip -s "$HOME"/go/bin/* $DEBUG_STD
eval $SUDO cp "$HOME"/go/bin/* /usr/local/bin/ $DEBUG_STD
if [ "$web" = true ]; then
sh -c "echo 3 | $SCRIPTPATH/install.sh"
fi
printf "${yellow} Remember set your api keys:\n - amass (~/.config/amass/config.ini)\n - subfinder (~/.config/subfinder/provider-config.yaml)\n - GitLab (~/Tools/.gitlab_tokens)\n - SSRF Server (COLLAB_SERVER in reconftw.cfg or env var) \n - Blind XSS Server (XSS_SERVER in reconftw.cfg or env var) \n - notify (~/.config/notify/provider-config.yaml) \n - WHOISXML API (WHOISXML_API in reconftw.cfg or env var)\n - subgpt_cookies.json (subgpt_cookies.json file, follow instructions at https://github.com/s0md3v/SubGPT#getting-bing-cookie)\n\n\n${reset}"
printf "${bgreen} Finished!${reset}\n\n"
printf "\n\n${bgreen}#######################################################################${reset}\n"