reconFTW is a tool designed to perform automated recon on a target domain by running the best set of tools to perform scanning and finding out vulnerabilities
Shell bug-bountybugbountybugbounty-tooldnshackingnucleiosintpenetration-testingpentestpentest-toolpentestingreconreconnaissancescannersecuritysecurity-toolssubdomainsubdomain-enumerationvulnerabilities
harden bash variable use in install script
Marcos Maradod3c096948532
diff --git a/install.sh b/install.shindex d1ad3ce..cee18e3 100755--- a/install.sh+++ b/install.sh@@ -35,8 +35,9 @@ fi#(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 1BASH_VERSION=$(bash --version | awk 'NR==1{print $4}' | cut -d'.' -f1)-if [ ${BASH_VERSION} -lt 4 ]; then+if [ "${BASH_VERSION}" -lt 4 ]; thenprintf "${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" ]; thenprintf "${yellow} For MacOS run 'brew install bash' and rerun installer in a new terminal${reset}\n\n"exit 1;@@ -131,8 +132,8 @@ install_apt(){eval $SUDO DEBIAN_FRONTEND="noninteractive" apt install chromium -y $DEBUG_STDeval $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 tor medusa xvfb libxml2-utils procps bsdmainutils libdata-hexdump-perl -y $DEBUG_STDeval $SUDO systemctl enable tor $DEBUG_STD- rust=$(curl https://sh.rustup.rs -sSf | sh -s -- -y) &>/dev/null- eval source $HOME/.cargo/env $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}@@ -154,16 +155,16 @@ install_brew(){install_yum(){eval $SUDO yum groupinstall "Development Tools" -y $DEBUG_STDeval $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 tor medusa xorg-x11-server-xvfb -y $DEBUG_STD- rust=$(curl https://sh.rustup.rs -sSf | sh -s -- -y) &>/dev/null- eval source $HOME/.cargo/env $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 tor medusa xorg-server-xvfb -y $DEBUG_STDeval $SUDO systemctl enable --now tor.service $DEBUG_STD- rust=$(curl https://sh.rustup.rs -sSf | sh -s -- -y) &>/dev/null- eval source $HOME/.cargo/env $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}@@ -175,12 +176,12 @@ printf "${bblue} Running: Looking for new reconFTW version${reset}\n\n"eval git fetch $DEBUG_STDBRANCH=$(git rev-parse --abbrev-ref HEAD)HEADHASH=$(git rev-parse HEAD)-UPSTREAMHASH=$(git rev-parse ${BRANCH}@{upstream})+UPSTREAMHASH=$(git rev-parse "${BRANCH}@{upstream}")if [ "$HEADHASH" != "$UPSTREAMHASH" ]thenprintf "${yellow} There is a new version, updating...${reset}\n\n"- if [ -n "$(git status --porcelain | egrep 'reconftw.cfg$')" ]; then+ if git status --porcelain | grep -q 'reconftw.cfg$'; thenmv reconftw.cfg reconftw.cfg_bckprintf "${yellow} reconftw.cfg has been backed up in reconftw.cfg_bck${reset}\n\n"fi@@ -211,30 +212,30 @@ if [ "$install_golang" = "true" ]; theneval $SUDO rm -rf /usr/local/go $DEBUG_STDif [ "True" = "$IS_ARM" ]; thenif [ "True" = "$RPI_3" ]; then- eval wget https://dl.google.com/go/${version}.linux-armv6l.tar.gz $DEBUG_STD- eval $SUDO tar -C /usr/local -xzf ${version}.linux-armv6l.tar.gz $DEBUG_STD+ eval wget "https://dl.google.com/go/${version}.linux-armv6l.tar.gz" $DEBUG_STD+ eval $SUDO tar -C /usr/local -xzf "${version}.linux-armv6l.tar.gz" $DEBUG_STDelif [ "True" = "$RPI_4" ]; then- eval wget https://dl.google.com/go/${version}.linux-arm64.tar.gz $DEBUG_STD- eval $SUDO tar -C /usr/local -xzf ${version}.linux-arm64.tar.gz $DEBUG_STD+ eval wget "https://dl.google.com/go/${version}.linux-arm64.tar.gz" $DEBUG_STD+ eval $SUDO tar -C /usr/local -xzf "${version}.linux-arm64.tar.gz" $DEBUG_STDfielif [ "True" = "$IS_MAC" ]; thenif [ "True" = "$IS_ARM" ]; then- eval wget https://dl.google.com/go/${version}.darwin-arm64.tar.gz $DEBUG_STD- eval $SUDO tar -C /usr/local -xzf ${version}.darwin-arm64.tar.gz $DEBUG_STD+ eval wget "https://dl.google.com/go/${version}.darwin-arm64.tar.gz" $DEBUG_STD+ eval $SUDO tar -C /usr/local -xzf "${version}.darwin-arm64.tar.gz" $DEBUG_STDelse- eval wget https://dl.google.com/go/${version}.darwin-amd64.tar.gz $DEBUG_STD- eval $SUDO tar -C /usr/local -xzf ${version}.darwin-amd64.tar.gz $DEBUG_STD+ eval wget "https://dl.google.com/go/${version}.darwin-amd64.tar.gz" $DEBUG_STD+ eval $SUDO tar -C /usr/local -xzf "${version}.darwin-amd64.tar.gz" $DEBUG_STDfielse- eval wget https://dl.google.com/go/${version}.linux-amd64.tar.gz $DEBUG_STD- eval $SUDO tar -C /usr/local -xzf ${version}.linux-amd64.tar.gz $DEBUG_STD+ eval wget "https://dl.google.com/go/${version}.linux-amd64.tar.gz" $DEBUG_STD+ eval $SUDO tar -C /usr/local -xzf "${version}.linux-amd64.tar.gz" $DEBUG_STDfieval $SUDO ln -sf /usr/local/go/bin/go /usr/local/bin/#rm -rf $version*export GOROOT=/usr/local/goexport GOPATH=$HOME/goexport PATH=$GOPATH/bin:$GOROOT/bin:$HOME/.local/bin:$PATH-cat << EOF >> ~/${profile_shell}+cat << EOF >> ~/"${profile_shell}"# Golang varsexport GOROOT=/usr/local/go@@ -323,7 +324,7 @@ for repo in "${!repos[@]}"; doelif [ "gf" = "$repo" ]; theneval cp -r examples ~/.gf $DEBUG_ERRORelif [ "Gf-Patterns" = "$repo" ]; then- eval mv *.json ~/.gf $DEBUG_ERROR+ eval mv ./*.json ~/.gf $DEBUG_ERRORelif [ "trufflehog" = "$repo" ]; thengo installfi@@ -414,7 +415,7 @@ if [ "$double_check" = "true" ]; thenelif [ "gf" = "$repo" ]; theneval cp -r examples ~/.gf $DEBUG_ERRORelif [ "Gf-Patterns" = "$repo" ]; then- eval mv *.json ~/.gf $DEBUG_ERROR+ eval mv ./*.json ~/.gf $DEBUG_ERRORficd "$dir" || { echo "Failed to cd to $dir in ${FUNCNAME[0]} @ line ${LINENO}"; exit 1; }done@@ -422,10 +423,10 @@ fi# BBRF Setupif [ ! -d "$HOME/.bbrf/" ] ; then- mkdir $HOME/.bbrf/+ mkdir "$HOME/.bbrf/"fiif [ -d "$HOME/.bbrf/" ] && [ ! -s "$HOME/.bbrf/config.json" ]; then- cat > $HOME/.bbrf/config.json << EOF+ cat > "$HOME/.bbrf/config.json" << EOF{"username": "$BBRF_USERNAME","password": "$BBRF_PASSWORD",@@ -464,9 +465,9 @@ fieval h8mail -g $DEBUG_STD## Stripping all Go binaries-eval strip -s $HOME/go/bin/* $DEBUG_STD+eval strip -s "$HOME"/go/bin/* $DEBUG_STD-eval $SUDO cp $HOME/go/bin/* /usr/local/bin/ $DEBUG_STD+eval $SUDO cp "$HOME"/go/bin/* /usr/local/bin/ $DEBUG_STDprintf "${yellow} Remember set your api keys:\n - amass (~/.config/amass/config.ini)\n - GitHub (~/Tools/.github_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 - theHarvester (~/Tools/theHarvester/api-keys.yaml or /etc/theHarvester/api-keys.yaml)\n - H8mail (~/Tools/h8mail_config.ini)\n - WHOISXML API (WHOISXML_API in reconftw.cfg or env var)\n\n\n${reset}"printf "${bgreen} Finished!${reset}\n\n"