diff --git a/linPEAS/builder/linpeas_parts/5_network_information/11_Internet_access.sh b/linPEAS/builder/linpeas_parts/5_network_information/11_Internet_access.sh index 6252938..df9b141 100644 --- a/linPEAS/builder/linpeas_parts/5_network_information/11_Internet_access.sh +++ b/linPEAS/builder/linpeas_parts/5_network_information/11_Internet_access.sh @@ -8,7 +8,7 @@ # Functions Used: check_dns, check_icmp, check_tcp_443, check_tcp_443_bin, check_tcp_80, print_2title, check_external_hostname # Global Variables: # Initial Functions: -# Generated Global Variables: $pid4, $pid2, $pid1, $pid3, $pid5, $NOT_CHECK_EXTERNAL_HOSTNAME, $TIMEOUT_INTERNET_SECONDS +# Generated Global Variables: $pid4, $pid2, $pid1, $pid3, $$tcp443_bin_status, $NOT_CHECK_EXTERNAL_HOSTNAME, $TIMEOUT_INTERNET_SECONDS # Fat linpeas: 0 # Small linpeas: 0 @@ -26,17 +26,23 @@ fi # Run all checks in background check_tcp_80 2>/dev/null & pid1=$! check_tcp_443 2>/dev/null & pid2=$! -check_tcp_443_bin 2>/dev/null & pid3=$! -check_icmp 2>/dev/null & pid4=$! -check_dns 2>/dev/null & pid5=$! +check_icmp 2>/dev/null & pid3=$! +check_dns 2>/dev/null & pid4=$! # Kill all after 10 seconds -(sleep $TIMEOUT_INTERNET_SECONDS && kill -9 $pid1 $pid2 $pid3 $pid4 $pid5 2>/dev/null) & +(sleep $TIMEOUT_INTERNET_SECONDS && kill -9 $pid1 $pid2 $pid3 $pid4 2>/dev/null) & + +check_tcp_443_bin 2>/dev/null +tcp443_bin_status=$? + +wait $pid1 $pid2 $pid3 $pid4 2>/dev/null + # Wait for all to finish -wait $pid1 $pid2 $pid3 $pid4 $pid5 2>/dev/null +wait 2>/dev/null -if ! [ "$SUPERFAST" ] && ! [ "$NOT_CHECK_EXTERNAL_HOSTNAME" ]; then +if [ "$tcp443_bin_status" -eq 0 ] && \ + [ -z "$SUPERFAST" ] && [ -z "$NOT_CHECK_EXTERNAL_HOSTNAME" ]; then echo "" print_2title "Is hostname malicious or leaked?" print_info "This will check the public IP and hostname in known malicious lists and leaks to find any relevant information about the host." diff --git a/linPEAS/builder/linpeas_parts/functions/check_tcp_443.sh b/linPEAS/builder/linpeas_parts/functions/check_tcp_443.sh index a73af89..77b6955 100644 --- a/linPEAS/builder/linpeas_parts/functions/check_tcp_443.sh +++ b/linPEAS/builder/linpeas_parts/functions/check_tcp_443.sh @@ -21,7 +21,7 @@ check_tcp_443(){ fi /bin/bash -c ' - for ip in 1.1.1.1 8.8.8.8; do + for ip in 1.1.1.1; do (echo >/dev/tcp/$ip/443 && echo "Port 443 is accessible" && exit 0) & pids+=($!) done diff --git a/linPEAS/builder/linpeas_parts/functions/check_tcp_443_bin.sh b/linPEAS/builder/linpeas_parts/functions/check_tcp_443_bin.sh index d7b12d1..be5f959 100644 --- a/linPEAS/builder/linpeas_parts/functions/check_tcp_443_bin.sh +++ b/linPEAS/builder/linpeas_parts/functions/check_tcp_443_bin.sh @@ -8,16 +8,38 @@ # Functions Used: # Global Variables: # Initial Functions: -# Generated Global Variables: +# Generated Global Variables: $url_lambda # Fat linpeas: 0 # Small linpeas: 1 +check_tcp_443_bin () { + local url_lambda="https://2e6ppt7izvuv66qmx2r3et2ufi0mxwqs.lambda-url.us-east-1.on.aws/" -check_tcp_443_bin(){ if command -v curl >/dev/null 2>&1; then - curl -s "https://2e6ppt7izvuv66qmx2r3et2ufi0mxwqs.lambda-url.us-east-1.on.aws/" -H "User-Agent: linpeas" -H "Content-Type: application/json" >/dev/null 2>&1 && echo "Port 443 is accessible with curl" || echo "Port 443 is not accessible with curl" + if curl -s --connect-timeout 5 "$url_lambda" \ + -H "User-Agent: linpeas" -H "Content-Type: application/json" >/dev/null 2>&1 + then + echo "Port 443 is accessible with curl" + return 0 # ✅ success + else + echo "Port 443 is not accessible with curl" + return 1 + fi + elif command -v wget >/dev/null 2>&1; then - wget -q -O - "https://2e6ppt7izvuv66qmx2r3et2ufi0mxwqs.lambda-url.us-east-1.on.aws/" --header "User-Agent: linpeas" -H "Content-Type: application/json" >/dev/null 2>&1 && echo "Port 443 is accessible with wget" || echo "Port 443 is not accessible with wget" + if wget -q --timeout=5 -O - "$url_lambda" \ + --header "User-Agent: linpeas" -H "Content-Type: application/json" >/dev/null 2>&1 + then + echo "Port 443 is accessible with wget" + return 0 + else + echo "Port 443 is not accessible with wget" + return 1 + fi + + else + echo "Neither curl nor wget available" + return 1 fi -} \ No newline at end of file +} diff --git a/linPEAS/builder/linpeas_parts/functions/check_tcp_80.sh b/linPEAS/builder/linpeas_parts/functions/check_tcp_80.sh index cc8ea62..c9e71d5 100644 --- a/linPEAS/builder/linpeas_parts/functions/check_tcp_80.sh +++ b/linPEAS/builder/linpeas_parts/functions/check_tcp_80.sh @@ -20,7 +20,7 @@ check_tcp_80(){ fi /bin/bash -c ' - for ip in 1.1.1.1 8.8.8.8; do + for ip in 1.1.1.1; do (echo >/dev/tcp/$ip/80 && echo "Port 80 is accessible" && exit 0) & pids+=($!) done