加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

SecureCRT crt.Session SSH-AAA

(2015-05-23 10:40:06)
标签:

cisco

securecrt

crt.session

分类: IT博客

# $language = "VBScript"
# $interface = "1.0"

Sub Main
     Const ForReading = 1, ForWriting = 2, ForAppending = 8
     Dim fso,file1,line,str1,str2,params,host,passwd,user
     Set fso = CreateObject("Scripting.FileSystemObject")
     Set file1 = fso.OpenTextFile("c:\SWbackup\ssh-3A.txt",Forreading, False)       
     crt.Screen.Synchronous = True
     DO While file1.AtEndOfStream <> True
        line = file1.ReadLine
        params = Split (line)
        host = params(0)
        user = params(1)
        passwd = params(2)
        cmd = "/SSH2 /L " & user & " /PASSWORD " & passwd & " /C 3DES /M MD5 " & host
        crt.Session.Connect cmd
       crt.session.LogFileName = "c:\SWbackup\log\20150522\" & params(0) & ".txt"
       crt.session.Log(true)
        crt.Screen.Send "enable" & vbcr
        crt.Screen.Send params(3) & vbcr
        crt.Screen.waitForString "#"
         str1 = "sh cdp nei"
        crt.Screen.Send str1 & vbcr
  crt.Screen.Send "                                                " & vbcr
         str2 = "sh run"
 crt.Screen.Send str2 & vbcr
       ' crt.Screen.WaitForString " --More-- "
  crt.Screen.Send "                                                " & vbcr
  crt.Screen.Send "                                                " & vbcr
        crt.Screen.waitForString "end"
        crt.Screen.waitForString "#"
        crt.Screen.Send "exit" & vbcr
        crt.Session.Disconnect        
  loop
     crt.Screen.Synchronous = False      

End Sub

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有