📅  最后修改于: 2022-03-11 14:50:06.800000             🧑  作者: Mango
#!/bin/bash
IP=$1
first_port=$2
last_port=$3
function scanner
{
for ((port=$first_port; port<=$last_port; port++))
do
(echo >/dev/tcp/$IP/$port)> /dev/null 2>&1 && echo $port open || echo "$port closed"
done
}
scanner