targetview

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(m *Model, maxWidth int) string

Types

type InterfaceInfo

type InterfaceInfo struct {
	Name string
	IP   string
}

InterfaceInfo holds a network interface name and its IPv4 address.

func BuildInterfaceInfos

func BuildInterfaceInfos(ifaces []net.Interface, addrsByIface map[string][]net.Addr) []InterfaceInfo

BuildInterfaceInfos converts scanner/main interface data into target IP choices.

type Model

type Model struct {
	ShowHelp          bool
	FocusedField      int // 0=IP, 1=CIDR, 2=PortMode
	IPTextInput       textinput.Model
	CIDRTextInput     textinput.Model
	IPInput           string
	CIDRInput         string // e.g. "32", "24", "16"
	PortPack          string
	PortModeIndex     int                    // index into portModeOptions
	CustomPorts       string                 // seed/persistence; synced from PortInput on submit
	PortInput         common.CustomPortInput // replaces huh custom_ports field
	InCustomPortInput bool                   // true when showing port textinput stage
	ErrorMsg          string
	NetworkScan       shared.Scanner
	InterfaceIPs      []string        // Available interface IPs (deprecated, use InterfaceInfos)
	InterfaceInfos    []InterfaceInfo // Available interfaces with names and IPs
	IPIndex           int             // Current index in InterfaceInfos
	HoveredHelpItem   int             // -1 means no hover, otherwise index of helpline item
	HelpLineY         int             // Y row where the helpline starts, set during render
	FieldY            [fieldCount]int // Y row where each field starts, set during render
}

func BuildFromMain

func BuildFromMain(current Model, mainModel mainview.Model) Model

func NewModel

func NewModel(networkScan shared.Scanner, ipInput, cidrInput, portPack, customPorts string, interfaceInfos []InterfaceInfo) Model

NewModel creates a new target view model with inputs bound to the model's fields Deprecated: Use struct literal initialization and call Init() instead

func (*Model) CycleInterfaceIP

func (m *Model) CycleInterfaceIP(forward bool)

CycleInterfaceIP cycles to the next or previous interface IP forward=true moves to next, forward=false moves to previous

func (*Model) HandleMouse

func (m *Model) HandleMouse(msg tea.Msg, maxWidth int) (Result, tea.Cmd)

func (*Model) Init

func (m *Model) Init() tea.Cmd

Init returns the initialization command for the form

func (*Model) Update

func (m *Model) Update(msg tea.Msg) (Result, tea.Cmd)

Update handles tea.Msg and delegates to the custom inputs or port selection

type Result

type Result struct {
	Cmd        tea.Cmd
	Quit       bool
	StartScan  bool   // Signal to start scan with saved config
	TargetAddr string // Target address in CIDR notation
	TotalHosts int    // Number of hosts to scan
	Ports      []int  // Resolved port list to scan
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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