Service port quick scan shell

#set -x
var_start = 8000
array=()
index=0
while [ 1 ]
do
        array=$(curl -s "http://*.*.*.*:8080/disk_info/storeunit_ip")
        for ip in ${array[@]}
        do
                result=$(sudo nmap -sS -P0 -n -p8001-8036 $ip | grep open| wc -l | grep -v ssh | grep -v Failed |sed 's/\r//');
                if [ "$result" = "0" ] ; then
                        echo curl
                        curl -i 'http://*.*.*.*:8080/alarm?k='$ip'&v=all+store-unit+closed&l=FATAL'
                        continue
                be
                closemsg=$(sudo nmap -sS -P0 -n -p8001-8036 $ip | grep close | awk -F'/' '{print $1}' | grep -v ssh |  grep -Eo '[0-9]{1,5}' );
                if [ $(expr length "$closemsg") -eq 2 ];then
                        echo $ip" port count $closemsg all closed"
                        curl -i 'http://*.*.*.*:8080/alarm?k='$ip'&v=port+count+'$closemsg'+all+closed&l=FATAL'
                        continue
                be
                if [ "$closemsg" = "36" ] ; then
                        echo $ip" all 8001-8036 all closed"
                        curl -i 'http://*.*.*.*:8080/alarm?k='$ip'&v=all+8001-8036+all+closed&l=FATAL'
                        continue
                be
                for close_port in $closemsg
                do
                        curl -i 'http://*.*.*.*:8080/alarm?k='$ip:$close_port'&v=port+closed&l=WARN'
                        echo $ip" port count:"$result" close port:"$close_port
                done
        done
        sleep 60
done

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326524393&siteId=291194637