Guest User

Untitled

a guest
Sep 22nd, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. #####################
  2. |Calle's SSH script |
  3. | (.VB) |
  4. #####################
  5.  
  6. Option Explicit
  7.  
  8. ' Declare variables
  9. Dim objSsh
  10.  
  11. ' Create SSh instance
  12. Set objSsh = CreateObject("ActiveXperts.Ssh")
  13.  
  14. ' Write some information to console
  15. Wscript.Echo "ActiveSocket Version " & objSsh.Version & "; Build " & objSsh.Build & "; Module " & objSsh.Module
  16. WScript.Echo "Expiration date: " & objSsh.ExpirationDate & vbCrLf
  17.  
  18. objSsh.Clear
  19. objSsh.Host = ReadInput( "127.0.0.1", False )
  20. objSsh.UserName = ReadInput( "root", False )
  21. objSsh.Password = ReadInput( "pw", True )
  22. objSsh.PrivateKeyFile = ReadInput( "", True )
  23. 'The next line accepts a changed or unknown host key
  24. objSsh.AcceptHostKey = true
  25.  
  26. objSsh.Command = ReadInput( "Enter command:", "ls", False )
  27. objSsh.ScriptTimeOut = 5000
  28. objSsh.Run
  29. WScript.Echo "Run, result: " & objSsh.LastError & " (" & objSsh.GetErrorDescription( objSsh.LastError ) & ")"
  30.  
  31. If objSsh.LastError = 0 Then
  32. WScript.Echo "StdOut: " & objSsh.StdOut
  33. WScript.Echo "StdErr: " & objSsh.StdErr
  34. End If
  35.  
  36. WScript.Echo "Ready."
  37.  
  38.  
  39. ' ***************************************************************************
  40. ' Function ReadInput
  41. ' ***************************************************************************
  42. Function ReadInput( ByVal strTitle, ByVal strDefault, ByVal bAllowEmpty )
  43.  
  44. Dim strInput, strReturn
  45.  
  46. Do
  47. strInput = inputbox( strTitle, "Enter value", strDefault )
  48. If ( strInput <> "" ) Then
  49. strReturn = strInput
  50. End If
  51. Loop until strReturn <> "" Or bAllowEmpty
  52.  
  53. ReadInput = strReturn
  54. End Function
Add Comment
Please, Sign In to add comment