optssh

package
v0.0.0-...-8d0f603 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectWithKey

func ConnectWithKey(user, keyPath string, host string, port int) (*ssh.Client, error)

func ConnectWithPassword

func ConnectWithPassword(user, pass string, host string, port int) (*ssh.Client, error)

func GrabBanner

func GrabBanner(host string, port int) (string, error)

func ParseBanner

func ParseBanner(s string) (r string)

func Run

func Run(c *ssh.Client, cmd string, stdout, stderr io.Writer) error

func Shell

func Shell(c *ssh.Client) error

Types

type Options

type Options struct {
	Targets struct {
		TARGETS []string `description:"Provide target IP/FQDN/FILE"`
	} `positional-args:"yes"`

	Connection struct {
		Username string `short:"u" description:"Provide username (or FILE)"`
		Password string `short:"p" description:"Provide password (or FILE)"`
		PrivKey  string `short:"k" long:"private-key" description:"Provide a path to a ssh private key without password"`
		Port     int    `long:"port" default:"22" description:"Port to contact"`
	} `group:"Connection Options" description:"Connection Options"`

	Mode struct {
		Exec  string `long:"exec" description:"Execute command on target host"`
		Shell bool   `long:"shell" description:"Spawn a shell"`
	} `group:"Execution Mode"`
	// contains filtered or unexported fields
}

func (*Options) Run

func (o *Options) Run()

Jump to

Keyboard shortcuts

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