在企业Cisco网络中查找流氓的包
switchnotif的Python项目详细描述
如果Cisco交换机的MAC地址表更改,则发送电子邮件通知!!!
。图像:https://img.shields.io/codecov/c/github/codecov/example-python.svg
python脚本发送有关mac地址更改的电子邮件。
- switchnotificator.py-脚本在Cisco交换机中进行身份验证,并将staticMacs文件中的MAC地址列表与
outdir/MAC.result
文件进行比较。如果没有找到mac地址,出于安全原因,电子邮件将发送给定义的网络管理员。 - createstaticmacs.py-脚本检查staticmacs文件。如果文件存在并且空或不存在,它将创建它。
- ip list-此文件必须包含Cisco交换机的IP地址列表。
- 要配置gmail设置,只需编辑frommail,frommailpass,tomail文件中的变量。
===== 用法
要求:
必须安装带有paramiko
的python2.7或python3.4:
将switchnotificator.py
文件中指定的电子邮件地址和密码替换为您的。
语法:
。代码块::bash
# git clone https://github.com/jamalshahverdiev/python-general-codes.git
# cd python-general-codes/switch-notificator
# ./switchnotificator.py switchusername 'switch_long_password' vlanID
。
如果您想每分钟自动使用
switchnotificator.py
脚本,只需将以下行添加到crontab文件中即可:- /root/switch notificator/switchnotificator.py switchusername“switch_long_password”vlanid