SecureCRT脚本

SecureCRT脚本

js版本

XX.js内容如下:

# $language = "JScript"
# $interface = "1.0"

crt.screen.send("\n")
crt.screen.send("su - opr\n")
crt.screen.WaitForString("Password:",10)
crt.screen.send("#log\n")
crt.screen.send("stg\n")
crt.screen.send("slogssh -s test  XX.XX.XX.XX\n")
crt.screen.send("cd /XX/XX.log\n")
crt.screen.send("tail -f XX.log\n")

 

VBScript版本

XX.vbs内容如下:

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

Sub main
  ' turn on synchronous mode so we don't miss any data
  crt.Screen.Synchronous = True

  ' Wait for a string that looks like "login: " or "Login: "
  crt.Screen.WaitForString "login: "

  ' Send your username followed by a carriage return
  crt.Screen.Send "su - opr" & VbCr

  ' Wait for a tring that looks like "password: " or "Password: "
  crt.Screen.WaitForString "assword:"

  ' Send your password followed by a carriage return
  crt.Screen.Send "#log" & VbCr

  ' Send your password followed by a carriage return
  crt.Screen.Send "stg" & VbCr
 
  crt.Screen.Send "slogssh -s test  XX.XX.XX.XX & VbCr
 
  crt.Screen.Send "cd /XX/XX.log" & VbCr
  ' turn off synchronous mode to restore normal input processing
  crt.Screen.Synchronous = False
End Sub

 

 

你可能感兴趣的:(IT最新技术简介)