cli

package
v0.0.0-...-dacf4ae Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// TermWidth
	TermWidth int

	// TermHeight
	TermHeight int

	// home tmux window
	HomeWindow string

	// Console titled "Command"
	CommandPane *TmuxPane

	// Displays agent output, separated from logs
	OutputPane *TmuxPane

	// Displays agent list
	AgentListPane *TmuxPane

	// Displays bash shell for selected agent
	AgentShellPane *TmuxPane

	// SFTP shell for selected agent
	AgentSFTPPane *TmuxPane

	// Put all windows in this map
	TmuxPanes = make(map[string]*TmuxPane)

	// CAT use this cat to replace /bin/cat
	CAT = "emp3r0r-cat"
)

Functions

func AdaptiveTable

func AdaptiveTable(tableString string)

AdaptiveTable is now a no-op since we don't need to resize for simple text

func BuildTable

func BuildTable(header []string, rows [][]string) string

BuildTable creates a simple formatted list instead of a complex table

func CliPrettyPrint

func CliPrettyPrint(header1, header2 string, map2write *map[string]string)

CliPrettyPrint prints two-column help info using simple formatting

func FitPanes

func FitPanes(output_pane_x int)

FitPanes adjust width of panes to fit them in the terminal window triggered by agent output

func Prompt

func Prompt(prompt string) string

Prompt user for input

func ResetPaneLayout

func ResetPaneLayout() error

ResetPaneLayout resets all panes to their default layout proportions

func TermSize

func TermSize() (width, height int, err error)

TermSize Get terminal size

func TmuxCurrentPane

func TmuxCurrentPane() (pane_id string)

returns the index of current pane returns -1 when error occurs

func TmuxCurrentWindow

func TmuxCurrentWindow() (id string)

All panes live in this tmux window, returns the unique ID of the window returns "" when error occurs

func TmuxDeinitWindows

func TmuxDeinitWindows()

TmuxDeinitWindows close previously opened tmux windows

func TmuxDisplay

func TmuxDisplay(msg string) (res string)

func TmuxInitWindows

func TmuxInitWindows() (err error)

TmuxInitWindows split current terminal into several windows/panes - command output window - current agent info

func TmuxKillWindow

func TmuxKillWindow(id string) (err error)

func TmuxNewWindow

func TmuxNewWindow(name, cmd string) error

TmuxNewWindow run command in a new window

func TmuxSetOpt

func TmuxSetOpt(index, opt string) (err error)

Set tmux option of current tmux window

func TmuxSetPaneTitle

func TmuxSetPaneTitle(title, pane_id string) error

func TmuxSplit

func TmuxSplit(hV, cmd string) error

TmuxSplit split tmux window, and run command in the new pane

func TmuxSwitchWindow

func TmuxSwitchWindow(window_id string) (res bool)

func TmuxUpdatePane

func TmuxUpdatePane(pane *TmuxPane)

Sync changes of a pane

func TmuxUpdatePanes

func TmuxUpdatePanes()

func TmuxWindowSize

func TmuxWindowSize() (x, y int)

TmuxWindowSize size in chars, of the current tmux window/tab

func YesNo

func YesNo(prompt string) bool

Ask a yes/no question

Types

type TmuxPane

type TmuxPane struct {
	Alive    bool   // indicates that pane is not dead
	ID       string // tmux pane unique ID
	WindowID string // tmux window unique ID, indicates the window that the pane lives in
	Title    string // title of pane
	Name     string // intial title of pane, doesn't change even if pane is dead
	TTY      string // eg. /dev/pts/1, write to this file to get your message displayed on this pane
	PID      int    // PID of the process running in tmux pane
	Cmd      string // cmdline of the process
	Width    int    // width of pane, number of chars
	Height   int    // height of pane, number of chars
}

TmuxPane a tmux window/pane that makes emp3r0r CC's interface

func TmuxNewPane

func TmuxNewPane(title, hV string, target_pane_id string, size int, cmd string) (pane *TmuxPane, err error)

TmuxNewPane split tmux window, and run command in the new pane hV: horizontal or vertical split target_pane: target_pane tmux index, split this pane size: percentage, do not append %

func (*TmuxPane) ClearPane

func (pane *TmuxPane) ClearPane() (err error)

func (*TmuxPane) KillPane

func (pane *TmuxPane) KillPane() (err error)

func (*TmuxPane) PaneDetails

func (pane *TmuxPane) PaneDetails() (
	is_alive bool,
	title string,
	tty string,
	pid int,
	cmd string,
	width int,
	height int,
)

PaneDetails Get details of a tmux pane

func (*TmuxPane) Printf

func (pane *TmuxPane) Printf(clear bool, format string, a ...interface{})

Printf like printf, but prints to a tmux pane/window id: pane unique id

func (*TmuxPane) ResizePane

func (pane *TmuxPane) ResizePane(direction string, lines int) (err error)

ResizePane resize pane in x/y to number of lines

func (*TmuxPane) Respawn

func (pane *TmuxPane) Respawn() (err error)

Jump to

Keyboard shortcuts

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