autoimprover: simplify linpeas checks

This commit is contained in:
HackTricks PEASS Autoimprover
2026-02-24 15:05:15 +00:00
parent 1375f61d38
commit 02f0e0fd67
4 changed files with 1375 additions and 26 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -5,10 +5,10 @@
# Description: Check if TCP Internet conns are available (via port 443) # Description: Check if TCP Internet conns are available (via port 443)
# License: GNU GPL # License: GNU GPL
# Version: 1.0 # Version: 1.0
# Functions Used: # Functions Used: check_tcp_port_access
# Global Variables: # Global Variables:
# Initial Functions: # Initial Functions:
# Generated Global Variables: $local_pid, $TIMEOUT_INTERNET_SECONDS_443 # Generated Global Variables: $TIMEOUT_INTERNET_SECONDS_443
# Fat linpeas: 0 # Fat linpeas: 0
# Small linpeas: 1 # Small linpeas: 1
@@ -16,13 +16,5 @@
check_tcp_443(){ check_tcp_443(){
local TIMEOUT_INTERNET_SECONDS_443=$1 local TIMEOUT_INTERNET_SECONDS_443=$1
if ! [ -f "/bin/bash" ]; then check_tcp_port_access 443 "$TIMEOUT_INTERNET_SECONDS_443"
echo " /bin/bash not found"
return
fi
# example.com
(bash -c '(echo >/dev/tcp/104.18.74.230/443 2>/dev/null && echo "Port 443 is accessible" && exit 0) 2>/dev/null || echo "Port 443 is not accessible"') & local_pid=$!
sleep $TIMEOUT_INTERNET_SECONDS_443 && kill -9 $local_pid 2>/dev/null && echo "Port 443 is not accessible"
} }

View File

@@ -5,10 +5,10 @@
# Description: Check if TCP Internet conns are available (via port 80) # Description: Check if TCP Internet conns are available (via port 80)
# License: GNU GPL # License: GNU GPL
# Version: 1.0 # Version: 1.0
# Functions Used: # Functions Used: check_tcp_port_access
# Global Variables: # Global Variables:
# Initial Functions: # Initial Functions:
# Generated Global Variables: $local_pid, $TIMEOUT_INTERNET_SECONDS_80 # Generated Global Variables: $TIMEOUT_INTERNET_SECONDS_80
# Fat linpeas: 0 # Fat linpeas: 0
# Small linpeas: 1 # Small linpeas: 1
@@ -16,13 +16,5 @@
check_tcp_80(){ check_tcp_80(){
local TIMEOUT_INTERNET_SECONDS_80=$1 local TIMEOUT_INTERNET_SECONDS_80=$1
if ! [ -f "/bin/bash" ]; then check_tcp_port_access 80 "$TIMEOUT_INTERNET_SECONDS_80"
echo " /bin/bash not found" }
return
fi
# example.com
(bash -c '(echo >/dev/tcp/104.18.74.230/80 2>/dev/null && echo "Port 80 is accessible" && exit 0) 2>/dev/null || echo "Port 80 is not accessible"') & local_pid=$!
sleep $TIMEOUT_INTERNET_SECONDS_80 && kill -9 $local_pid 2>/dev/null && echo "Port 80 is not accessible"
}

View File

@@ -0,0 +1,28 @@
# Title: LinPeasBase - check_tcp_port_access
# ID: check_tcp_port_access
# Author: Carlos Polop
# Last Update: 24-02-2026
# Description: Check if a TCP port is accessible
# License: GNU GPL
# Version: 1.0
# Functions Used:
# Global Variables:
# Initial Functions:
# Generated Global Variables: $local_pid, $PORT_TO_CHECK, $TIMEOUT_INTERNET_SECONDS_PORT
# Fat linpeas: 0
# Small linpeas: 1
check_tcp_port_access(){
local PORT_TO_CHECK=$1
local TIMEOUT_INTERNET_SECONDS_PORT=$2
if ! [ -f "/bin/bash" ]; then
echo " /bin/bash not found"
return
fi
# example.com
(bash -c "(echo >/dev/tcp/104.18.74.230/$PORT_TO_CHECK 2>/dev/null && echo \"Port $PORT_TO_CHECK is accessible\" && exit 0) 2>/dev/null || echo \"Port $PORT_TO_CHECK is not accessible\"") & local_pid=$!
sleep $TIMEOUT_INTERNET_SECONDS_PORT && kill -9 $local_pid 2>/dev/null && echo "Port $PORT_TO_CHECK is not accessible"
}