jmsh

package module
v1.2.14-0...-2e189f4 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2021 License: MIT Imports: 16 Imported by: 0

README

jmsh

Connect servers managed by Jumpserver using traditional terminal.

How to use it

jmsh is a JavaScript application run on top of Node, so you can run npm install -g jmsh to install it, then run jmsh.

Why?

Jumpserver comes with web based terminal, it's good, but more happy work with a traditional terminal it make me more productive. so me build this tools to replace it on my workflow.

Documentation

Index

Constants

View Source
const (
	PING           = "PING"
	PONG           = "PONG"
	CONNECT        = "CONNECT"
	CLOSE          = "CLOSE"
	TERMINALINIT   = "TERMINAL_INIT"
	TERMINALDATA   = "TERMINAL_DATA"
	TERMINALRESIZE = "TERMINAL_RESIZE"
)

Variables

View Source
var ErrLoginFailed = errors.New("ErrLoginFailed")

ErrLoginFailed indicate authentication error

Functions

This section is empty.

Types

type Asset

type Asset struct {
	ID       string   `json:"id"`
	Hostname string   `json:"hostname"`
	Nodes    []string `json:"nodes_display"`
}

type Client

type Client struct {
	*http.Client
	// contains filtered or unexported fields
}

Client for interact with Jumpserver

func NewClient

func NewClient(endpoint string) (*Client, error)

NewClient creates client

func (*Client) ConnectAsset

func (c *Client) ConnectAsset(targetID string, systemUserID string) error

ConnectAsset connects to asset, opens a ternamal

func (*Client) FetchLoginPage

func (c *Client) FetchLoginPage() (*LoginPage, error)

FetchLoginPage access and get csrftoken rsa public key

func (*Client) FindAssetByHostname

func (c *Client) FindAssetByHostname(hostname string) (Asset, bool, error)

func (*Client) ListSystemUsers

func (c *Client) ListSystemUsers(assetID string) ([]SystemUser, error)

type LoginPage

type LoginPage struct {
	// contains filtered or unexported fields
}

LoginPage store infomation about login page

func (*LoginPage) FetchCaptcha

func (lp *LoginPage) FetchCaptcha() ([]byte, error)

func (*LoginPage) HasCaptcha

func (lp *LoginPage) HasCaptcha() bool

HasCaptcha indicate this page contain captcha

func (*LoginPage) Submit

func (lp *LoginPage) Submit(username, password, captcha string) (*LoginResult, error)

Submit submits login form to Jumpserver

type LoginResult

type LoginResult struct {
	// contains filtered or unexported fields
}

LoginResult stores result of submit result of login page

func (*LoginResult) HasOTP

func (lr *LoginResult) HasOTP() bool

func (*LoginResult) SubmitOTP

func (lr *LoginResult) SubmitOTP(otp string) (*LoginResult, error)

type Message

type Message struct {
	Id   string `json:"id"`
	Type string `json:"type"`
	Data string `json:"data"`
}

type SystemUser

type SystemUser struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Username string `json:"username"`
}

type WindowSize

type WindowSize struct {
	Cols int `json:"cols"`
	Rows int `json:"rows"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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