Python脚本自动化备份飞塔,华为,思科等设备配置文件。

本脚本支持:fortinet,watchguard,cisco,F5,huawei,H3C,Juniper,SOPHOS,DELL等厂商。

使用python自动化备份fortinet配置脚本

hello每一个点进我博客的小伙伴,本人是一枚小小的网络安全工程师(初级),由于我司代理的产品主要是fortinet,cisco,uniper,huawei,h3c,sophos,watchguard等产品,又加上“甲方爸爸”奇葩的要求,在参考github上的项目,netmiko这个好用的函数,自动化脚本备份配置(需开启SSH),通过SSH去send command and full-configuration 保存以文本的形式,实现脚本备份配置,还可以扩展的使用函数,比如脚本的配置设备。

第一步:安装python环境

由于:本人使用的是macbook,所以此处的参考性可能不大。

  1. 在自己的电脑/服务器linux主机上安装python;
    MAC系统预装了python2.7版本,对我们是不适用的,所以在官网下载python3.9版本安装,官网地址 python.org
    由于伟大的长城firewall打开网页是可能需要梯子。

    下载对应的版本。
  2. 更新pip源
    (1)阿里云 http://mirrors.aliyun.com/pypi/simple/
    (2)豆瓣http://pypi.douban.com/simple/
    (3)清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
    (4)中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
    (5)华中科技大学http://pypi.hustunique.com/
  3. pip install netmiko
    已经提前安装过了,此处仅参考命令。
// pip安装netmiko
WiliseXdeMacBook-Pro:~ apple$ pip3.9 install netmiko
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Requirement already satisfied: netmiko in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (3.3.3)
Requirement already satisfied: scp>=0.13.2 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from netmiko) (0.13.3)
Requirement already satisfied: setuptools>=38.4.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from netmiko) (49.2.1)
Requirement already satisfied: ntc-templates in /Library/Frameworks/Python.framework/Versions<

你可能感兴趣的:(python,juniper,cisco,huawei)