国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

rule_add.py

2019-11-08 01:48:26
字體:
來源:轉載
供稿:網友

#!/bin/env python

#-*- coding:UTF-8 -*-import osos.system("netstat -tn 2>/dev/null | grep :1521 |grep 'ESTABLISHED'| awk '{PRint $5}' | cut -d: -f 1 | sort | uniq -c | sort -nr >/root/scripts/connect_Oracle.txt")f = open("/root/scripts/connect_oracle.txt", "r") f1= open("/root/scripts/log.txt","a") while True:      line = f.readline()      if line:          pass    # do something here         line=line.strip()        lnum=line.split(' ')        if int(lnum[0])>30:                #print lnum[1]                ip=lnum[1].split('.')                #print int(ip[2])                if int(ip[2]) <> 102:                        #print lnum[1]                        print "iptables -I INPUT -s "+lnum[1]+" -p tcp --dport 1521 -j DROP"                        os.system("/sbin/iptables -I INPUT -s "+lnum[1]+" -p tcp --dport 1521 -j DROP")                        f1.write("/sbin/iptables -D INPUT -s "+lnum[1]+" -p tcp --dport 1521 -j DROP/n")                else:                        pass        else:                pass    else:          breakf1.close()

f.close()

刪除規則 rule_clear.py

#!/bin/env python#-*- coding:UTF-8 -*-import osf = open("log.txt", "r")while True:        line=f.readline()        if line:                line=line.strip()                print line                os.system(line)        else:                breakf.close()


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 山东省| 平潭县| 保靖县| 涿州市| 乳山市| 云安县| 吉安县| 沛县| 长兴县| 阿勒泰市| 张家口市| 南充市| 贡觉县| 游戏| 和静县| 彭泽县| 安泽县| 襄汾县| 姚安县| 丰镇市| 虞城县| 辰溪县| 河源市| 玛纳斯县| 陆川县| 隆子县| 通州区| 北京市| 灵丘县| 亳州市| 铜梁县| 闵行区| 锡林浩特市| 黔江区| 沐川县| 永和县| 富川| 海宁市| 丰城市| 望奎县| 来安县|