gluassh

package module
v0.0.0-...-7b18aea Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2019 License: MIT Imports: 6 Imported by: 0

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)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Loader

func Loader(L *lua.LState) int

Types

type LuaSshSess

type LuaSshSess struct {
	*ssh.Session
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL