From f9d31ad734202d216b00f6903592bb78f5115e5d Mon Sep 17 00:00:00 2001
From: six2dez <six2dez@gmail.com>
Date: Fri, 9 Feb 2024 12:12:30 +0100
Subject: [PATCH] fix geoinfo - git update - web mode

---
 install.sh  | 38 ++++++++++++++++++++------------------
 reconftw.sh | 12 ++++++------
 2 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/install.sh b/install.sh
index 8cc5a869..d8817220 100755
--- a/install.sh
+++ b/install.sh
@@ -345,26 +345,28 @@ eval git config --global --unset https.proxy $DEBUG_STD
 
 printf "${bblue} Running: Looking for new reconFTW version${reset}\n\n"
 
-if ! eval git fetch $DEBUG_STD; then
-	echo "Failed to fetch updates."
-	exit 1
-fi
-
-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"
+timeout 10 git fetch
+exit_status=$?
+if [[ ${exit_status} -eq 0 ]]; then
+
+	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
-	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"
+	printf "\n${bred} Unable to check updates ${reset}\n\n"
 fi
 
 printf "${bblue} Running: Installing system packages ${reset}\n\n"
diff --git a/reconftw.sh b/reconftw.sh
index 9c9d26dc..16476485 100755
--- a/reconftw.sh
+++ b/reconftw.sh
@@ -1244,7 +1244,7 @@ function s3buckets() {
 		fi
 		# Cloudenum
 		keyword=${domain%%.*}
-		python3 ~/Tools/cloud_enum/cloud_enum.py -k $keyword -l .tmp/output_cloud.txt 2>>"$LOGFILE" >/dev/null
+		timeout -k 1m 20m python3 ~/Tools/cloud_enum/cloud_enum.py -k $keyword -l .tmp/output_cloud.txt 2>>"$LOGFILE" >/dev/null
 
 		NUMOFLINES1=$(cat .tmp/output_cloud.txt 2>>"$LOGFILE" | sed '/^#/d' | sed '/^$/d' | anew subdomains/cloud_assets.txt | wc -l)
 		if [[ $NUMOFLINES1 -gt 0 ]]; then
@@ -1281,7 +1281,7 @@ function s3buckets() {
 function geo_info() {
 
 	if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $GEO_INFO == true ]]; then
-		start_func ${FUNCNAME[0]} "Running: ipinfo via ipapi.co"
+		start_func ${FUNCNAME[0]} "Running: ipinfo and geoinfo"
 		ips_file="${dir}/hosts/ips.txt"
 		if [ ! -f $ips_file ]; then
 			echo "File ${dir}/hosts/ips.txt does not exist."
@@ -2950,9 +2950,9 @@ function passive() {
 	remove_big_files
 	favicon
 	cdnprovider
-	geo_info
 	PORTSCAN_ACTIVE=false
 	portscan
+	geo_info
 
 	if [[ $AXIOM == true ]]; then
 		axiom_shutdown
@@ -3099,8 +3099,8 @@ function recon() {
 	screenshot
 	#	virtualhosts
 	cdnprovider
-	geo_info
 	portscan
+	geo_info
 	waf_checks
 	nuclei_check
 	fuzz
@@ -3222,8 +3222,8 @@ function multi_recon() {
 		screenshot
 		#		virtualhosts
 		cdnprovider
-		geo_info
 		portscan
+		geo_info
 		currently=$(date +"%H:%M:%S")
 		loopend=$(date +%s)
 		getElapsedTime $loopstart $loopend
@@ -3435,7 +3435,7 @@ if [[ $OSTYPE == "darwin"* ]]; then
 	PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
 fi
 
-PROGARGS=$(getopt -o 'd:m:l:x:i:o:f:q:c:rspanvh::' --long 'domain:,list:,recon,subdomains,passive,all,web,osint,deep,help,vps' -n 'reconFTW' -- "$@")
+PROGARGS=$(getopt -o 'd:m:l:x:i:o:f:q:c:rspanwvh::' --long 'domain:,list:,recon,subdomains,passive,all,web,osint,deep,help,vps' -n 'reconFTW' -- "$@")
 
 # Note the quotes around "$PROGARGS": they are essential!
 eval set -- "$PROGARGS"