-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
cyian-1756
committed
Dec 8, 2019
1 parent
0df6d6e
commit b94047f
Showing
1 changed file
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,26 @@ | ||
# gluassh | ||
A simple ssh lib for gopher-lua | ||
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)` |