Skip to content

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

fix cloudhunter trufflehog errors

kleozaafd65e70ec4
diff --git a/reconftw.sh b/reconftw.sh
index fd8ae8b..0007c9c 100755
--- a/reconftw.sh
+++ b/reconftw.sh
@@ -1364,17 +1364,17 @@ function zonetransfer() {
function s3buckets() {
- mkdir -p {.tmp,subdomains}
- if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $S3BUCKETS == true ]] && ! [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9] ]]; then
- start_func ${FUNCNAME[0]} "AWS S3 buckets search"
- [[ -n $multi ]] && [ ! -f "$dir/subdomains/subdomains.txt" ] && echo "$domain" >"$dir/subdomains/subdomains.txt"
- # S3Scanner
- if [[ $AXIOM != true ]]; then
- [ -s "subdomains/subdomains.txt" ] && s3scanner scan -f subdomains/subdomains.txt 2>>"$LOGFILE" | anew -q .tmp/s3buckets.txt
- else
- axiom-scan subdomains/subdomains.txt -m s3scanner -o .tmp/s3buckets_tmp.txt $AXIOM_EXTRA_ARGS 2>>"$LOGFILE" >/dev/null
- [ -s ".tmp/s3buckets_tmp.txt" ] && cat .tmp/s3buckets_tmp.txt .tmp/s3buckets_tmp2.txt 2>>"$LOGFILE" | anew -q .tmp/s3buckets.txt && sed -i '/^$/d' .tmp/s3buckets.txt
- fi
+ mkdir -p {.tmp,subdomains}
+ if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $S3BUCKETS == true ]] && ! [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9] ]]; then
+ start_func ${FUNCNAME[0]} "AWS S3 buckets search"
+ [[ -n $multi ]] && [ ! -f "$dir/subdomains/subdomains.txt" ] && echo "$domain" >"$dir/subdomains/subdomains.txt"
+ # S3Scanner
+ if [[ $AXIOM != true ]]; then
+ [ -s "subdomains/subdomains.txt" ] && s3scanner scan -f subdomains/subdomains.txt 2>>"$LOGFILE" | anew -q .tmp/s3buckets.txt
+ else
+ axiom-scan subdomains/subdomains.txt -m s3scanner -o .tmp/s3buckets_tmp.txt $AXIOM_EXTRA_ARGS 2>>"$LOGFILE" >/dev/null
+ [ -s ".tmp/s3buckets_tmp.txt" ] && cat .tmp/s3buckets_tmp.txt .tmp/s3buckets_tmp2.txt 2>>"$LOGFILE" | anew -q .tmp/s3buckets.txt && sed -i '/^$/d' .tmp/s3buckets.txt
+ fi
# Include root domain in the process
echo "$domain" > webs/full_webs.txt
@@ -1383,22 +1383,22 @@ function s3buckets() {
# Initialize the output file in the subdomains folder
> subdomains/cloudhunter_open_buckets.txt # Create or clear the output file
- # Determine the CloudHunter permutations flag based on the config
- PERMUTATION_FLAG=""
- case "$CLOUDHUNTER_PERMUTATION" in
- DEEP)
- PERMUTATION_FLAG="-p $HOME/Tools/CloudHunter/permutations-big.txt"
- ;;
- NORMAL)
- PERMUTATION_FLAG="-p $HOME/Tools/CloudHunter/permutations.txt"
- ;;
- NONE)
- PERMUTATION_FLAG=""
- ;;
- *)
- echo "Invalid value for CloudHunter_Permutations: $CloudHunter_Permutations" >> "$LOGFILE"
- exit 1
- ;;
+ # Determine the CloudHunter permutations flag based on the config
+ PERMUTATION_FLAG=""
+ case "$CLOUDHUNTER_PERMUTATION" in
+ DEEP)
+ PERMUTATION_FLAG="-p $HOME/Tools/CloudHunter/permutations-big.txt"
+ ;;
+ NORMAL)
+ PERMUTATION_FLAG="-p $HOME/Tools/CloudHunter/permutations.txt"
+ ;;
+ NONE)
+ PERMUTATION_FLAG=""
+ ;;
+ *)
+ echo "Invalid value for CloudHunter_Permutations: $CLOUDHUNTER_PERMUTATION" >> "$LOGFILE"
+ exit 1
+ ;;
esac
# Run CloudHunter on each URL in webs/full_webs.txt and append the output to the file in the subdomains folder
@@ -1406,7 +1406,7 @@ function s3buckets() {
python3 ~/Tools/CloudHunter/cloudhunter.py $PERMUTATION_FLAG -r ~/Tools/CloudHunter/resolvers.txt -t 50 "$url" >> subdomains/cloudhunter_open_buckets.txt 2>>"$LOGFILE"
done < webs/full_webs.txt
- # Remove the full_webs.txt file after CloudHunter processing
+ # Remove the full_webs.txt file after CloudHunter processing
rm webs/full_webs.txt
NUMOFLINES1=$(cat subdomains/cloudhunter_open_buckets.txt 2>>"$LOGFILE" | anew subdomains/cloud_assets.txt | wc -l)
@@ -1432,25 +1432,20 @@ function s3buckets() {
elif echo "$line" | grep -q "Google Cloud"; then
# Google Cloud Storage
bucket_name=$(echo "$line" | awk '{print $3}')
- trufflehog gs --bucket="$bucket_name" -j 2>/dev/null | jq -c | anew -q subdomains/cloudhunter_buckets_trufflehog.txt
+ trufflehog gcs --bucket="$bucket_name" -j 2>/dev/null | jq -c | anew -q subdomains/cloudhunter_buckets_trufflehog.txt
fi
done < subdomains/cloudhunter_open_buckets.txt
end_func "Results are saved in subdomains/s3buckets.txt, subdomains/cloud_assets.txt, subdomains/s3buckets_trufflehog.txt, and subdomains/cloudhunter_buckets_trufflehog.txt" ${FUNCNAME[0]}
- else
- if [[ $S3BUCKETS == false ]]; then
- printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
- elif [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9] ]]; then
- return
- else
- if [[ $S3BUCKETS == false ]]; then
- printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
- else
- printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} is already processed, to force executing ${FUNCNAME[0]} delete\n $called_fn_dir/.${FUNCNAME[0]} ${reset}\n\n"
- fi
- fi
- fi
-
+ else
+ if [[ $S3BUCKETS == false ]]; then
+ printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
+ elif [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9] ]]; then
+ return
+ else
+ printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} is already processed, to force executing ${FUNCNAME[0]} delete\n $called_fn_dir/.${FUNCNAME[0]} ${reset}\n\n"
+ fi
+ fi
}
###############################################################################################################