@@ -6,45 +6,37 @@ dir=${tools}
66double_check=false
77
88# ARM Detection
9- if [[ $( uname -m) == " amd64" ]] || [[ $( uname -m) == " x86_64" ]]; then
10- IS_ARM=" False"
11- fi
12- if [[ $( uname -m) == " arm64" ]] || [[ $( uname -m) == " armv6l" ]]; then
13- IS_ARM=" True"
14- if [[ $( uname -m) == " arm64" ]]; then
15- RPI_4=" False"
16- else
17- RPI_3=" True"
18- fi
19- fi
9+ ARCH=$( uname -m)
10+ case $ARCH in
11+ amd64|x86_64) IS_ARM=" False" ;;
12+ arm64|armv6l)
13+ IS_ARM=" True"
14+ RPI_4=$( [[ $ARCH == " arm64" ]] && echo " True" || echo " False" )
15+ RPI_3=$( [[ $ARCH == " arm64" ]] && echo " False" || echo " True" )
16+ ;;
17+ esac
2018
2119# Mac Osx Detecting
22- if [[ " $OSTYPE " == " darwin" * ]]; then
23- IS_MAC=" True"
24- else
25- IS_MAC=" False"
26- fi
27-
28- # Check Bash version
29- # (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
20+ IS_MAC=$( [[ " $OSTYPE " == " darwin" * ]] && echo " True" || echo " False" )
3021
3122BASH_VERSION=$( bash --version | awk ' NR==1{print $4}' | cut -d' .' -f1)
3223if [ " ${BASH_VERSION} " -lt 4 ]; then
3324 printf " ${bred} Your Bash version is lower than 4, please update${reset} \n"
34- printf " %s Your Bash version is lower than 4, please update%s\n" " ${bred} " " ${reset} "
25+ printf " %s Your Bash version is lower than 4, please update%s\n" " ${bred} " " ${reset} " >&2
3526 if [ " True" = " $IS_MAC " ]; then
3627 printf " ${yellow} For MacOS run 'brew install bash' and rerun installer in a new terminal${reset} \n\n"
3728 exit 1;
3829 fi
3930fi
4031
32+ # Declaring Go tools and their installation commands
4133declare -A gotools
4234gotools[" gf" ]=" go install -v github.com/tomnomnom/gf@latest"
4335gotools[" qsreplace" ]=" go install -v github.com/tomnomnom/qsreplace@latest"
4436gotools[" amass" ]=" go install -v github.com/owasp-amass/amass/v3/...@master"
4537gotools[" ffuf" ]=" go install -v github.com/ffuf/ffuf/v2@latest"
4638gotools[" github-subdomains" ]=" go install -v github.com/gwen001/github-subdomains@latest"
47- gotools[" gitlab-subdomains" ]=" go install github.com/gwen001/gitlab-subdomains@latest"
39+ gotools[" gitlab-subdomains" ]=" go install -v github.com/gwen001/gitlab-subdomains@latest"
4840gotools[" nuclei" ]=" go install -v github.com/projectdiscovery/nuclei/v2/cmd/nuclei@latest"
4941gotools[" anew" ]=" go install -v github.com/tomnomnom/anew@latest"
5042gotools[" notify" ]=" go install -v github.com/projectdiscovery/notify/cmd/notify@latest"
@@ -54,7 +46,7 @@ gotools["github-endpoints"]="go install -v github.com/gwen001/github-endpoints@l
5446gotools[" dnsx" ]=" go install -v github.com/projectdiscovery/dnsx/cmd/dnsx@latest"
5547gotools[" subjs" ]=" go install -v github.com/lc/subjs@latest"
5648gotools[" Gxss" ]=" go install -v github.com/KathanP19/Gxss@latest"
57- gotools[" katana" ]=" go install github.com/projectdiscovery/katana/cmd/katana@latest"
49+ gotools[" katana" ]=" go install -v github.com/projectdiscovery/katana/cmd/katana@latest"
5850gotools[" crlfuzz" ]=" go install -v github.com/dwisiswant0/crlfuzz/cmd/crlfuzz@latest"
5951gotools[" dalfox" ]=" go install -v github.com/hahwul/dalfox/v2@latest"
6052gotools[" puredns" ]=" go install -v github.com/d3mondev/puredns/v2@latest"
@@ -66,21 +58,22 @@ gotools["mapcidr"]="go install -v github.com/projectdiscovery/mapcidr/cmd/mapcid
6658gotools[" cdncheck" ]=" go install -v github.com/projectdiscovery/cdncheck/cmd/cdncheck@latest"
6759gotools[" dnstake" ]=" go install -v github.com/pwnesia/dnstake/cmd/dnstake@latest"
6860gotools[" gowitness" ]=" go install -v github.com/sensepost/gowitness@latest"
69- gotools[" tlsx" ]=" go install github.com/projectdiscovery/tlsx/cmd/tlsx@latest"
61+ gotools[" tlsx" ]=" go install -v github.com/projectdiscovery/tlsx/cmd/tlsx@latest"
7062gotools[" gitdorks_go" ]=" go install -v github.com/damit5/gitdorks_go@latest"
7163gotools[" smap" ]=" go install -v github.com/s0md3v/smap/cmd/smap@latest"
7264gotools[" dsieve" ]=" go install -v github.com/trickest/dsieve@master"
73- gotools[" inscope" ]=" go install github.com/tomnomnom/hacks/inscope@latest"
74- gotools[" enumerepo" ]=" go install github.com/trickest/enumerepo@latest"
65+ gotools[" inscope" ]=" go install -v github.com/tomnomnom/hacks/inscope@latest"
66+ gotools[" enumerepo" ]=" go install -v github.com/trickest/enumerepo@latest"
7567gotools[" Web-Cache-Vulnerability-Scanner" ]=" go install -v github.com/Hackmanit/Web-Cache-Vulnerability-Scanner@latest"
7668gotools[" subfinder" ]=" go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest"
7769gotools[" byp4xx" ]=" go install -v github.com/lobuhi/byp4xx@latest"
78- gotools[" hakip2host" ]=" go install github.com/hakluke/hakip2host@latest"
70+ gotools[" hakip2host" ]=" go install -v github.com/hakluke/hakip2host@latest"
7971gotools[" gau" ]=" go install -v github.com/lc/gau/v2/cmd/gau@latest"
80- gotools[" Mantra" ]=" go install github.com/MrEmpy/Mantra@latest"
81- gotools[" crt" ]=" go install github.com/cemulus/crt@latest"
72+ gotools[" Mantra" ]=" go install -v github.com/MrEmpy/Mantra@latest"
73+ gotools[" crt" ]=" go install -v github.com/cemulus/crt@latest"
8274gotools[" s3scanner" ]=" go install -v github.com/sa7mon/s3scanner@latest"
8375
76+ # Declaring repositories and their paths
8477declare -A repos
8578repos[" dorks_hunter" ]=" six2dez/dorks_hunter"
8679repos[" pwndb" ]=" davidtavarez/pwndb"
@@ -115,7 +108,7 @@ repos["trufflehog"]="trufflesecurity/trufflehog"
115108
116109
117110function banner_web(){
118- echo -en " \033c "
111+ tput clear
119112 printf " \n${bgreen} "
120113 printf " ██▀███ ▓█████ ▄████▄ ▒█████ ███▄ █ █████▒▄▄▄█████▓ █ █░\n"
121114 printf " ▓██ ▒ ██▒▓█ ▀ ▒██▀ ▀█ ▒██▒ ██▒ ██ ▀█ █ ▓██ ▒ ▓ ██▒ ▓▒▓█░ █ ░█░\n"
@@ -130,8 +123,18 @@ function banner_web(){
130123 printf " ${reconftw_version} by @six2dez\n"
131124}
132125
126+ function install_ppfuzz() {
127+ local url=$1
128+ local tar_file=$2
129+
130+ wget -N -c " $url " $DEBUG_STD
131+ eval $SUDO tar -C /usr/local/bin/ -xzf " $tar_file " $DEBUG_STD
132+ eval $SUDO rm -rf " $tar_file " $DEBUG_STD
133+ }
134+
135+ # This function installs various tools and repositories as per the configuration.
133136function install_tools(){
134- # eval ln -s /usr/local/bin/pip3 /usr/local/bin/pip3 $DEBUG_STD
137+
135138 eval pip3 install -I -r requirements.txt $DEBUG_STD
136139
137140 printf " ${bblue} Running: Installing Golang tools (${# gotools[@]} )${reset} \n\n"
@@ -219,28 +222,18 @@ function install_tools(){
219222
220223 if [ " True" = " $IS_ARM " ]; then
221224 if [ " True" = " $RPI_3 " ]; then
222- 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
223- eval $SUDO tar -C /usr/local/bin/ -xzf ppfuzz-v1.0.1-armv7-unknown-linux-gnueabihf.tar.gz $DEBUG_STD
224- eval $SUDO rm -rf ppfuzz-v1.0.1-armv7-unknown-linux-gnueabihf.tar.gz $DEBUG_STD
225+ install_ppfuzz " https://github.com/dwisiswant0/ppfuzz/releases/download/v1.0.1/ppfuzz-v1.0.1-armv7-unknown-linux-gnueabihf.tar.gz" " ppfuzz-v1.0.1-armv7-unknown-linux-gnueabihf.tar.gz"
225226 elif [ " True" = " $RPI_4 " ]; then
226- 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
227- eval $SUDO tar -C /usr/local/bin/ -xzf ppfuzz-v1.0.1-aarch64-unknown-linux-gnueabihf.tar.gz $DEBUG_STD
228- eval $SUDO rm -rf ppfuzz-v1.0.1-aarch64-unknown-linux-gnueabihf.tar.gz $DEBUG_STD
227+ install_ppfuzz " https://github.com/dwisiswant0/ppfuzz/releases/download/v1.0.1/ppfuzz-v1.0.1-aarch64-unknown-linux-gnueabihf.tar.gz" " ppfuzz-v1.0.1-aarch64-unknown-linux-gnueabihf.tar.gz"
229228 fi
230229 elif [ " True" = " $IS_MAC " ]; then
231230 if [ " True" = " $IS_ARM " ]; then
232- 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
233- eval $SUDO tar -C /usr/local/bin/ -xzf ppfuzz-v1.0.1-armv7-unknown-linux-gnueabihf.tar.gz $DEBUG_STD
234- eval $SUDO rm -rf ppfuzz-v1.0.1-armv7-unknown-linux-gnueabihf.tar.gz $DEBUG_STD
231+ install_ppfuzz " https://github.com/dwisiswant0/ppfuzz/releases/download/v1.0.1/ppfuzz-v1.0.1-armv7-unknown-linux-gnueabihf.tar.gz" " ppfuzz-v1.0.1-armv7-unknown-linux-gnueabihf.tar.gz"
235232 else
236- 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
237- eval $SUDO tar -C /usr/local/bin/ -xzf ppfuzz-v1.0.1-x86_64-apple-darwin.tar.gz $DEBUG_STD
238- eval $SUDO rm -rf ppfuzz-v1.0.1-x86_64-apple-darwin.tar.gz $DEBUG_STD
233+ install_ppfuzz " https://github.com/dwisiswant0/ppfuzz/releases/download/v1.0.1/ppfuzz-v1.0.1-x86_64-apple-darwin.tar.gz" " ppfuzz-v1.0.1-x86_64-apple-darwin.tar.gz"
239234 fi
240235 else
241- 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
242- eval $SUDO tar -C /usr/local/bin/ -xzf ppfuzz-v1.0.1-x86_64-unknown-linux-musl.tar.gz $DEBUG_STD
243- eval $SUDO rm -rf ppfuzz-v1.0.1-x86_64-unknown-linux-musl.tar.gz $DEBUG_STD
236+ install_ppfuzz " https://github.com/dwisiswant0/ppfuzz/releases/download/v1.0.1/ppfuzz-v1.0.1-x86_64-unknown-linux-musl.tar.gz" " ppfuzz-v1.0.1-x86_64-unknown-linux-musl.tar.gz"
244237 fi
245238 eval $SUDO chmod 755 /usr/local/bin/ppfuzz
246239 eval $SUDO strip -s /usr/local/bin/ppfuzz $DEBUG_STD
@@ -272,7 +265,14 @@ install_webserver(){
272265 $SUDO pip3 install -r $SCRIPTPATH /web/requirements.txt & > /dev/null
273266
274267 printf " ${yellow} Installing tools...${reset} \n\n"
268+ if command -v apt > /dev/null; then
275269 $SUDO apt install redis-server -y & > /dev/null
270+ elif command -v yum > /dev/null; then
271+ $SUDO yum install redis -y & > /dev/null
272+ else
273+ printf ' [ERROR] Unable to find a supported package manager. Please install redis manually.\n'
274+ exit 1
275+ fi
276276
277277 printf " ${yellow} Creating WEB User...${reset} \n\n"
278278 $SUDO rm $SCRIPTPATH /web/db.sqlite3 & > /dev/null
@@ -305,9 +305,15 @@ display_menu(){
305305 printf " ${bblue} 3. Setup Web Interface${reset} ${yellow} (User Interaction needed!)${reset} \n\n"
306306 printf " ${bblue} 4. Exit${reset} \n\n"
307307 printf " ${bgreen} #######################################################################${reset} \n\n"
308- read -p " $( echo -e $ {bblue} " Insert option: " ${reset} ) " option
308+ read -p " ${bblue} Insert option: ${reset} " option
309309 printf " \n\n${bgreen} #######################################################################${reset} \n\n"
310310
311+ option=$( echo " $option " | tr -d ' [:space:]' )
312+ if ! [[ " $option " =~ ^[1-4]$ ]]; then
313+ printf " ${bred} Invalid option. Please try again.${reset} \n\n"
314+ continue
315+ fi
316+
311317 case $option in
312318 1)
313319 web=false
@@ -354,22 +360,26 @@ display_menu(){
354360 exit 1
355361 ;;
356362 * )
357- printf " ${bblue } Invalid option. Exiting.. .${reset} \n\n"
363+ printf " ${bred } Invalid option. Please try again .${reset} \n\n"
358364 exit 1
359365 ;;
360366 esac
361367 fi
362368 done
363369}
364370
365- if [ " $1 " = ' --tools' ]; then
366- install_tools
367- fi
368-
369- if [ " $1 " != ' --auto' ]; then
370- echo " $1 "
371- display_menu
372- fi
371+ case " $1 " in
372+ --tools)
373+ install_tools
374+ ;;
375+ --auto)
376+ # possibly some other actions
377+ ;;
378+ * )
379+ echo " $1 "
380+ display_menu
381+ ;;
382+ esac
373383
374384printf " ${yellow} This may take time. So, go grab a coffee! ${reset} \n\n"
375385
@@ -432,7 +442,11 @@ eval git config --global --unset https.proxy $DEBUG_STD
432442
433443printf " ${bblue} Running: Looking for new reconFTW version${reset} \n\n"
434444
435- eval git fetch $DEBUG_STD
445+ if ! eval git fetch $DEBUG_STD ; then
446+ echo " Failed to fetch updates."
447+ exit 1
448+ fi
449+
436450BRANCH=$( git rev-parse --abbrev-ref HEAD)
437451HEADHASH=$( git rev-parse HEAD)
438452UPSTREAMHASH=$( git rev-parse " ${BRANCH} @{upstream}" )
@@ -608,6 +622,6 @@ if [ "$web" = true ]; then
608622 printf " \n${bgreen} Web server is installed, to set it up run ./install.sh and select option 3 ${reset} \n\n"
609623fi
610624
611- 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} "
625+ 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\n${reset} "
612626printf " ${bgreen} Finished!${reset} \n\n"
613627printf " \n\n${bgreen} #######################################################################${reset} \n"
0 commit comments