CVE漏洞中文网

0DayBank一个专门收集整理全球互联网漏洞的公开发布网站
  1. 首页
  2. 漏洞列表
  3. 正文

网络监控程序-2020/8/17

2020年8月17日 415点热度 0人点赞 0条评论

原理是监控端口的形式,持续进行telnet判断,若端口无法连接说明网络出现异常,则进行打印到本地文件

# -*- coding: utf-8 -*
import telnetlib,time,os

Path = os.getcwd()
file_name = 'ping_log.txt'
ping_log_path = os.path.join(Path,file_name)

if not os.path.exists(ping_log_path):
os.mknod(file_name)

while True:
try:
tn=telnetlib.Telnet('192.168.2.128',80)
except Exception as e:
with open(ping_log_path,'a',encoding='utf-8') as f:
f.write(time.strftime("%b %d %Y %H:%M:%S", time.localtime()) + '网络异常\n')
else:
continue

time.sleep(1)0daybank

标签: 暂无
最后更新:2020年8月17日

小助手

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

您需要 登录 之后才可以评论

COPYRIGHT © 2024 www.pdr.cn CVE漏洞中文网. ALL RIGHTS RESERVED.

鲁ICP备2022031030号

联系邮箱:wpbgssyubnmsxxxkkk@proton.me