https://github.com/cyian-1756/gluassh
A simple ssh lib for gopher-lua
https://github.com/cyian-1756/gluassh
gopher-lua lua ssh
Last synced: about 2 months ago
JSON representation
A simple ssh lib for gopher-lua
- Host: GitHub
- URL: https://github.com/cyian-1756/gluassh
- Owner: cyian-1756
- License: mit
- Created: 2019-12-08T09:08:48.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-11T02:02:15.000Z (over 6 years ago)
- Last Synced: 2025-01-23T04:33:17.993Z (over 1 year ago)
- Topics: gopher-lua, lua, ssh
- Language: Go
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gluassh
A simple ssh lib for gopher-lua based on golang.org/x/crypto/ssh
## Usage
Import the lib `import "github.com/cyian-1756/gluassh"`
Load it with `L.PreloadModule("ssh", gluassh.Loader)`
Require the lib in lua
`ssh = require("ssh")`
Get a shell
`local shell, err = ssh.login(USERNAME, PASSWORD, HOST, PORT, InsecureIgnoreHostKey)`
If InsecureIgnoreHostKey is true then the host key is ignored
Send a command
`local r, err = ssh.sendCommand(shell, "whoami")`
If you just want to connect and run a one liner you can use the helper func connectAndCommand
`ssh.connectAndCommand(USERNAME, PASSWORD, HOST, PORT, InsecureIgnoreHostKey, COMMAND)`