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
Multiple installer fixes @979
six2dezd79df5f1cd88
diff --git a/Makefile b/Makefileindex d436fdc..495d5d8 100644--- a/Makefile+++ b/Makefile@@ -1,7 +1,7 @@GH_CLI := $(shell command -v gh 2> /dev/null)PRIVATE_REPO := $(shell echo $${PRIV_REPO-reconftw-data})-.PHONY: sync upload bootstrap rm+.PHONY: sync upload bootstrap rm lint fmt# bootstrap a private repo to store databootstrap:@@ -29,3 +29,17 @@ upload:git add . && \git commit -m "Data upload" && \git push origin $(shell git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')++lint:+ @if command -v shellcheck >/dev/null 2>&1; then \+ shellcheck install.sh reconftw.sh || true; \+ else \+ echo "shellcheck not found. Install: https://www.shellcheck.net/"; \+ fi++fmt:+ @if command -v shfmt >/dev/null 2>&1; then \+ shfmt -w -i 4 -bn -ci install.sh reconftw.sh; \+ else \+ echo "shfmt not found. Install: https://github.com/mvdan/sh"; \+ fidiff --git a/README.md b/README.mdindex 0de60bb..4b98357 100644--- a/README.md+++ b/README.md@@ -186,9 +186,31 @@ reconFTW is packed with features to make reconnaissance thorough and efficient.----## 💿 Installation--reconFTW supports multiple installation methods to suit different environments. Ensure you have sufficient disk space (at least 10 GB recommended) and a stable internet connection.+## 💿 Installation++reconFTW supports multiple installation methods to suit different environments. Ensure you have sufficient disk space (at least 10 GB recommended) and a stable internet connection.++### Quickstart++1) Clone and install++```bash+git clone https://github.com/six2dez/reconftw+cd reconftw+./install.sh --verbose+```++2) Run a scan (full + resume)++```bash+./reconftw.sh -d example.com -r+```++3) Minimal run (fast profile, fewer deps)++```bash+./reconftw.sh -d example.com --profile fast+```### Local Installation (PC/VPS/VM)@@ -214,7 +236,7 @@ reconFTW supports multiple installation methods to suit different environments.- Set `install_golang=false` in `reconftw.cfg` if Golang is already configured.- Check the [Installation Guide](https://github.com/six2dez/reconftw/wiki/0.-Installation-Guide) for detailed instructions.-### Docker+### Docker1. **Pull the Image**:@@ -244,6 +266,31 @@ reconFTW supports multiple installation methods to suit different environments.---+## 🛠️ Troubleshooting++- Bash 4+ on macOS: The scripts auto-relaunch under Homebrew Bash. If you see a message about Bash < 4, run `brew install bash`, open a new terminal, and re-run `./install.sh`.+- timeout on macOS: macOS provides `gtimeout` via `brew install coreutils`. The scripts now detect and use it automatically.+- Network hiccups: Installers hide most command output. If something fails, re-run with `upgrade_tools=true` in `reconftw.cfg` or install the missing tool manually (the error will name it).+- GOPATH binaries: Binaries are copied to `/usr/local/bin`. If you prefer not to, ensure `~/go/bin` is in your `PATH`.+- Nuclei templates: If templates weren’t cloned, remove `~/nuclei-templates` and re-run `./install.sh`.++## 🔑 API Checklist (Optional)++- `subfinder`: `~/.config/subfinder/provider-config.yaml`+- GitHub tokens: `~/Tools/.github_tokens` (one per line)+- GitLab tokens: `~/Tools/.gitlab_tokens` (one per line)+- WHOISXML: set `WHOISXML_API` in `reconftw.cfg` or env var+- Slack/Discord/Telegram: configure `notify` in `~/.config/notify/provider-config.yaml`+- SSRF server: set `COLLAB_SERVER` env/cfg if used+- Blind XSS server: set `XSS_SERVER` env/cfg if used++## 💾 Requirements++- Disk: 10–20 GB free recommended (toolchain + data)+- Network: stable connection during installation and updates+- OS: Linux/macOS with Bash ≥ 4+- Extras: `shellcheck` and `shfmt` (optional) for `make lint`/`make fmt`+## ⚙️ ConfigurationThe `reconftw.cfg` file controls the entire execution of reconFTW. It allows fine-grained customization of:diff --git a/install.sh b/install.shindex f2bd89b..6d96ef8 100755--- a/install.sh+++ b/install.sh@@ -1,5 +1,9 @@#!/bin/bash+# Safer bash defaults+set -Eeuo pipefail+IFS=$'\n\t'+# Detect if the script is being run in MacOS with Homebrew Bashif [[ "$OSTYPE" == "darwin"* && "$BASH" != "/opt/homebrew/bin/bash" ]]; thenexec /opt/homebrew/bin/bash "$0" "$@"@@ -9,8 +13,8 @@ fiCONFIG_FILE="./reconftw.cfg"if [[ ! -f $CONFIG_FILE ]]; then- echo -e "${bred}[!] Config file reconftw.cfg not found.${reset}"- exit 1+ printf "%b[!] Config file reconftw.cfg not found.%b\n" "$bred" "$reset"+ exit 1fisource "$CONFIG_FILE"@@ -25,14 +29,90 @@ ARCH=$(uname -m)# macOS DetectionIS_MAC=$([[ $OSTYPE == "darwin"* ]] && echo "True" || echo "False")+# timeout/gtimeout compatibility+if command -v timeout >/dev/null 2>&1; then+ TIMEOUT_CMD="timeout"+elif command -v gtimeout >/dev/null 2>&1; then+ TIMEOUT_CMD="gtimeout"+else+ TIMEOUT_CMD=""+fi++# Globals for CLI overrides+FORCE_UPDATE=${FORCE_UPDATE:-false}+VERBOSE=${VERBOSE:-false}+LOGFILE=${LOGFILE:-}+DRY_RUN=${DRY_RUN:-false}++# If LOGFILE provided via env/flag, tee all output+if [[ -n "${LOGFILE}" ]]; then+ exec > >(tee -a "${LOGFILE}") 2>&1+fi++# Helper: run with timeout seconds if available+run_to() {+ local secs=$1; shift || true+ if [[ -n "$TIMEOUT_CMD" ]]; then "$TIMEOUT_CMD" "$secs" "$@"; else "$@"; fi+}++# Helper: optionally dry-run+run_cmd() {+ if [[ "$DRY_RUN" == "true" ]]; then+ printf "%s\n" "[DRY-RUN] $*"; return 0+ fi+ "$@"+}++# Helper: quiet run (respect VERBOSE)+q() {+ if [[ "$DRY_RUN" == "true" ]]; then printf "%s\n" "[DRY-RUN] $*"; return 0; fi+ if [[ "$VERBOSE" == "true" ]]; then "$@"; else { "$@"; } &>/dev/null; fi+}++# Helper: quiet run with timeout+q_to() {+ local secs=$1; shift || true+ if [[ "$DRY_RUN" == "true" ]]; then printf "%s\n" "[DRY-RUN] (to ${secs}) $*"; return 0; fi+ if [[ -n "$TIMEOUT_CMD" ]]; then+ if [[ "$VERBOSE" == "true" ]]; then "$TIMEOUT_CMD" "$secs" "$@"; else { "$TIMEOUT_CMD" "$secs" "$@"; } &>/dev/null; fi+ else+ if [[ "$VERBOSE" == "true" ]]; then "$@"; else { "$@"; } &>/dev/null; fi+ fi+}++# Helper: retry with linear backoff+retry() {+ local attempts=$1; local delay=$2; shift 2+ local n=0+ until "$@"; do+ n=$((n+1))+ if (( n >= attempts )); then return 1; fi+ sleep $((delay*n))+ done+}++# Non-fatal error trap: log and continue+trap 'rc=$?; ts=$(date +"%Y-%m-%d %H:%M:%S"); cmd=${BASH_COMMAND}; loc_ln=${BASH_LINENO[0]:-0}; msg="[$ts] install.sh ERR($rc) @ line ${loc_ln} :: ${cmd}"; if [[ -n "${LOGFILE:-}" ]]; then echo "$msg" >>"$LOGFILE"; else echo "$msg" >&2; fi' ERR++# Basic network precheck+check_network() {+ printf "%bRunning: Network precheck%b\n" "$bblue" "$reset"+ if ! run_to 5 bash -lc 'getent hosts github.com 2>/dev/null || dig +short github.com 2>/dev/null || nslookup github.com 2>/dev/null'; then+ printf "%b[!] DNS resolution for github.com failed. Check your network.%b\n" "$bred" "$reset"+ fi+ if ! run_to 10 curl -I -s https://github.com >/dev/null 2>&1; then+ printf "%b[!] HTTPS connectivity to github.com failed. Installer may fail.%b\n" "$yellow" "$reset"+ fi+}+# Check Bash versionBASH_VERSION_NUM=$(bash --version | awk 'NR==1{print $4}' | cut -d'.' -f1)if [[ $BASH_VERSION_NUM -lt 4 ]]; then- echo -e "${bred}Your Bash version is lower than 4, please update.${reset}"- if [[ $IS_MAC == "True" ]]; then- echo -e "${yellow}For macOS, run 'brew install bash' and rerun the installer in a new terminal.${reset}"- fi- exit 1+ printf "%bYour Bash version is lower than 4, please update.%b\n" "$bred" "$reset"+ if [[ $IS_MAC == "True" ]]; then+ printf "%bFor macOS, run 'brew install bash' and rerun the installer in a new terminal.%b\n" "$yellow" "$reset"+ fi+ exit 1fi# Declare Go tools and their installation commands@@ -160,122 +240,131 @@ EOF# Function to install Go toolsfunction install_tools() {- echo -e "${bblue}Running: Installing Golang tools (${#gotools[@]})${reset}\n"+ printf "%bRunning: Installing Golang tools (%d)%b\n\n" "$bblue" "${#gotools[@]}" "$reset"local go_step=0local failed_tools=()for gotool in "${!gotools[@]}"; do- ((go_step++))+ ((++go_step))if [[ $upgrade_tools == "false" ]]; thenif command -v "$gotool" &>/dev/null; then- echo -e "[${yellow}SKIPPING${reset}] $gotool already installed at $(command -v "$gotool")"+ printf "[%bSKIPPING%b] %s already installed at %s\n" "$yellow" "$reset" "$gotool" "$(command -v "$gotool")"continuefifi- # Install the Go tool- eval "${gotools[$gotool]}" &>/dev/null- exit_status=$?- if [[ $exit_status -eq 0 ]]; then- echo -e "${yellow}$gotool installed (${go_step}/${#gotools[@]})${reset}"+ # Install the Go tool (guard against set -e by using if)+ if q bash -lc "${gotools[$gotool]}"; then+ printf "%b%s installed (%d/%d)%b\n" "$yellow" "$gotool" "$go_step" "${#gotools[@]}" "$reset"else- echo -e "${red}Unable to install $gotool, try manually (${go_step}/${#gotools[@]})${reset}"+ printf "%bUnable to install %s, try manually (%d/%d)%b\n" "$red" "$gotool" "$go_step" "${#gotools[@]}" "$reset"failed_tools+=("$gotool")double_check=truefidone- echo -e "\n${bblue}Running: Installing pipx tools (${#repos[@]})${reset}\n"+ printf "\n%bRunning: Installing pipx tools (%d)%b\n\n" "$bblue" "${#pipxtools[@]}" "$reset"local pipx_step=0local failed_pipx_tools=()for pipxtool in "${!pipxtools[@]}"; do- ((pipx_step++))+ ((++pipx_step))if [[ $upgrade_tools == "false" ]]; thenif command -v "$pipxtool" &>/dev/null; then- echo -e "[${yellow}SKIPPING${reset}] $pipxtool already installed at $(command -v "$pipxtool")"+ printf "[%bSKIPPING%b] %s already installed at %s\n" "$yellow" "$reset" "$pipxtool" "$(command -v "$pipxtool")"continuefifi# Install the pipx tool- eval pipx install "git+https://github.com/${pipxtools[$pipxtool]}" &>/dev/null+ q pipx install "git+https://github.com/${pipxtools[$pipxtool]}"exit_status=$?if [[ $exit_status -ne 0 ]]; then- echo -e "${red}Failed to install $pipxtool, try manually (${pipx_step}/${#pipxtools[@]})${reset}"+ printf "%bFailed to install %s, try manually (%d/%d)%b\n" "$red" "$pipxtool" "$pipx_step" "${#pipxtools[@]}" "$reset"failed_pipx_tools+=("$pipxtool")double_check=truecontinuefi# Upgrade the pipx tool- eval pipx upgrade "${pipxtool}" &>/dev/null+ q pipx upgrade "${pipxtool}"exit_status=$?if [[ $exit_status -ne 0 ]]; then- echo -e "${red}Failed to upgrade $pipxtool, try manually (${pipx_step}/${#pipxtools[@]})${reset}"+ printf "%bFailed to upgrade %s, try manually (%d/%d)%b\n" "$red" "$pipxtool" "$pipx_step" "${#pipxtools[@]}" "$reset"failed_pipx_tools+=("$pipxtool")double_check=truecontinuefi- echo -e "${yellow}$pipxtool installed (${pipx_step}/${#pipxtools[@]})${reset}"+ printf "%b%s installed (%d/%d)%b\n" "$yellow" "$pipxtool" "$pipx_step" "${#pipxtools[@]}" "$reset"done- echo -e "\n${bblue}Running: Installing repositories (${#repos[@]})${reset}\n"+ printf "\n%bRunning: Installing repositories (%d)%b\n\n" "$bblue" "${#repos[@]}" "$reset"local repos_step=0local failed_repos=()for repo in "${!repos[@]}"; do- ((repos_step++))+ ((++repos_step))if [[ $upgrade_tools == "false" ]]; thenif [[ -d "${dir}/${repo}" ]]; then- echo -e "[${yellow}SKIPPING${reset}] Repository $repo already cloned in ${dir}/${repo}"- continue- fi- fi- # Clone the repository- if [[ ! -d "${dir}/${repo}" || -z "$(ls -A "${dir}/${repo}")" ]]; then- git clone --filter="blob:none" "https://github.com/${repos[$repo]}" "${dir}/${repo}" &>/dev/null- exit_status=$?- if [[ $exit_status -ne 0 ]]; then- echo -e "${red}Unable to clone repository $repo.${reset}"- failed_repos+=("$repo")- double_check=true+ printf "[%bSKIPPING%b] Repository %s already cloned in %s\n" "$yellow" "$reset" "$repo" "${dir}/${repo}"continuefifi+ # Clone the repository+ if [[ ! -d "${dir}/${repo}" || -z "$(ls -A "${dir}/${repo}")" ]]; then+ if retry 3 3 q_to 180 git clone --filter="blob:none" "https://github.com/${repos[$repo]}" "${dir}/${repo}"; then+ exit_status=0+ else+ exit_status=$?+ fi+ if [[ $exit_status -ne 0 ]]; then+ printf "%bUnable to clone repository %s%b\n" "$red" "$repo" "$reset"+ failed_repos+=("$repo")+ double_check=true+ continue+ fi+ fi# Navigate to the repository directorycd "${dir}/${repo}" || {- echo -e "${red}Failed to navigate to directory '${dir}/${repo}'${reset}"+ printf "%bFailed to navigate to directory '%s'%b\n" "$red" "${dir}/${repo}" "$reset"failed_repos+=("$repo")double_check=truecontinue}# Pull the latest changes- git pull &>/dev/null- exit_status=$?- if [[ $exit_status -ne 0 ]]; then- echo -e "${red}Failed to pull updates for repository $repo.${reset}"- failed_repos+=("$repo")- double_check=true- continue- fi+ if retry 3 3 q_to 60 git pull; then+ exit_status=0+ else+ exit_status=$?+ fi+ if [[ $exit_status -ne 0 ]]; then+ printf "%bFailed to pull updates for repository %s%b\n" "$red" "$repo" "$reset"+ failed_repos+=("$repo")+ double_check=true+ continue+ fi# Install requirements inside a virtual environmentif [[ -s "requirements.txt" ]]; thenif [[ ! -f "venv/bin/activate" ]]; thenpython3 -m venv venv &>/dev/nullfi+ # shellcheck disable=SC1091source venv/bin/activate- eval "pip3 install --upgrade -r requirements.txt $DEBUG_STD" &>/dev/null+ if ! pip3 install --upgrade -r requirements.txt &>/dev/null; then+ printf "%bFailed to install Python requirements for %s%b\n" "$red" "$repo" "$reset"+ failed_repos+=("$repo")+ double_check=true+ fiif [ "$repo" = "dorks_hunter" ]; then- pip install xnldorker &>/dev/null+ pip install xnldorker &>/dev/null || truefi- deactivate+ deactivate || truefi# Special handling for certain repositories@@ -297,14 +386,6 @@ function install_tools() {go build -o ffufPostprocessing main.go &>/dev/nullchmod +x ./ffufPostprocessing;;- "misconfig-mapper")- git reset --hard origin/main &>/dev/null- git pull &>/dev/null- go mod tidy &>/dev/null- go build -o misconfig-mapper &>/dev/null- chmod +x ./misconfig-mapper &>/dev/null- cp misconfig-mapper $HOME/go/bin/ &>/dev/null- ;;"trufflehog")go install &>/dev/null;;@@ -312,45 +393,46 @@ function install_tools() {# Copy gf patterns if applicableif [[ $repo == "gf" ]]; then- cp -r examples ${HOME}/.gf &>/dev/null+ cp -r examples "${HOME}/.gf" &>/dev/null || trueelif [[ $repo == "Gf-Patterns" ]]; then- cp ./*.json ${HOME}/.gf &>/dev/null+ cp ./*.json "${HOME}/.gf" &>/dev/null || trueelif [[ $repo == "sus_params" ]]; thenfor f in ./gf-patterns/*.json; dobase=$(basename "$f")dest="${HOME}/.gf/$base"- cat "$f" | anew -q "$dest" >/dev/null+ cat "$f" | anew -q "$dest" >/dev/null || truedonefi# Return to the main directorycd "$dir" || {- echo -e "${red}Failed to navigate back to directory '$dir'.${reset}"+ printf "%bFailed to navigate back to directory '%s'.%b\n" "$red" "$dir" "$reset"exit 1}- echo -e "${yellow}$repo installed (${repos_step}/${#repos[@]})${reset}"+ printf "%b%s installed (%d/%d)%b\n" "$yellow" "$repo" "$repos_step" "${#repos[@]}" "$reset"done# Notify and ensure subfinder is installed twice (as per original script)- notify &>/dev/null- subfinder &>/dev/null- subfinder &>/dev/null+ # Guard with command checks to avoid aborting under set -e+ q command -v notify >/dev/null 2>&1 && q notify || true+ q command -v subfinder >/dev/null 2>&1 && q subfinder || true+ q command -v subfinder >/dev/null 2>&1 && q subfinder || truemkdir -p ${NUCLEI_TEMPLATES_PATH} &>/dev/null#cent init -f &>/dev/null#cent -p ${NUCLEI_TEMPLATES_PATH} &>/dev/null# Handle failed installationsif [[ ${#failed_tools[@]} -ne 0 ]]; then- echo -e "\n${red}Failed to install the following Go tools: ${failed_tools[*]}${reset}"+ printf "\n%bFailed to install the following Go tools: %s%b\n" "$red" "${failed_tools[*]}" "$reset"fiif [[ ${#failed_pipx_tools[@]} -ne 0 ]]; then- echo -e "\n${red}Failed to install the following pipx tools: ${failed_pipx_tools[*]}${reset}"+ printf "\n%bFailed to install the following pipx tools: %s%b\n" "$red" "${failed_pipx_tools[*]}" "$reset"fiif [[ ${#failed_repos[@]} -ne 0 ]]; then- echo -e "\n${red}Failed to clone or update the following repositories:\n${failed_repos[*]}${reset}"+ printf "\n%bFailed to clone or update the following repositories:%b\n%s\n" "$red" "$reset" "${failed_repos[*]}"fi}@@ -362,28 +444,36 @@ function reset_git_proxies() {# Function to check for updatesfunction check_updates() {- echo -e "${bblue}Running: Looking for new reconFTW version${reset}\n"-- if timeout 10 git fetch; then- BRANCH=$(git rev-parse --abbrev-ref HEAD)- HEADHASH=$(git rev-parse HEAD)- UPSTREAMHASH=$(git rev-parse "${BRANCH}@{upstream}")-- if [[ $HEADHASH != "$UPSTREAMHASH" ]]; then- echo -e "${yellow}A new version is available. Updating...${reset}\n"- if git status --porcelain | grep -q 'reconftw.cfg$'; then- mv reconftw.cfg reconftw.cfg_bck- echo -e "${yellow}reconftw.cfg has been backed up to reconftw.cfg_bck${reset}\n"- fi- git reset --hard &>/dev/null- git pull &>/dev/null- echo -e "${bgreen}Updated! Running the new installer version...${reset}\n"- else- echo -e "${bgreen}reconFTW is already up to date!${reset}\n"- fi- else- echo -e "\n${bred}[!] Unable to check for updates.${reset}\n"- fi+ printf "%bRunning: Looking for new reconFTW version%b\n" "$bblue" "$reset"++ if { [[ -n "$TIMEOUT_CMD" ]] && $TIMEOUT_CMD 10 git fetch; } || git fetch; then+ BRANCH=$(git rev-parse --abbrev-ref HEAD)+ HEADHASH=$(git rev-parse HEAD)+ UPSTREAMHASH=$(git rev-parse "${BRANCH}@{upstream}")++ if [[ $HEADHASH != "$UPSTREAMHASH" ]]; then+ if git status --porcelain | grep -q .; then+ if [[ "$FORCE_UPDATE" == "true" ]]; then+ printf "%bLocal changes detected; forcing update.%b\n" "$yellow" "$reset"+ else+ printf "%bLocal changes detected. Skipping auto-update. Re-run with --force-update to override.%b\n" "$yellow" "$reset"+ return 0+ fi+ fi+ printf "%bA new version is available. Updating...%b\n" "$yellow" "$reset"+ if git status --porcelain | grep -q 'reconftw.cfg$'; then+ mv reconftw.cfg reconftw.cfg_bck+ printf "%breconftw.cfg has been backed up to reconftw.cfg_bck%b\n" "$yellow" "$reset"+ fi+ git reset --hard &>/dev/null+ run_to 60 git pull &>/dev/null+ printf "%bUpdated! Running the new installer version...%b\n" "$bgreen" "$reset"+ else+ printf "%breconFTW is already up to date!%b\n" "$bgreen" "$reset"+ fi+ else+ printf "\n%b[!] Unable to check for updates.%b\n" "$bred" "$reset"+ fi}# Function to install Golang@@ -395,11 +485,11 @@ function install_golang_version() {version="$latest_version"fi- echo -e "${bblue}Running: Installing/Updating Golang($version) ${reset}\n"+ printf "%bRunning: Installing/Updating Golang(%s) %b\n" "$bblue" "$version" "$reset"if [[ $install_golang == "true" ]]; thenif command -v go &>/dev/null && [[ $version == "$(go version | awk '{print $3}')" ]]; then- echo -e "${bgreen}Golang is already installed and up to date.${reset}\n"+ printf "%bGolang is already installed and up to date.%b\n" "$bgreen" "$reset"else$SUDO rm -rf /usr/local/go &>/dev/null || true@@ -427,7 +517,7 @@ function install_golang_version() {fi;;*)- echo -e "${bred}[!] Unsupported architecture. Please install go manually.${reset}"+ printf "%b[!] Unsupported architecture. Please install go manually.%b\n" "$bred" "$reset"exit 1;;esac@@ -447,23 +537,23 @@ export PATH=\$GOPATH/bin:\$GOROOT/bin:\$HOME/.local/bin:\$PATHEOFfielse- echo -e "${byellow}Golang will not be configured according to the user's preferences (install_golang=false in reconftw.cfg).${reset}\n"+ printf "%bGolang will not be configured according to the user's preferences (install_golang=false in reconftw.cfg).%b\n" "$byellow" "$reset"fi# Validate Go environment variablesif [[ -z ${GOPATH-} ]]; then- echo -e "${bred}GOPATH environment variable not detected. Add Golang environment variables to your \$HOME/.bashrc or \$HOME/.zshrc:${reset}"- echo -e "export GOROOT=/usr/local/go"- echo -e 'export GOPATH=$HOME/go'- echo -e "export PATH=\$GOPATH/bin:\$GOROOT/bin:\$PATH\n"+ printf "%bGOPATH environment variable not detected. Add Golang environment variables to your \$HOME/.bashrc or \$HOME/.zshrc:%b\n" "$bred" "$reset"+ printf "export GOROOT=/usr/local/go\n"+ printf 'export GOPATH=$HOME/go\n'+ printf 'export PATH=\$GOPATH/bin:\$GOROOT/bin:\$PATH\n\n'exit 1fiif [[ -z ${GOROOT-} ]]; then- echo -e "${bred}GOROOT environment variable not detected. Add Golang environment variables to your \$HOME/.bashrc or \$HOME/.zshrc:${reset}"- echo -e "export GOROOT=/usr/local/go"- echo -e 'export GOPATH=$HOME/go'- echo -e "export PATH=\$GOPATH/bin:\$GOROOT/bin:\$PATH\n"+ printf "%bGOROOT environment variable not detected. Add Golang environment variables to your \$HOME/.bashrc or \$HOME/.zshrc:%b\n" "$bred" "$reset"+ printf "export GOROOT=/usr/local/go\n"+ printf 'export GOPATH=$HOME/go\n'+ printf 'export PATH=\$GOPATH/bin:\$GOROOT/bin:\$PATH\n\n'exit 1fi}@@ -482,7 +572,7 @@ function install_system_packages() {elif [[ -f /etc/os-release ]]; theninstall_yum # Assuming RedHat-basedelse- echo -e "${bred}[!] Unsupported OS. Please install dependencies manually.${reset}"+ printf "%b[!] Unsupported OS. Please install dependencies manually.%b\n" "$bred" "$reset"exit 1fi}@@ -498,30 +588,89 @@ function install_apt() {source "${HOME}/.cargo/env"cargo install ripgen &>/dev/nullpipx ensurepath -f &>/dev/null- pip install jsbeautifier &>/dev/null+ # Install jsbeautifier and shodan CLI in isolated environments to avoid PEP 668 conflicts+ pipx install jsbeautifier &>/dev/null || true+ pipx install shodan &>/dev/null || pipx upgrade shodan &>/dev/null || true}# Function to install required packages for macOSfunction install_brew() {- if command -v brew &>/dev/null; then- echo -e "${bgreen}brew is already installed.${reset}\n"- else- /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"- fi- brew update &>/dev/null- brew install --formula bash coreutils gnu-getopt python pipx massdns jq gcc cmake ruby git curl wget zip pv bind whois nmap jq lynx medusa &>/dev/null- brew install rustup &>/dev/null- rustup-init -y &>/dev/null- cargo install ripgen &>/dev/null+ if command -v brew &>/dev/null; then+ printf "%bbrew is already installed.%b\n" "$bgreen" "$reset"+ else+ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"+ fi+ brew update &>/dev/null+ brew install --formula bash coreutils gnu-getopt gnu-sed python pipx massdns jq gcc cmake ruby git curl wget zip pv bind whois nmap lynx medusa shodan &>/dev/null+ brew install rustup &>/dev/null+ rustup-init -y &>/dev/null+ cargo install ripgen &>/dev/null}# Function to install required packages for RedHat-based systemsfunction install_yum() {$SUDO yum groupinstall "Development Tools" -y &>/dev/null+ # Base install first (python3 may be 3.6 on older EL)+ $SUDO yum install -y epel-release &>/dev/null || true$SUDO yum install -y python3 python3-pip gcc cmake ruby git curl libpcap whois wget pipx zip pv bind-utils openssl-devel libffi-devel libxml2-devel libxslt-devel zlib-devel nmap jq lynx medusa xorg-x11-server-xvfb &>/dev/null++ # Ensure Python >= 3.7 on yum-based systems+ if ! python3 - <<'PYCHK' &>/dev/null; then+import sys; raise SystemExit(0 if sys.version_info >= (3,7) else 1)+PYCHK+ then+ # Try DNF/YUM module streams (EL8+/EL9+) for newer Python+ if command -v dnf &>/dev/null || $SUDO yum -y module list python38 &>/dev/null; then+ # Prefer 3.9, then 3.8+ if command -v dnf &>/dev/null; then+ $SUDO dnf -y module install python39 &>/dev/null || $SUDO dnf -y module install python38 &>/dev/null || true+ else+ $SUDO yum -y module install python39 &>/dev/null || $SUDO yum -y module install python38 &>/dev/null || true+ fi+ fi++ # Amazon Linux 2 path+ if command -v amazon-linux-extras &>/dev/null; then+ $SUDO amazon-linux-extras install -y python3.8 &>/dev/null || true+ fi++ # EL7 fallback via IUS (best-effort)+ REL_VER=$( (cat /etc/redhat-release 2>/dev/null || cat /etc/centos-release 2>/dev/null) || true )+ if [[ "$REL_VER" == *" 7."* ]]; then+ $SUDO yum install -y https://repo.ius.io/ius-release-el7.rpm &>/dev/null || true+ $SUDO yum install -y python37u python37u-pip python37u-devel &>/dev/null || true+ fi++ # If python3.9/3.8/3.7 binaries exist, prefer the newest by creating a higher-priority symlink+ if ! python3 - <<'PYCHK' &>/dev/null; then+import sys; raise SystemExit(0 if sys.version_info >= (3,7) else 1)+PYCHK+ then+ NEW_PY=""+ for cand in /usr/bin/python3.11 /usr/bin/python3.10 /usr/bin/python3.9 /usr/bin/python3.8 /usr/bin/python3.7; do+ [[ -x "$cand" ]] && NEW_PY="$cand" && break+ done+ if [[ -n "$NEW_PY" ]]; then+ $SUDO ln -sf "$NEW_PY" /usr/local/bin/python3 2>/dev/null || true+ export PATH="/usr/local/bin:$PATH"+ fi+ fi+ fi++ # Ensure pipx uses the selected python3+ export PIPX_DEFAULT_PYTHON="$(command -v python3 || echo python3)"++ # Ensure pipx is present even on older EL (install via pip if the rpm doesn't exist)+ if ! command -v pipx &>/dev/null; then+ python3 -m pip install --user -U pip pipx &>/dev/null || true+ export PATH="$HOME/.local/bin:$PATH"+ ficurl https://sh.rustup.rs -sSf | sh -s -- -y >/dev/null 2>&1source "${HOME}/.cargo/env"cargo install ripgen &>/dev/null+ # Ensure pipx path and install shodan CLI+ pipx ensurepath -f &>/dev/null || true+ pipx install shodan &>/dev/null || pipx upgrade shodan &>/dev/null || true}# Function to install required packages for Arch-based systems@@ -530,22 +679,27 @@ function install_pacman() {curl https://sh.rustup.rs -sSf | sh -s -- -y >/dev/null 2>&1source "${HOME}/.cargo/env"cargo install ripgen &>/dev/null+ # Ensure pipx path and install shodan CLI+ pipx ensurepath -f &>/dev/null || true+ pipx install shodan &>/dev/null || pipx upgrade shodan &>/dev/null || true}# Function to perform initial setupfunction initial_setup() {- banner- reset_git_proxies+ banner+ reset_git_proxies++ printf "%bRunning: Checking for updates%b\n" "$bblue" "$reset"+ check_updates- echo -e "${bblue}Running: Checking for updates${reset}\n"- check_updates+ printf "%bRunning: Installing system packages%b\n" "$bblue" "$reset"+ install_system_packages- echo -e "${bblue}Running: Installing system packages${reset}\n"- install_system_packages+ check_network- install_golang_version+ install_golang_version- echo -e "${bblue}Running: Installing Python requirements${reset}\n"+ printf "%bRunning: Installing Python requirements%b\n" "$bblue" "$reset"mkdir -p ${HOME}/.gfmkdir -p "$tools"mkdir -p ${HOME}/.config/notify/@@ -553,63 +707,78 @@ function initial_setup() {touch "${dir}/.github_tokens"touch "${dir}/.gitlab_tokens"- eval pipx ensurepath $DEBUG_STD- source "${HOME}/${profile_shell}"+ q pipx ensurepath+ # Ensure $HOME/.local/bin is available now even if profile isn't sourced+ export PATH="${HOME}/.local/bin:${PATH}"+ # Source only the matching shell profile to refresh PATH changes+ if [[ -n "${BASH_VERSION-}" ]]; then+ [[ -f "${HOME}/.bashrc" ]] && source "${HOME}/.bashrc"+ elif [[ -n "${ZSH_VERSION-}" ]]; then+ [[ -f "${HOME}/.zshrc" ]] && source "${HOME}/.zshrc"+ fiinstall_tools- # Repositorios con configuraciones especiales- echo -e "${bblue}\nRunning: Configuring special repositories${reset}\n"-- # Nuclei Templates- if [[ ! -d ${NUCLEI_TEMPLATES_PATH} ]]; then- #printf "${yellow}Cloning Nuclei templates...${reset}\n"-- eval git -C "${NUCLEI_TEMPLATES_PATH}" pull $DEBUG_STD- eval git -C "${NUCLEI_TEMPLATES_PATH}/extra_templates" pull $DEBUG_STD- eval git -C "${tools}/fuzzing-templates" pull $DEBUG_STD- eval nuclei -update-templates update-template-dir "${NUCLEI_TEMPLATES_PATH}" $DEBUG_STD- fi-- if [[ ! -d ${NUCLEI_FUZZING_TEMPLATES_PATH} ]]; then- mkdir -p ${NUCLEI_FUZZING_TEMPLATES_PATH} $DEBUG_STD- eval git clone https://github.com/projectdiscovery/fuzzing-templates "${NUCLEI_FUZZING_TEMPLATES_PATH}" $DEBUG_STD- fi+# Repositories with special configurations+ printf "%b\nRunning: Configuring special repositories%b\n" "$bblue" "$reset"++ # Nuclei Templates (opt-out with MANAGE_NUCLEI_TEMPLATES=false)+ MANAGE_NUCLEI_TEMPLATES=${MANAGE_NUCLEI_TEMPLATES:-true}+ if [[ "$MANAGE_NUCLEI_TEMPLATES" == "true" ]]; then+ if [[ ! -d ${NUCLEI_TEMPLATES_PATH} ]]; then+ q mkdir -p "${NUCLEI_TEMPLATES_PATH}"+ retry 3 3 q_to 300 git clone https://github.com/projectdiscovery/nuclei-templates "${NUCLEI_TEMPLATES_PATH}" || true+ else+ retry 3 3 q_to 120 git -C "${NUCLEI_TEMPLATES_PATH}" pull || true+ fi+ if [[ ! -d ${NUCLEI_TEMPLATES_PATH}/extra_templates ]]; then+ retry 3 3 q_to 120 git clone https://github.com/projectdiscovery/fuzzing-templates "${NUCLEI_TEMPLATES_PATH}/extra_templates" || true+ else+ retry 3 3 q_to 60 git -C "${NUCLEI_TEMPLATES_PATH}/extra_templates" pull || true+ fi+ if [[ ! -d ${NUCLEI_FUZZING_TEMPLATES_PATH} ]]; then+ q mkdir -p ${NUCLEI_FUZZING_TEMPLATES_PATH}+ retry 3 3 q_to 120 git clone https://github.com/projectdiscovery/fuzzing-templates "${NUCLEI_FUZZING_TEMPLATES_PATH}" || true+ else+ retry 3 3 q_to 60 git -C "${NUCLEI_FUZZING_TEMPLATES_PATH}" pull || true+ fi+ fi+ nuclei -update-templates update-template-dir "${NUCLEI_TEMPLATES_PATH}" >/dev/null 2>&1 || true# sqlmapif [[ ! -d "${dir}/sqlmap" ]]; then#printf "${yellow}Cloning sqlmap...${reset}\n"- eval git clone --depth 1 https://github.com/sqlmapproject/sqlmap.git "${dir}/sqlmap" $DEBUG_STD+ if ! retry 3 3 q_to 120 git clone --depth 1 https://github.com/sqlmapproject/sqlmap.git "${dir}/sqlmap"; then true; fielse#printf "${yellow}Updating sqlmap...${reset}\n"- eval git -C "${dir}/sqlmap" pull $DEBUG_STD+ if ! retry 3 3 q_to 60 git -C "${dir}/sqlmap" pull; then true; fifi# massdnsif [[ ! -d "${dir}/massdns" ]]; then#printf "${yellow}Cloning and compiling massdns...${reset}\n"- eval git clone https://github.com/blechschmidt/massdns.git "${dir}/massdns" $DEBUG_STD- eval make -C "${dir}/massdns" $DEBUG_STD- eval strip -s "${dir}/massdns/bin/massdns" $DEBUG_ERROR- eval $SUDO cp "${dir}/massdns/bin/massdns" /usr/local/bin/ $DEBUG_ERROR+ if ! retry 3 3 q_to 120 git clone https://github.com/blechschmidt/massdns.git "${dir}/massdns"; then true; fi+ q make -C "${dir}/massdns"+ strip -s "${dir}/massdns/bin/massdns" 2>/dev/null+ $SUDO cp "${dir}/massdns/bin/massdns" /usr/local/bin/ 2>/dev/nullelse#printf "${yellow}Updating massdns...${reset}\n"- eval git -C "${dir}/massdns" pull $DEBUG_STD+ if ! retry 3 3 q_to 60 git -C "${dir}/massdns" pull; then true; fifi# gf patterns- if [[ ! -d "$HOME/.gf" ]]; then+if [[ ! -d "$HOME/.gf" ]]; then#printf "${yellow}Installing gf patterns...${reset}\n"- eval git clone https://github.com/tomnomnom/gf.git "${dir}/gf" $DEBUG_STD- eval cp -r "${dir}/gf/examples" ~/.gf $DEBUG_ERROR- eval git clone https://github.com/1ndianl33t/Gf-Patterns "${dir}/Gf-Patterns" $DEBUG_STD- eval cp "${dir}/Gf-Patterns"/*.json ~/.gf/ $DEBUG_ERROR+ if ! retry 3 3 q_to 120 git clone https://github.com/tomnomnom/gf.git "${dir}/gf"; then true; fi+ cp -r "${dir}/gf/examples" ~/.gf 2>/dev/null || true+ if ! retry 3 3 q_to 120 git clone https://github.com/1ndianl33t/Gf-Patterns "${dir}/Gf-Patterns"; then true; fi+ cp "${dir}/Gf-Patterns"/*.json ~/.gf/ 2>/dev/null || trueelse#printf "${yellow}Updating gf patterns...${reset}\n"- eval git -C "${dir}/Gf-Patterns" pull $DEBUG_STD+ if ! retry 3 3 q_to 60 git -C "${dir}/Gf-Patterns" pull; then true; fifi- echo -e "\n${bblue}Running: Downloading required files${reset}\n"+ printf "\n%bRunning: Downloading required files%b\n" "$bblue" "$reset"mkdir -p ${HOME}/.config/notify# Download required files with error handling@@ -634,28 +803,28 @@ function initial_setup() {destination="${downloads[$key]#* }"# Skip download if provider-config.yaml already exists- if [[ "$key" == "notify_provider_config" && -f "$destination" ]]; then- echo -e "[${yellow}SKIPPING${reset}] $key as it already exists at $destination.${reset}"- continue- fi+ if [[ "$key" == "notify_provider_config" && -f "$destination" ]]; then+ printf "[%bSKIPPING%b] %s as it already exists at %s.\n" "$yellow" "$reset" "$key" "$destination"+ continue+ fi- wget -q -O "$destination" "$url" || {- echo -e "${red}[!] Failed to download $key from $url.${reset}"- continue- }+ retry 3 3 q_to 120 wget -q -O "$destination" "$url" || {+ printf "%b[!] Failed to download %s from %s.%b\n" "$red" "$key" "$url" "$reset"+ continue+ }done# Make axiom_config.sh executablechmod +x "${tools}/axiom_config.sh" || {- echo -e "${red}[!] Failed to make axiom_config.sh executable.${reset}"+ printf "%b[!] Failed to make axiom_config.sh executable.%b\n" "$red" "$reset"}- echo -e "${bblue}Running: Performing last configurations${reset}\n"+ printf "%bRunning: Performing last configurations%b\n" "$bblue" "$reset"# Update resolvers if generate_resolvers is trueif [[ $generate_resolvers == true ]]; thenif [[ ! -s $resolvers || $(find "$resolvers" -mtime +1 -print) ]]; then- echo -e "${yellow}Checking resolvers lists...\nAccurate resolvers are the key to great results.\nThis may take around 10 minutes if it's not updated.${reset}\n"+ printf "%bChecking resolvers lists...\nAccurate resolvers are the key to great results.\nThis may take around 10 minutes if it's not updated.%b\n" "$yellow" "$reset"rm -f "$resolvers" &>/dev/nulldnsvalidator -tL https://public-dns.info/nameservers.txt -threads "$DNSVALIDATOR_THREADS" -o "$resolvers" &>/dev/nulldnsvalidator -tL https://raw.githubusercontent.com/blechschmidt/massdns/master/lists/resolvers.txt -threads "$DNSVALIDATOR_THREADS" -o tmp_resolvers &>/dev/null@@ -667,73 +836,93 @@ function initial_setup() {[[ ! -s $resolvers ]] && wget -q -O "$resolvers" https://raw.githubusercontent.com/trickest/resolvers/main/resolvers.txt[[ ! -s $resolvers_trusted ]] && wget -q -O "$resolvers_trusted" https://gist.githubusercontent.com/six2dez/ae9ed7e5c786461868abd3f2344401b6/raw/trusted_resolvers.txt- echo -e "${yellow}Resolvers updated.${reset}\n"+ printf "%bResolvers updated.%b\n" "$yellow" "$reset"figenerate_resolvers=falseelseif [[ -s $resolvers && $(find "$resolvers" -mtime +1 -print) ]]; then- echo -e "${yellow}Checking resolvers lists...\nAccurate resolvers are the key to great results.\nDownloading new resolvers.${reset}\n"+ printf "%bChecking resolvers lists...\nAccurate resolvers are the key to great results.\nDownloading new resolvers.%b\n" "$yellow" "$reset"wget -q -O "$resolvers" https://raw.githubusercontent.com/trickest/resolvers/main/resolvers.txtwget -q -O "$resolvers_trusted" https://gist.githubusercontent.com/six2dez/ae9ed7e5c786461868abd3f2344401b6/raw/trusted_resolvers.txt- echo -e "${yellow}Resolvers updated.${reset}\n"+ printf "%bResolvers updated.%b\n" "$yellow" "$reset"fifi- # Strip all Go binaries and copy to /usr/local/bin- strip -s "${GOPATH}/bin/"* &>/dev/null || true- $SUDO cp "${GOPATH}/bin/"* /usr/local/bin/ &>/dev/null || true+ # Strip all Go binaries and copy to /usr/local/bin (files only)+ find "${GOPATH}/bin" -type f -perm -u+x -exec strip -s {} \; 2>/dev/null || true+ find "${GOPATH}/bin" -type f -perm -u+x -exec $SUDO cp {} /usr/local/bin/ \; 2>/dev/null || true# Final reminders- echo -e "${yellow}Remember to set your API keys:\n- subfinder (${HOME}/.config/subfinder/provider-config.yaml)\n- GitHub (${HOME}/Tools/.github_tokens)\n- GitLab (${HOME}/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 (${HOME}/.config/notify/provider-config.yaml)\n- WHOISXML API (WHOISXML_API in reconftw.cfg or env var)\n${reset}"- echo -e "${bgreen}Finished!${reset}\n"- echo -e "${bgreen}#######################################################################${reset}"+ printf "%bRemember to set your API keys:\n- subfinder (%s/.config/subfinder/provider-config.yaml)\n- GitHub (%s/Tools/.github_tokens)\n- GitLab (%s/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 (%s/.config/notify/provider-config.yaml)\n- WHOISXML API (WHOISXML_API in reconftw.cfg or env var)\n%b\n" "$yellow" "$HOME" "$HOME" "$HOME" "$HOME" "$reset"+ printf "%bFinished!%b\n" "$bgreen" "$reset"+ printf "%b#######################################################################%b\n" "$bgreen" "$reset"}# Function to display additional helpfunction show_additional_help() {- echo "Usage: $0 [OPTION]"- echo "Run the script with specified options."- echo ""- echo " -h, --help Display this help and exit."- echo " --tools Install the tools before running, useful for upgrading."- echo ""- echo " **** Without any arguments, the script will update reconftw"- echo " and install all dependencies and requirements."- exit 0+ cat <<USAGE+Usage: $0 [OPTIONS]++Options:+ -h, --help Show this help and exit+ --tools Only install/upgrade tools and exit+ --verbose Show detailed installer output (overrides DEBUG_STD/DEBUG_ERROR)+ --log <file> Tee all installer output to <file>+ --force-update Force git reset/pull even with local changes+ --dry-run Print actions without executing changes++Without options, the script checks for updates and installs all dependencies.+USAGE+ exit 0}# Function to handle installation argumentsfunction handle_install_arguments() {- echo -e "\n${bgreen}reconFTW installer/updater script${reset}\n"+ printf "\n%breconFTW installer/updater script%b\n" "$bgreen" "$reset"while [[ $# -gt 0 ]]; docase "$1" in-h | --help)show_additional_help;;- --tools)- install_tools- shift- ;;+ --tools)+ install_tools+ shift+ ;;+ --verbose)+ VERBOSE=true+ DEBUG_STD=""+ DEBUG_ERROR=""+ shift+ ;;+ --log)+ LOGFILE="$2"; shift 2 || true+ ;;+ --force-update)+ FORCE_UPDATE=true; shift+ ;;+ --dry-run)+ DRY_RUN=true; shift+ ;;*)- echo -e "${bred}Error: Invalid argument '$1'${reset}"+ printf "%bError: Invalid argument '%s'%b\n" "$bred" "$1" "$reset"echo "Use -h or --help for usage information."exit 1;;esacdone- echo -e "${yellow}This may take some time. Grab a coffee!${reset}\n"+ printf "%bThis may take some time. Grab a coffee!%b\n" "$yellow" "$reset"# Determine if the script is run as rootif [[ "$(id -u)" -eq 0 ]]; thenSUDO=""elseif ! sudo -n true 2>/dev/null; then- echo -e "${bred}It is strongly recommended to add your user to sudoers.${reset}"- echo -e "${bred}This will avoid prompts for sudo password during installation and scans.${reset}"- echo -e "${bred}Run the following command to add your user to sudoers:${reset}"- echo -e "${bred}echo \"${USER} ALL=(ALL:ALL) NOPASSWD: ALL\" | sudo tee /etc/sudoers.d/reconFTW${reset}\n"+ printf "%bIt is strongly recommended to add your user to sudoers.%b\n" "$bred" "$reset"+ printf "%bThis will avoid prompts for sudo password during installation and scans.%b\n" "$bred" "$reset"+ printf "%bRun the following command to add your user to sudoers:%b\n" "$bred" "$reset"+ printf "%becho \"%s ALL=(ALL:ALL) NOPASSWD: ALL\" | sudo tee /etc/sudoers.d/reconFTW%b\n\n" "$bred" "$USER" "$reset"fiSUDO="sudo"fi