Guest User

Nim (ssh2(libssh2))

a guest
Sep 20th, 2024
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. import asyncdispatch, ssh2, strutils
  2.  
  3. proc main() {.async.} =
  4. var client = newSSHClient()
  5. defer: client.disconnect()
  6. await client.connect("server", "user", Port(22), password="pass")
  7. let x = await client.execCommand("date +\"%T.%N\"")
  8. echo x
  9.  
  10. let y = await client.execCommand("date +\"%T.%N\"")
  11. echo y
  12.  
  13. waitFor main()
Advertisement
Add Comment
Please, Sign In to add comment