sysconfig/portscan.sh
2023-03-08 09:22:22 +08:00

15 lines
189 B
Bash

if [ "$1" ]
then
PORT=$1
else
echo "=== 需要查看的端口号:"
read -p ">>> " PORT
fi
if [ "$(uname)" = "Darwin" ]
then
lsof -i tcp:$PORT
else
netstat -tunlp | grep $PORT
fi