Documentation
¶
Index ¶
- Variables
- func CreateForm(command string) ([]textinput.Model, []string)
- func DimmedStyle(text string) string
- func ErrorText(text string) string
- func GetSelectedItem(menu list.Model) (menuItem, bool)
- func HighlightStyle(text string) string
- func InfoText(text string) string
- func InitializeMenus() (list.Model, list.Model, list.Model)
- func IsDirectCommand(command string) bool
- func IsNavigationCommand(command string) bool
- func NavigateForm(inputs []textinput.Model, currentFocus int, direction int) int
- func RequiresInput(command string) bool
- func StartTUI(banner string) error
- func SuccessText(text string) string
- func UpdateFormInputs(inputs []textinput.Model, focusIndex int, msg tea.Msg) ([]textinput.Model, tea.Cmd)
- func UpdateMenuSize(mainMenu, configMenu, exploitMenu *list.Model, width, height int)
- func ValidateForm(command string, inputs []textinput.Model) error
- func WarningText(text string) string
- type CommandHandler
- func (h *CommandHandler) HandleCommand(command string, formData *FormData) tea.Cmd
- func (*CommandHandler) HandleNavigation(command string, model *Model) (*Model, tea.Cmd)
- func (h *CommandHandler) ProcessFormSubmission(model *Model) (*Model, tea.Cmd)
- func (h *CommandHandler) SetupFormForCommand(model *Model, command string)
- type CommandOutput
- type CommandRunner
- func (r *CommandRunner) CloseExploitOutput()
- func (*CommandRunner) ExecuteCommand(command string, args ...string) (string, error)
- func (*CommandRunner) ExecuteConfigCommand(subcommand string) (string, error)
- func (*CommandRunner) ExecuteConfigUpdate(host, port, username string, useHTTPS bool) (string, error)
- func (*CommandRunner) ExecuteExploitCommand(subcommand string) (string, error)
- func (*CommandRunner) ExecuteExploitCreate(name string) (string, error)
- func (*CommandRunner) ExecuteExploitRemove(name string) (string, error)
- func (r *CommandRunner) ExecuteExploitRun(exploitPath, servicePort string, tickTime, threadCount string) (string, error)
- func (*CommandRunner) ExecuteExploitStop(pid string) (string, error)
- func (r *CommandRunner) ExecuteExploitTest(exploitPath, servicePort string, tickTime, threadCount string) (string, error)
- func (*CommandRunner) ExecuteLogin(password, host, username string, port uint16, https bool) (string, error)
- func (r *CommandRunner) GetCurrentExploitPID() int
- func (r *CommandRunner) GetExploitOutputCmd() tea.Cmd
- func (*CommandRunner) GetRunningExploits() ([]ExploitProcess, error)
- type ExploitOutput
- type ExploitProcess
- type FormData
- type Model
- func (m *Model) AppendCommandOutput(output string)
- func (m *Model) ClearError()
- func (m *Model) GetActiveView() string
- func (m Model) GetExploitStreamCmd() tea.Cmd
- func (m *Model) GetSelectedExploitFromTable() *ExploitProcess
- func (m *Model) GetSelectedProcess() *ExploitProcess
- func (m *Model) GetSelectedTableRow() table.Row
- func (m Model) Init() tea.Cmd
- func (m *Model) IsInputMode() bool
- func (m *Model) IsLoading() bool
- func (m *Model) IsProcessListVisible() bool
- func (m *Model) IsRunningCommand() bool
- func (m *Model) SelectNextProcess()
- func (m *Model) SelectPreviousProcess()
- func (m *Model) SetActiveView(view string)
- func (m *Model) SetCommandOutput(output string)
- func (m *Model) SetError(err error)
- func (m *Model) SetExploitProcesses(processes []ExploitProcess)
- func (m *Model) SetInputMode(state bool)
- func (m *Model) SetLoading(state bool)
- func (m *Model) SetProcessListVisible(visible bool)
- func (m *Model) SetRunningCommand(state bool)
- func (m Model) SetupExploitTableCmd() tea.Cmd
- func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m Model) View() string
- type TableUpdateMsg
- type ViewRenderer
Constants ¶
This section is empty.
Variables ¶
var ( // General styles AppStyle = lipgloss.NewStyle(). Margin(1, 2) // Header styles HeaderStyle = lipgloss.NewStyle(). Background(primaryColor). Foreground(textColor). Bold(true). Padding(0, 1). MarginBottom(1) // Banner style BannerStyle = lipgloss.NewStyle(). Foreground(primaryColor). Bold(true) // Title styles TitleStyle = lipgloss.NewStyle(). Foreground(primaryColor). Bold(true). MarginBottom(1) SubtitleStyle = lipgloss.NewStyle(). Foreground(secondaryColor). Bold(true) // Box styles BoxStyle = lipgloss.NewStyle(). BorderStyle(lipgloss.RoundedBorder()). BorderForeground(primaryColor). Padding(1) // Input styles InputLabelStyle = lipgloss.NewStyle(). Foreground(secondaryColor). Bold(true) // Message styles ErrorStyle = lipgloss.NewStyle(). Foreground(errorColor). BorderStyle(lipgloss.RoundedBorder()). BorderForeground(errorColor). Padding(1) SuccessStyle = lipgloss.NewStyle(). Foreground(successColor). BorderStyle(lipgloss.RoundedBorder()). BorderForeground(successColor). Padding(1) WarningStyle = lipgloss.NewStyle(). Foreground(warningColor). BorderStyle(lipgloss.RoundedBorder()). BorderForeground(warningColor). Padding(1) InfoStyle = lipgloss.NewStyle(). Foreground(infoColor). BorderStyle(lipgloss.RoundedBorder()). BorderForeground(infoColor). Padding(1) // Help style HelpStyle = lipgloss.NewStyle(). Foreground(mutedColor) // Menu styles MenuTitleStyle = lipgloss.NewStyle(). Background(primaryColor). Foreground(textColor). Padding(0, 1) // Spinner styles SpinnerStyle = lipgloss.NewStyle(). Foreground(primaryColor). Bold(true) // Command output style CommandOutputStyle = lipgloss.NewStyle(). BorderStyle(lipgloss.RoundedBorder()). BorderForeground(primaryColor). Padding(1) // Loading indicator style LoadingStyle = lipgloss.NewStyle(). Foreground(secondaryColor). Bold(true) // Process list styles ProcessListStyle = lipgloss.NewStyle(). BorderStyle(lipgloss.RoundedBorder()). BorderForeground(primaryColor). Padding(1) ProcessHeaderStyle = lipgloss.NewStyle(). Foreground(secondaryColor). Bold(true) ProcessSelectedStyle = lipgloss.NewStyle(). Foreground(primaryColor). Bold(true) FooterStyle = lipgloss.NewStyle(). Foreground(mutedColor) ListStyle = list.DefaultItemStyles{ NormalTitle: lipgloss.NewStyle().Foreground(lipgloss.Color("#F7CD82")), NormalDesc: lipgloss.NewStyle().Foreground(lipgloss.Color("#5B584F")), SelectedTitle: lipgloss.NewStyle().Foreground(lipgloss.Color("#F2F1EF")).Bold(true), SelectedDesc: lipgloss.NewStyle().Foreground(lipgloss.Color("#E0D5AD")), } // Table styles TableHeaderStyle = lipgloss.NewStyle(). Foreground(primaryColor). Bold(true) TableBorderStyle = lipgloss.NewStyle(). Foreground(mutedColor) TableRowStyle = lipgloss.NewStyle(). Foreground(textColor) TableSelectedRowStyle = lipgloss.NewStyle(). Foreground(primaryColor). Bold(true) )
var ExploitTableData []ExploitProcess
var Keys = keyMap{ Up: key.NewBinding( key.WithKeys("up", "k"), key.WithHelp("↑/k", "move up"), ), Down: key.NewBinding( key.WithKeys("down", "j"), key.WithHelp("↓/j", "move down"), ), Enter: key.NewBinding( key.WithKeys("enter"), key.WithHelp("enter", "select"), ), Quit: key.NewBinding( key.WithKeys("q", "ctrl+c"), key.WithHelp("q", "quit"), ), Back: key.NewBinding( key.WithKeys("esc"), key.WithHelp("esc", "back"), ), Tab: key.NewBinding( key.WithKeys("tab"), key.WithHelp("tab", "next input"), ), Submit: key.NewBinding( key.WithKeys("enter"), key.WithHelp("enter", "submit"), ), NextInput: key.NewBinding( key.WithKeys("tab"), key.WithHelp("tab", "next input"), ), PrevInput: key.NewBinding( key.WithKeys("shift+tab"), key.WithHelp("shift+tab", "previous input"), ), }
Keys defines the keybindings
Functions ¶
func CreateForm ¶
CreateForm creates input fields for a specific command
func DimmedStyle ¶
DimmedStyle returns a dimmed version of the given text
func GetSelectedItem ¶
GetSelectedItem returns the selected item from the given menu
func HighlightStyle ¶
HighlightStyle returns a highlighted version of the given text
func InitializeMenus ¶
InitializeMenus initializes all the menus for the TUI
func IsDirectCommand ¶
IsDirectCommand checks if the command can be executed directly without input
func IsNavigationCommand ¶
IsNavigationCommand checks if the command is a navigation command
func NavigateForm ¶
NavigateForm handles navigation within forms
func RequiresInput ¶
RequiresInput checks if the command requires user input
func SuccessText ¶
SuccessText returns a success-styled version of the given text
func UpdateFormInputs ¶
func UpdateFormInputs(inputs []textinput.Model, focusIndex int, msg tea.Msg) ([]textinput.Model, tea.Cmd)
UpdateFormInputs updates form inputs with a tea.Msg
func UpdateMenuSize ¶
UpdateMenuSize updates the size of all menus
func ValidateForm ¶
ValidateForm validates form inputs for a specific command
func WarningText ¶
WarningText returns a warning-styled version of the given text
Types ¶
type CommandHandler ¶
type CommandHandler struct {
// contains filtered or unexported fields
}
CommandHandler manages command execution and handling
func NewCommandHandler ¶
func NewCommandHandler() *CommandHandler
NewCommandHandler creates a new command handler
func (*CommandHandler) HandleCommand ¶
func (h *CommandHandler) HandleCommand(command string, formData *FormData) tea.Cmd
HandleCommand processes a command and returns appropriate tea.Cmd
func (*CommandHandler) HandleNavigation ¶
HandleNavigation processes navigation commands
func (*CommandHandler) ProcessFormSubmission ¶
func (h *CommandHandler) ProcessFormSubmission(model *Model) (*Model, tea.Cmd)
ProcessFormSubmission handles form submission
func (*CommandHandler) SetupFormForCommand ¶
func (h *CommandHandler) SetupFormForCommand(model *Model, command string)
SetupFormForCommand prepares form inputs for a specific command
type CommandOutput ¶
CommandOutput represents the result of a command execution
type CommandRunner ¶
type CommandRunner struct {
// contains filtered or unexported fields
}
CommandRunner handles the execution of commands for the TUI
func NewCommandRunner ¶
func NewCommandRunner() *CommandRunner
NewCommandRunner creates a new command runner
func (*CommandRunner) CloseExploitOutput ¶
func (r *CommandRunner) CloseExploitOutput()
CloseExploitOutput closes the exploit output channel
func (*CommandRunner) ExecuteCommand ¶
func (*CommandRunner) ExecuteCommand(command string, args ...string) (string, error)
ExecuteCommand executes a generic shell command and returns its output
func (*CommandRunner) ExecuteConfigCommand ¶
func (*CommandRunner) ExecuteConfigCommand(subcommand string) (string, error)
ExecuteConfigCommand executes configuration-related commands
func (*CommandRunner) ExecuteConfigUpdate ¶
func (*CommandRunner) ExecuteConfigUpdate(host, port, username string, useHTTPS bool) (string, error)
ExecuteConfigUpdate handles the config update command
func (*CommandRunner) ExecuteExploitCommand ¶
func (*CommandRunner) ExecuteExploitCommand(subcommand string) (string, error)
ExecuteExploitCommand executes exploit-related commands
func (*CommandRunner) ExecuteExploitCreate ¶
func (*CommandRunner) ExecuteExploitCreate(name string) (string, error)
ExecuteExploitCreate handles creating an exploit template
func (*CommandRunner) ExecuteExploitRemove ¶
func (*CommandRunner) ExecuteExploitRemove(name string) (string, error)
ExecuteExploitRemove handles removing an exploit template
func (*CommandRunner) ExecuteExploitRun ¶
func (r *CommandRunner) ExecuteExploitRun( exploitPath, servicePort string, tickTime, threadCount string, ) (string, error)
func (*CommandRunner) ExecuteExploitStop ¶
func (*CommandRunner) ExecuteExploitStop(pid string) (string, error)
ExecuteExploitStop handles stopping a running exploit
func (*CommandRunner) ExecuteExploitTest ¶
func (r *CommandRunner) ExecuteExploitTest( exploitPath, servicePort string, tickTime, threadCount string, ) (string, error)
func (*CommandRunner) ExecuteLogin ¶
func (*CommandRunner) ExecuteLogin(password, host, username string, port uint16, https bool) (string, error)
ExecuteLogin handles the login command
func (*CommandRunner) GetCurrentExploitPID ¶
func (r *CommandRunner) GetCurrentExploitPID() int
GetCurrentExploitPID returns the PID of the currently running exploit
func (*CommandRunner) GetExploitOutputCmd ¶
func (r *CommandRunner) GetExploitOutputCmd() tea.Cmd
GetExploitOutputCmd returns a tea.Cmd that streams exploit output
func (*CommandRunner) GetRunningExploits ¶
func (*CommandRunner) GetRunningExploits() ([]ExploitProcess, error)
GetRunningExploits returns a list of running exploit processes
type ExploitOutput ¶
ExploitOutput represents output from a running exploit
type ExploitProcess ¶
ExploitProcess represents a running exploit process
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the main TUI model
func (*Model) AppendCommandOutput ¶
AppendCommandOutput appends to the existing command output
func (*Model) GetActiveView ¶
GetActiveView returns the current active view
func (Model) GetExploitStreamCmd ¶
GetExploitStreamCmd returns a command that periodically checks for exploit output
func (*Model) GetSelectedExploitFromTable ¶
func (m *Model) GetSelectedExploitFromTable() *ExploitProcess
GetSelectedExploitFromTable returns the exploit process from the selected table row
func (*Model) GetSelectedProcess ¶
func (m *Model) GetSelectedProcess() *ExploitProcess
GetSelectedProcess returns the currently selected exploit process
func (*Model) GetSelectedTableRow ¶
GetSelectedTableRow returns the currently selected table row
func (*Model) IsInputMode ¶
IsInputMode returns true if the model is in input mode
func (*Model) IsProcessListVisible ¶
IsProcessListVisible returns whether the process list is visible
func (*Model) IsRunningCommand ¶
IsRunningCommand returns true if a command is currently running
func (*Model) SelectNextProcess ¶
func (m *Model) SelectNextProcess()
SelectNextProcess selects the next process in the list
func (*Model) SelectPreviousProcess ¶
func (m *Model) SelectPreviousProcess()
SelectPreviousProcess selects the previous process in the list
func (*Model) SetActiveView ¶
SetActiveView sets the active view
func (*Model) SetCommandOutput ¶
SetCommandOutput sets the command output
func (*Model) SetExploitProcesses ¶
func (m *Model) SetExploitProcesses(processes []ExploitProcess)
SetExploitProcesses sets the list of running exploit processes
func (*Model) SetInputMode ¶
SetInputMode sets the input mode state
func (*Model) SetProcessListVisible ¶
SetProcessListVisible shows or hides the process selection list
func (*Model) SetRunningCommand ¶
SetRunningCommand sets the running command state
func (Model) SetupExploitTableCmd ¶
SetupExploitTableCmd returns a command to update the exploit table with data
type TableUpdateMsg ¶
TableUpdateMsg is a message to update the table data
type ViewRenderer ¶
type ViewRenderer struct {
// contains filtered or unexported fields
}
ViewRenderer handles all rendering operations for the TUI
func NewViewRenderer ¶
func NewViewRenderer() *ViewRenderer
NewViewRenderer creates a new view renderer
func (*ViewRenderer) RenderView ¶
func (r *ViewRenderer) RenderView(m *Model) string
RenderView renders the main view based on the model state
func (*ViewRenderer) SetSize ¶
func (r *ViewRenderer) SetSize(width, height int)
SetSize updates the renderer's dimensions