开发工具:
文件大小: 15kb
下载次数: 0
上传时间: 2019-12-31
详细说明:# $language = "VBScript"
# $interface = "1.0"
'作者;小怪兽怪瘦
Sub Main
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso,file1,line,str1,params
Set fso = CreateObject("Scripting.FileSystemObject")
Set file1 = fso.OpenTextFile("D:\backup\list.txt",Forreading, False)
crt.window.show 3
crt.Screen.Synchronous = True
do while file1.AtEndOfStream <> True
'读取每一行
line = file1.ReadLine
'分割IP,用户名,密码 特权密码 型号简写(z m h b) 位置
params = Split (line)
ip = params(0)
user = params(1)
password = params(2)
su = params(3)
mode = params(4)
whereis = params(5)
crt.session.LogFileName = "D:\backup\log\"&ip&"_"&whereis&"_20190620.txt" '提供日志,修改后面日期即可
crt.session.Log(true)
crt.Session.Connect ( "/SSH2 /L "&user&" /PASSWORD "&password&" "&ip) '建立SSH连接
if mode = "m" then 'm 代表迈普型号
crt.Screen.Send "enable" & chr(13)
crt.Screen.WaitForString "assword:"
crt.Screen.Send params(3) & chr(13)
crt.Screen.WaitForString "#"
'关闭more提示
crt.Screen.Send "more off" & chr(13)
crt.Screen.WaitForString "#"
'执行命令集
Set cmdfile = fso.OpenTextFile("D:\backup\cmd-mp.txt",Forreading, False)
do while cmdfile.AtEndOfStream <> True
line2 = cmdfile.ReadLine
crt.Screen.Send line2 & Chr(13)
crt.Screen.waitForString "#"
loop
crt.Screen.Send "show running-config" & chr(13)
crt.Screen.WaitForString "#"
'打开more提示
crt.Screen.Send "more on" & chr(13)
crt.Screen.WaitForString "#"
crt.Screen.Send "exit" & chr(13)
crt.Screen.WaitForString ">"
crt.Session.Disconnect
end if
if mode = "c" then 'c 代表思科型号
crt.Screen.WaitForString ">"
crt.Screen.Send "enable" & chr(13)
crt.Screen.WaitForString "assword:"
crt.Screen.Send params(3) & chr(13)
crt.Screen.WaitForString "#"
'关闭more提示
crt.Screen.Send "configure terminal" & chr(13)
crt.Screen.WaitForString "config)
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.