Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1295987
  • 博文数量: 464
  • 博客积分: 9399
  • 博客等级: 中将
  • 技术积分: 6364
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-19 09:15
文章分类

全部博文(464)

文章存档

2014年(12)

2013年(123)

2012年(173)

2011年(156)

我的朋友

分类: 系统运维

2012-01-16 15:53:24

关于access表设计可参考代码设计则可。。

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

function echomore()
Do while (crt.Screen.WaitForString("--- More ---",1)<>False)
   crt.Screen.Send chr(10)
Loop
End function


Cnstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=wgw_db.mdb;Persist Security Info=False"
tabname="wgw_config"   '设备登录信息表
Set cn=CreateObject("ADODB.Connection")
Set rs=CreateObject("ADODB.Recordset")


'Dim fso, MyFile
'Set fso = CreateObject("Scripting.FileSystemObject")
'Set MyFile = fso.CreateTextFile("testfile.txt", True)
cn.Open Cnstr
rs.Open "select * from "+tabname,cn,1,3


'登录中转服务器
crt.Session.Connect ("/telnet 132.118.109.95")
crt.Screen.WaitForString "login:"
crt.screen.Send "gyhong" & Chr(10)
'crt.Screen.WaitForString "PASSCODE:"
'crt.screen.Send Chr(10)
crt.Screen.WaitForString "assword:"
crt.screen.Send "gyhong" & Chr(10)

While Not rs.eof
num=rs("num") '设备号,方便查看备份情况
check=rs("check") '设备是否需要备份

Dim result
if check="y" then
settype=rs("settype") '判断采用执行那个备份步骤进程备份操作
ipaddr=rs("ipaddr")   '设备IP地址
login=rs("login") '登录用户名
passwd=rs("passwd")    '密码一
su_passwd=rs("su_passwd")      '密码二
prompt=rs("hostname")&rs("prompt") '互动识别符
hostname=rs("hostname")
filename=rs("ipaddr")&".log"
'开始执行操作

'交换机 —操作行式一
if settype="route_quidway" then
   crt.screen.Send chr(10)
   crt.Session.LogFileName = filename
   crt.Session.Log True
        crt.Screen.WaitForString ">"
        '登录switch systme
        crt.screen.Send "telnet "&ipaddr & Chr(10)
   result = crt.screen.WaitForStrings("Username:", "Password:",10)
   If result = 1 Then
   'crt.Screen.WaitForString "name:"
    crt.screen.Send login & Chr(10)
    crt.Screen.WaitForString "assword:"
    crt.screen.Send passwd & Chr(10)
   End If
   If result = 2 Then
   'crt.Screen.WaitForString "name:"
    crt.screen.Send passwd & Chr(10)
   End If
   If result = 0 Then
     MsgBox "Timed out!"
   End If
    crt.screen.WaitForString prompt
    crt.screen.Send "super" & Chr(10)
    crt.Screen.WaitForString "assword:"
    crt.screen.Send su_passwd & Chr(10)
   
    crt.screen.WaitForString prompt
    crt.screen.Send "disp version" & Chr(10)
    echomore()
    crt.screen.Send chr(10)
    crt.screen.WaitForString prompt
    crt.screen.Send "quit" & Chr(10)
    crt.sleep 100
    crt.Session.Log False
end if

end if
    
rs.movenext
Wend
'退出OSS系统
crt.Screen.WaitForString ">"
crt.screen.Send "exit"&Chr(10)



CCIE Security 2009 IOS防火墙合集


阅读(1467) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~