xj监控端口,模拟登陆脚本

Posted wangmo

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了xj监控端口,模拟登陆脚本相关的知识,希望对你有一定的参考价值。

#!/bin/bash

date=`date +%Y%m%d-%H%M`
count=0
ip1=124.117.246.195 
ip2=124.117.246.194
port1=(443 80 6051 22101 11194)
port2=(443 80)

for (( k=0; k<5; k++ )) ; do
    sleep 1
    for i in ${port1[@]} ; do
        nc -w 40 $ip2 -z ${i} >> /dev/null
        if [ $? != 0 ];then
            count=$(($count+1))
        fi
        if [ "$count" == "3" ]; then
            echo "$date $ip2 ${i} 异常 !!!" | mail -s "新疆正式环境异常" [email protected]
            count=0
            break
        fi
    done
done

sleep 1
count=0

for (( k=0; k<5; k++ )) ; do
    sleep 1
    for i in ${port2[@]} ; do
        nc -w 40 $ip1 -z ${i} >> /dev/null
        if [ $? != 0 ];then
            count=$(($count+1))
        fi
        if [ "$count" == "3" ]; then
            echo "$date $ip1 ${i} 异常 !!!" | mail -s "新疆正式环境异常" [email protected]
            echo send mail
            count=0
            break
        fi
    done    
done

sleep 1
count=0

for (( k=0; k<5; k++ )) ; do
    sleep 2
    ps aux | grep multimech-run | grep -v grep | awk {print $2} | xargs kill -9
    cd /usr/local/src/python-scripts/pmtool
    multimech-run my_send_login > /usr/local/src/scripts/xinjiang.txt
    sed -i 20,$d /usr/local/src/scripts/xinjiang.txt
    diff /usr/local/src/scripts/xinjiang.txt /usr/local/src/scripts/xinjiang_ok.txt > /dev/null
    if [ $? != 0 ];then
        count=$(($count+1))
    fi
    if [ "$count" == "3" ]; then
            multimech-run my_send_login > /usr/local/src/scripts/xinjiang.txt
            cat /usr/local/src/scripts/xinjiang.txt | mail -s "新疆正式环境异常" [email protected]
            count=0
            break
    fi
done

以上是关于xj监控端口,模拟登陆脚本的主要内容,如果未能解决你的问题,请参考以下文章

python监控端口脚本

服务稳定性及应用防护方案

案例: 模拟登陆,获取Druid SQL监控数据

案例: 模拟登陆,获取Druid SQL监控数据

javascript模拟重力感应弹跳,做个不一样的登陆端口

用Python简单制作远程视频监控木马,简单的编程思路我就不吹了!