shell 端口掃描

#!/bin/bash
ipfile=$1
port=$2
tempfile=temp
cat << -EOF- > scan.sh
/usr/bin/telnet \$1 \$2 << ! >temp
quit
!

-EOF-
while  read ip
do
        sh scan.sh $ip $port > /dev/null 2>&1
        if  grep -c Escape temp > /dev/null 2>&1
        then
            echo "$ip $port is open"
        else
            echo "$ip $port is closed"
        fi

done<$ipfile
rm -f ./scan.sh
rm -f ./temp
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章