These scripts run on the device under test and probe this
server across the Nmap top ~130 TCP ports. Enter the
Port Leak Checker host (its IP, or portleak.link)
as the target. The PowerShell script accepts multiple targets
— add more lines to the $targets list; the bash and sh
scripts take one target per run.
Because this server never replies, the scripts may print little or nothing even when a port is open end-to-end. The authoritative result is the capture log: run a script, then filter the log by the test device's source IP to see exactly which probes arrived.
$targets = @(
"portleak.link" # <- the Port Leak Checker host (IP or hostname)
# "203.0.113.10" # add more targets here if needed
)
$ports = @(80,23,443,21,22,25,3389,110,445,139,143,53,135,3306,8080,1723,111,995,993,5900,1025,587,8888,199,1720,465,548,113,81,6001,10000,514,5060,179,1026,2000,8443,8000,32768,554,26,1433,49152,2001,515,8008,49154,1027,5666,646,5000,5631,631,49153,8081,2049,88,79,5800,106,2121,1110,49155,6000,513,990,5357,427,49156,543,544,5101,144,7,389,8009,3128,444,9999,5009,7070,5190,3000,5432,3986,13,1029,9,6646,49157,1028,873,1755,2717,4899,9100,119,37,1000,3001,5001,82,10010,1030,9090,2107,1024,2103,6004,1801,19,8031,1041,255,3703,17,808,3689,1031,1071,5901,9102,9000,2105,636,1038,2601,7000,5985)
foreach ($ip in $targets) {
$ports | ForEach-Object {
$test = New-Object System.Net.Sockets.TcpClient
$wait = $test.BeginConnect($ip, $_, $null, $null)
if ($wait.AsyncWaitHandle.WaitOne(250, $false) -and $test.Connected) {
Write-Output "$ip`:$_ open"
}
$test.Close()
}
}
#!/bin/bash
# Usage: ./portscan.sh <ip-or-hostname> [start-port] [end-port]
# e.g. ./portscan.sh portleak.link 1 1024
if [ -z "$1" ]; then
echo "Usage: portscan.sh <ip-or-hostname> [start-port] [end-port]"
echo "start-port defaults to 1, end-port defaults to 1024"
exit 1
fi
TARGET="$1"
START_PORT="${2:-1}"
END_PORT="${3:-1024}"
echo "Scanning $TARGET (ports $START_PORT to $END_PORT)"
echo "PORT STATE SERVICE"
for PORT in $(seq "$START_PORT" "$END_PORT"); do
if (echo > "/dev/tcp/$TARGET/$PORT") 2>/dev/null; then
SERVICE=$(grep -w "${PORT}/tcp" /etc/services | head -n1 | awk '{print $1}')
echo "$PORT/tcp open $SERVICE"
fi
done
#!/bin/sh
# Enter the Port Leak Checker host below (IP or hostname).
TARGET="portleak.link"
for port in 7 9 13 21 22 23 25 26 37 53 79 80 81 88 106 110 111 112 113 \
119 135 139 143 144 179 199 389 427 443 444 445 465 513 514 \
515 543 544 548 554 587 631 646 873 990 993 995 1025 1026 \
1027 1028 1029 1110 1433 1720 1723 1755 1900 2000 2001 2049 \
2121 2717 3000 3128 3306 3389; do
echo "Connecting to port: $port"
curl -I --connect-timeout 5 --max-time 3 "$TARGET:$port"
done