1 Star 0 Fork 5

Dawn/计算机网络综合实训拓扑及文件及代码

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
6.py 789 Bytes
一键复制 编辑 原始数据 按行查看 历史
chensong 提交于 2022-03-28 14:03 . python网络运维部分的代码
#!/usr/bin/python3
import paramiko
import time
from datetime import datetime
ssh_client = paramiko.SSHClient()
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh_client.connect(hostname="192.168.99.100", username="huawei", password="123456")
cmd = ssh_client.invoke_shell()
shijian = datetime.now()
newfile = "ar1_%s_%s_%s_%s_%s_vrpcfg.zip"%(shijian.year,shijian.month,shijian.day,shijian.hour,shijian.minute)
cmd.send("sys\n")
cmd.send("sftp 10.110.111.17\n")
time.sleep(1)
cmd.send("huawei\n")
time.sleep(1)
cmd.send("y\n")
time.sleep(1)
cmd.send("y\n")
time.sleep(1)
cmd.send("123456\n")
time.sleep(1)
cmd.send("get vrpcfg.zip %s\n"%newfile)
time.sleep(2)
output = cmd.recv(10000)
print(output.decode("utf-8"))
ssh_client.close()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Dawn_Newbie/ensp-python.git
git@gitee.com:Dawn_Newbie/ensp-python.git
Dawn_Newbie
ensp-python
计算机网络综合实训拓扑及文件及代码
master

搜索帮助