hancock

package module
v0.0.0-...-9b4c8e1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: GPL-3.0 Imports: 14 Imported by: 1

README

hancock

Manage multiple remote servers and execute commands remotely

❤️ A project by txthinking.com

Install via nami
nami install hancock
Usage
Note:

    When adding an instance, the user must be allowed to execute sudo without a password!!!
    nami and joker are automatically installed when you run command for the first time on instance.

Add instance

    $ hancock add --name mylinux --server 1.2.3.4:22 --user root --password mypassword
    $ hancock add --name mylinux --server 1.2.3.4:22 --user root --key ./path/to/mykey.pem
    $ hancock add -n mylinux -s 1.2.3.4:22 -u root -p mypassword
    $ hancock add -n mylinux -s 1.2.3.4:22 -u root -k ./path/to/mykey.pem

List instances

    $ hancock list

Remove instance

    $ hancock mylinux remove


Run nami on an instance

    $ hancock mylinux nami install brook
    $ hancock mylinux nami list

Run joker on an instance

    $ hancock mylinux joker brook server --listen :9999 --password hello
    $ hancock mylinux joker last
    $ hancock mylinux joker list
    $ hancock mylinux joker stop 1234
    $ hancock mylinux joker log 1234

Run command and wait output on an instance

    $ hancock mylinux echo hello
    $ hancock mylinux sleep 3 '&&' echo hello

Start command and do not wait output on an instance

    $ hancock mylinux start echo hello
    $ hancock mylinux start sleep 3 '&&' echo hello

Upload your own command

    $ hancock mylinux upload ./path/to/command

License

Licensed under The GPLv3 License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	net.Conn
	Timeout int
}

func (*Conn) Read

func (c *Conn) Read(b []byte) (int, error)

func (*Conn) Write

func (c *Conn) Write(b []byte) (int, error)

type Hancock

type Hancock struct {
	DB *bbolt.DB
}

func NewHancock

func NewHancock(readonly bool) (*Hancock, error)

func (*Hancock) Add

func (h *Hancock) Add(name, server, user, password, key string) error

func (*Hancock) Close

func (h *Hancock) Close() error

func (*Hancock) PrintAll

func (h *Hancock) PrintAll()

func (*Hancock) Remove

func (h *Hancock) Remove(name string) error

func (*Hancock) Run

func (h *Hancock) Run(args []string) error

func (*Hancock) Start

func (h *Hancock) Start(args []string) error

func (*Hancock) Upload

func (h *Hancock) Upload(name, file string) error

type Instance

type Instance struct {
	Client *ssh.Client
}

func NewInstance

func NewInstance(server, user, password string, privateKey []byte, timeout int) (*Instance, error)

func (*Instance) HasJoker

func (i *Instance) HasJoker() (bool, error)

func (*Instance) HasNami

func (i *Instance) HasNami() (bool, error)

func (*Instance) InstallJoker

func (i *Instance) InstallJoker() error

func (*Instance) InstallNami

func (i *Instance) InstallNami() error

func (*Instance) Run

func (i *Instance) Run(cmd string) error

func (*Instance) Start

func (i *Instance) Start(cmd string) error

func (*Instance) Upload

func (i *Instance) Upload(file string) error

type SSH

type SSH struct {
	Name     string
	Server   string
	User     string
	Password string
	Key      []byte
}

Directories

Path Synopsis
cli

Jump to

Keyboard shortcuts

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