ui

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: MIT Imports: 106 Imported by: 0

Documentation

Overview

Package ui contains user-interface functions and helpers for termshark.

Package ui contains user-interface functions and helpers for termshark.

Package ui contains user-interface functions and helpers for termshark.

Package ui contains user-interface functions and helpers for termshark.

Package ui contains user-interface functions and helpers for termshark.

Package ui contains user-interface functions and helpers for termshark.

Package ui contains user-interface functions and helpers for termshark.

Package ui contains user-interface functions and helpers for termshark.

Package ui contains user-interface functions and helpers for termshark.

Package ui contains user-interface functions and helpers for termshark.

Package ui contains user-interface functions and helpers for termshark.

Package ui contains user-interface functions and helpers for termshark.

Package ui contains user-interface functions and helpers for termshark.

Package ui contains user-interface functions and helpers for termshark.

Package ui contains user-interface functions and helpers for termshark.

Package ui contains user-interface functions and helpers for termshark.

Package ui contains user-interface functions and helpers for termshark.

Package ui contains user-interface functions and helpers for termshark.

Package ui contains user-interface functions and helpers for termshark.

Package ui contains user-interface functions and helpers for termshark.

Package ui contains user-interface functions and helpers for termshark.

Package ui contains user-interface functions and helpers for termshark.

Package ui contains user-interface functions and helpers for termshark.

Index

Constants

This section is empty.

Variables

View Source
var (
	YesNo      *dialog.Widget
	MiniBuffer *minibuffer.Widget
	PleaseWait *dialog.Widget
)
View Source
var (
	RegularPalette  gowid.Palette
	DarkModePalette gowid.Palette
)
View Source
var AutoScroll bool // true if the packet list should auto-scroll when listening on an interface.
View Source
var CacheRequests []pcap.LoadPcapSlice
View Source
var CacheRequestsChan chan struct{} // false means started, true means finished
View Source
var CapinfoData string
View Source
var CapinfoLoader *capinfo.Loader
View Source
var CapinfoTime time.Time
View Source
var ColumnsFormatError = fmt.Errorf("The supplied list of columns and names is invalid")
View Source
var CopyModePredicate ifwidget.Predicate
View Source
var CopyModeWidget gowid.IWidget
View Source
var CurrentColsWidget *psmlColumnsModel

These are global variables used to hold the current model for the edit-columns widget, and the current line selected. This is hacky but it's so that I can tell, when a menu button is clicked within this PSML columns widget, which column it should apply to. I could generate unique menus for each row of the table, as an alternative...

View Source
var CurrentWormholeWidget *wormhole.Widget
View Source
var DarkMode bool // global state in app
View Source
var DoOnce sync.Once
View Source
var EmptyHexViewTimer *time.Timer
View Source
var EmptyStructViewTimer *time.Timer
View Source
var FieldCompleter *fields.TSharkFields // share this - safe once constructed
View Source
var FilterWidget *filter.Widget
View Source
var Goroutinewg *sync.WaitGroup
View Source
var Loadingw gowid.IWidget // "loading..."
View Source
var MissingMsgw gowid.IWidget // centered, holding singlePacketViewMsgHolder
View Source
var NoGlobalJump termshark.GlobalJumpPos // leave as default, like a placeholder
View Source
var PacketColors bool // global state in app
View Source
var PacketColorsSupported bool // global state in app - true if it's even possible
View Source
var QuitRequested bool // true if a quit has been issued, but not yet processed. Stops some handlers displaying errors.
View Source
var QuitRequestedChan chan struct{}
View Source
var Running bool // true if gowid/tcell is controlling the terminal
View Source
var SearchWidget *search.Widget
View Source
var StartUIChan chan struct{}
View Source
var StartUIOnce sync.Once
View Source
var StreamLoader *streams.Loader // DOC - one because it holds stream index state for pcap
View Source
var TemplateData map[string]interface{}
View Source
var Templates = template.Must(template.New("Help").Funcs(funcMap).Parse(`
{{define "NameVer"}}termshark {{.Version}}{{end}}
{{define "TsharkVer"}}using tshark {{.TsharkVersion}} (from {{.TsharkAbsolutePath}}){{end}}

{{define "OneLine"}}A wireshark-inspired terminal user interface for tshark. Analyze network traffic interactively from your terminal.{{end}}

{{define "Header"}}{{template "NameVer" .}}

{{template "OneLine"}}
See https://termshark.io for more information.{{end}}

{{define "Footer"}}
If --pass-thru is true (or auto, and stdout is not a tty), tshark will be
executed with the supplied command-line flags. You can provide
tshark-specific flags and they will be passed through to tshark (-n, -d, -T,
etc). For example:

$ termshark -r file.pcap -T psml -n | less{{end}}

{{define "UIUserGuide"}}{{.UserGuideURL}}

{{.CopyCommandMessage}}{{end}}

{{define "UIFAQ"}}{{.FAQURL}}

{{.CopyCommandMessage}}{{end}}

{{define "UIBug"}}{{.BugURL}}

{{.CopyCommandMessage}}{{end}}

{{define "UIFeature"}}{{.FeatureURL}}

{{.CopyCommandMessage}}{{end}}

{{define "UIHelp"}}{{template "NameVer" .}}

A wireshark-inspired tui for tshark. Analyze network traffic interactively from your terminal.

/__ - Go to display filter/stream search
q__ - Quit
tab - Switch panes
c__ - Switch to copy-mode
|__ - Cycle through pane layouts
\__ - Toggle pane zoom
esc - Activate menu
+/- - Adjust horizontal split
</> - Adjust vertical split
:__ - Activate cmdline mode (see help cmdline)
z__ - Maximize/restore any modal dialog
?__ - Display help

In the filter, type a wireshark display filter expression.

Most terminals will support using the mouse! Try clicking the Close button.

Use shift-left-mouse to copy and shift-right-mouse to paste.{{end}}

{{define "VimHelp"}}{{template "NameVer" .}}

Navigate the UI using vim-style keys.

hjkl___ - Move left/down/up/right in various views
gg_____ - Go to the top of the current table
G______ - Go to the bottom of the current table
5gg____ - Go to the 5th row of the table
C-w C-w - Switch panes (same as tab)
C-w_=__ - Equalize pane spacing
ma_____ - Mark current packet (use a through z)
'a_____ - Jump to packet marked 'a'
mA_____ - Mark current packet + pcap (use A through Z)
'A_____ - Jump to packet + pcap marked 'A'
''_____ - After a jump; jump back to prior packet
ZZ_____ - Quit without confirmation

See also help cmdline.{{end}}

{{define "CmdLineHelp"}}{{template "NameVer" .}}

Activate cmdline mode with the : key.

Hit tab to see and choose possible completions.

capinfo______ - Capture file properties
clear-filter_ - Clear the display filter and apply
clear-packets - Clear the current pcap
columns______ - Choose the columns to display
config_______ - Show termshark's config file (Unix-only)
convs________ - Open conversations view
filter_______ - Choose a display filter from recently-used
help_________ - Various help dialogs
load_________ - Load a pcap from the filesystem
logs_________ - Show termshark's log file (Unix-only)
map__________ - Map a keypress to a key sequence (see help map)
marks________ - Show file-local and global packet marks
menu_________ - Open the UI Misc menu
no-theme_____ - Clear theme for the current terminal color mode
profile______ - Profile actions - create, use, delete, etc
quit_________ - Quit termshark
recents______ - Load a pcap from those recently-used
set__________ - Set various config properties (see help set)
streams______ - Open stream reassembly view
theme________ - Choose a theme for the current terminal color mode
unmap________ - Remove a keypress mapping
wormhole_____ - Prepare to transfer the current pcap{{end}}

{{define "SetHelp"}}{{template "NameVer" .}}

Use the cmdline set command to change configuration.

Type :set and hit tab for options.

auto-scroll___________ - scroll during live captures
copy-timeout__________ - wait this long before failing a copy
dark-mode_____________ - enable or disable dark-mode
disable-shark-fin_____ - switch off the secret shark fin
packet-colors_________ - use colors in the packet list view
pager_________________ - pager (used for termshark's log file)
nopager_______________ - disable the pager (use PAGER instead)
suppress-tshark-errors - don't show tshark errors in the UI
term__________________ - make termshark assume this terminal type
noterm________________ - disable the terminal type (use TERM){{end}}

{{define "MapHelp"}}{{template "NameVer" .}}

Use the cmdline map command to set key macros e.g.

map <f1> ZZ       - hit f1 key to quit

Use vim-style syntax for key-presses. Printable characters
represent themselves. Compound keys can be:

<space>
<esc>
<enter>
<f1>-<f12>
<C-s>, <A-/>
<up>, <down>, <left>, <right>
<pgup>, <pgdn>
<home>, <end>

Use the unmap command to remove a mapping.{{end}}

{{define "CopyModeHelp"}}{{template "NameVer" .}}

termshark is in copy-mode. You can press:

'q', 'c' - Exit copy-mode
ctrl-c__ - Copy from selected widget
left____ - Widen selection
right___ - Narrow selection
'?'_____ - Display copy-mode help
{{end}}

{{define "Marks"}}{{if not .Marks}}No local marks are set{{else}}Mark Packet Summary{{range $key, $value := .Marks }}
{{printf " %c" $key}}{{printf "%6d" $value.Pos}}    {{printf "%s" $value.Summary}}{{end}}{{end}}

{{if not .GlobalMarks}}No cross-file marks are set{{else}}Mark Packet  File              Summary{{range $key, $value := .GlobalMarks }}
{{printf " %-4c" $key}} {{printf "%-7d" $value.Pos}}{{printf "%-18s" $value.Base}}{{printf "%s" $value.Summary}}{{end}}{{end}}{{end}}

{{define "Key Mappings"}}{{if .Maps.None}}No key mappings are set{{else}}  From          To   {{range $mapping := .Maps.Get }}
{{printf "  %-14v" $mapping.From}}{{printf "%v" $mapping.To}}   {{end}}{{end}}

{{end}}
`))
View Source
var WriteToDeleted bool // true if the user deleted the temporary pcap before quitting
View Source
var WriteToSelected bool // true if the user provided the -w flag

Functions

func ApplyAutoScroll added in v2.2.0

func ApplyAutoScroll(ev *tcell.EventKey, app gowid.IApp) bool

don't claim the keypress

func ApplyCurrentProfile added in v2.4.0

func ApplyCurrentProfile(app gowid.IApp, vp *viper.Viper, vc *viper.Viper) error

vp and vc guaranteed to be non-nil

func ApplyCurrentTheme added in v2.4.0

func ApplyCurrentTheme(app gowid.IApp)

func Build

func Build(tty string) (*gowid.App, error)

func ClearProgressWidgetFor added in v2.4.0

func ClearProgressWidgetFor(app gowid.IApp, owner WidgetOwner)

func ClosePleaseWait

func ClosePleaseWait(app gowid.IApp)

func ComputeConvFilterOp added in v2.3.0

func ComputeConvFilterOp(dirOp FilterMask, comb FilterCombinator, model IFilterModel, curFilter string) string

func ComputeFilterCombOp added in v2.3.0

func ComputeFilterCombOp(comb FilterCombinator, newFilter string, curFilter string) string

func EnsureTemplateData added in v2.2.0

func EnsureTemplateData()

func IsProgressIndeterminate

func IsProgressIndeterminate() bool

func IsTerminalLegible added in v2.3.0

func IsTerminalLegible(app gowid.IApp)

IsTerminalLegible will open up a dialog asking the user to confirm that their running termshark is legible, having upgraded the TERM variable to a 256-color version and restarted.

func MakeCheckGlobalJumpAfterPsml added in v2.2.0

func MakeCheckGlobalJumpAfterPsml(jmp termshark.GlobalJumpPos) checkGlobalJumpAfterPsml

func MakeMenuNavigatingKeyPress

func MakeMenuNavigatingKeyPress(left *NextMenu, right *NextMenu) appkeys.KeyInputFn

func MakeMenuWithHotKeys

func MakeMenuWithHotKeys(items []SimpleMenuItem) gowid.IWidget

func MakePacketViewUpdater

func MakePacketViewUpdater() updatePacketViews

func MakeUpdateCurrentCaptureInTitle

func MakeUpdateCurrentCaptureInTitle() updateCurrentCaptureInTitle

func MaybeKeepThenRequestLoadPcap added in v2.3.0

func MaybeKeepThenRequestLoadPcap(pcapf string, displayFilter string, jump termshark.GlobalJumpPos, app gowid.IApp)

MaybeKeepThenRequestLoadPcap loads a pcap after first checking to see whether the current load is a live load and the packets need to be kept.

func MenuNavigatingKeyPress(evk *tcell.EventKey, left *NextMenu, right *NextMenu, app gowid.IApp) bool

func NewDefaultPsmlColumnsModel added in v2.3.0

func NewDefaultPsmlColumnsModel(app gowid.IApp) *psmlColumnsModel

func NewPsmlColumnsModel added in v2.3.0

func NewPsmlColumnsModel(app gowid.IApp) *psmlColumnsModel

func NewPsmlColumnsModelFrom added in v2.3.0

func NewPsmlColumnsModelFrom(colsKey string, app gowid.IApp) *psmlColumnsModel

func NewPsmlTableRowWidget added in v2.1.0

func NewPsmlTableRowWidget(w *rowFocusTableWidget, c []pcap.PacketColors) *psmlTableRowWidget

func NewRowFocusTableWidget added in v2.1.0

func NewRowFocusTableWidget(w iRowFocusTableWidgetNeeds, rs string, rf string) *rowFocusTableWidget

func OpenError

func OpenError(msgt string, app gowid.IApp) *dialog.Widget

func OpenLongError added in v2.2.0

func OpenLongError(msgt string, app gowid.IApp) *dialog.Widget

func OpenLongMessage added in v2.2.0

func OpenLongMessage(msgt string, openOver gowid.ISettableComposite, app gowid.IApp) *dialog.Widget

func OpenMessage

func OpenMessage(msgt string, openOver gowid.ISettableComposite, app gowid.IApp) *dialog.Widget

func OpenMessageForCopy added in v2.1.0

func OpenMessageForCopy(msgt string, openOver gowid.ISettableComposite, app gowid.IApp) *dialog.Widget

func OpenPleaseWait

func OpenPleaseWait(container gowid.ISettableComposite, app gowid.IApp)

func OpenTemplatedDialog

func OpenTemplatedDialog(container gowid.ISettableComposite, tmplName string, app gowid.IApp) *dialog.Widget

func OpenTemplatedDialogExt added in v2.2.0

func OpenTemplatedDialogExt(container gowid.ISettableComposite, tmplName string, width gowid.IWidgetDimension, height gowid.IWidgetDimension, app gowid.IApp) *dialog.Widget

func RequestLoadInterfaces added in v2.2.0

func RequestLoadInterfaces(psrcs []pcap.IPacketSource, captureFilter string, displayFilter string, tmpfile string, app gowid.IApp)

func RequestLoadPcap added in v2.3.0

func RequestLoadPcap(pcapf string, displayFilter string, jump termshark.GlobalJumpPos, app gowid.IApp)

Call from app goroutine context

func RequestNewFilter added in v2.2.0

func RequestNewFilter(displayFilter string, app gowid.IApp)

func RequestQuit added in v2.2.0

func RequestQuit()

func RequestReload added in v2.3.0

func RequestReload(app gowid.IApp)

func SetDarkMode added in v2.4.0

func SetDarkMode(mode bool)

func SetProgressDeterminateFor added in v2.4.0

func SetProgressDeterminateFor(app gowid.IApp, owner WidgetOwner)

func SetProgressIndeterminateFor added in v2.4.0

func SetProgressIndeterminateFor(app gowid.IApp, owner WidgetOwner)

func SetProgressWidget added in v2.2.0

func SetProgressWidget(app gowid.IApp)

func SetProgressWidgetCustom added in v2.4.0

func SetProgressWidgetCustom(app gowid.IApp, c *columns.Widget, owner WidgetOwner)

func SetSearchProgressWidget added in v2.4.0

func SetSearchProgressWidget(app gowid.IApp)

func SetupColors added in v2.2.0

func SetupColors()

func StopEmptyHexViewTimer

func StopEmptyHexViewTimer()

func StopEmptyStructViewTimer

func StopEmptyStructViewTimer()

func SuggestSwitchingTerm added in v2.3.0

func SuggestSwitchingTerm(app gowid.IApp)

SuggestSwitchingTerm will open a dialog asking the user if they would like to try a more colorful TERM setting.

func UpdateProfileWidget added in v2.4.0

func UpdateProfileWidget(name string, app gowid.IApp)

func UpdateProgressBarForFile

func UpdateProgressBarForFile(c *pcap.PacketLoader, prevRatio float64, app gowid.IApp) float64

Runs in app goroutine

func UpdateProgressBarForInterface

func UpdateProgressBarForInterface(c *pcap.InterfaceLoader, app gowid.IApp)

Runs in app goroutine

func UpdateRecentMenu

func UpdateRecentMenu(app gowid.IApp)

func WriteHelp

func WriteHelp(p *flags.Parser, w io.Writer)

func WriteMarks added in v2.2.0

func WriteMarks(p *flags.Parser, marks map[rune]int, w io.Writer)

func WriteTsharkVersion

func WriteTsharkVersion(p *flags.Parser, bin string, ver semver.Version, w io.Writer)

func WriteVersion

func WriteVersion(p *flags.Parser, w io.Writer)

Types

type BytesResult added in v2.4.0

type BytesResult struct {
	PacketNum int
	PacketPos int
	PacketRow int
}

BytesResult represents a match for a search within the bytes of the packets loaded. A match is a packet number, and the position within the byte array representing the packet's data.

func (BytesResult) PacketNumber added in v2.4.0

func (s BytesResult) PacketNumber() int

type BytesSearchCallbacks added in v2.4.0

type BytesSearchCallbacks struct {
	*SearchStopper
	// contains filtered or unexported fields
}

Search in the packet hex view

func (BytesSearchCallbacks) OnError added in v2.4.0

func (s BytesSearchCallbacks) OnError(err error, app gowid.IApp)

func (BytesSearchCallbacks) OnTick added in v2.4.0

func (s BytesSearchCallbacks) OnTick(app gowid.IApp)

func (*BytesSearchCallbacks) Reset added in v2.4.0

func (w *BytesSearchCallbacks) Reset(app gowid.IApp)

func (*BytesSearchCallbacks) SearchPacketsFrom added in v2.4.0

func (w *BytesSearchCallbacks) SearchPacketsFrom(ifrom interface{}, istart interface{}, term search.INeedle, app gowid.IApp)

own goroutine startPacketNumber >= 1

func (*BytesSearchCallbacks) SearchPacketsResult added in v2.4.0

func (s *BytesSearchCallbacks) SearchPacketsResult(res search.Result, app gowid.IApp)

func (*BytesSearchCallbacks) StartingPosition added in v2.4.0

func (w *BytesSearchCallbacks) StartingPosition() (interface{}, error)

type CancelledMessage added in v2.2.0

type CancelledMessage struct{}

func (CancelledMessage) AfterEnd added in v2.2.0

func (t CancelledMessage) AfterEnd(code pcap.HandlerCode, app gowid.IApp)

type ClearMarksHandler added in v2.2.0

type ClearMarksHandler struct{}

type ClearWormholeState added in v2.3.0

type ClearWormholeState struct{}

func (ClearWormholeState) OnNewSource added in v2.3.0

func (t ClearWormholeState) OnNewSource(code pcap.HandlerCode, app gowid.IApp)

type ConvAddr added in v2.4.0

type ConvAddr int
const (
	IPv4Addr ConvAddr = 0
	IPv6Addr ConvAddr = iota
	MacAddr  ConvAddr = iota
)

type ConvsModel added in v2.1.1

type ConvsModel struct {
	*psmlmodel.Model
	// contains filtered or unexported fields
}

func (ConvsModel) GetAFilter added in v2.1.1

func (m ConvsModel) GetAFilter(row int, dir Direction) string

func (ConvsModel) GetBFilter added in v2.1.1

func (m ConvsModel) GetBFilter(row int, dir Direction) string

type ConvsUiOptions added in v2.1.1

type ConvsUiOptions struct {
	CopyModeWidget gowid.IWidget // What to display when copy-mode is started.
}

type ConvsUiWidget added in v2.1.1

type ConvsUiWidget struct {
	gowid.IWidget
	// contains filtered or unexported fields
}

func NewConvsUi added in v2.1.1

func NewConvsUi(captureDevice string, displayFilter string, pcapf string, pw IPleaseWait, opts ...ConvsUiOptions) *ConvsUiWidget

func (*ConvsUiWidget) AbsoluteTime added in v2.1.1

func (w *ConvsUiWidget) AbsoluteTime() bool

func (*ConvsUiWidget) Context added in v2.1.1

func (w *ConvsUiWidget) Context() context.Context

func (*ConvsUiWidget) FilterValue added in v2.1.1

func (w *ConvsUiWidget) FilterValue() string

func (*ConvsUiWidget) OnCancel added in v2.1.1

func (w *ConvsUiWidget) OnCancel(app gowid.IApp)

func (*ConvsUiWidget) OnData added in v2.1.1

func (w *ConvsUiWidget) OnData(data string, app gowid.IApp)

func (*ConvsUiWidget) ReloadNeeded added in v2.1.1

func (w *ConvsUiWidget) ReloadNeeded()

func (*ConvsUiWidget) Render added in v2.1.1

func (w *ConvsUiWidget) Render(size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) gowid.ICanvas

func (*ConvsUiWidget) ResolveNames added in v2.1.1

func (w *ConvsUiWidget) ResolveNames() bool

func (*ConvsUiWidget) SetAbsoluteTime added in v2.1.1

func (w *ConvsUiWidget) SetAbsoluteTime(val bool)

func (*ConvsUiWidget) SetResolveNames added in v2.1.1

func (w *ConvsUiWidget) SetResolveNames(val bool)

func (*ConvsUiWidget) SetUseFilter added in v2.1.1

func (w *ConvsUiWidget) SetUseFilter(val bool)

func (*ConvsUiWidget) UseFilter added in v2.1.1

func (w *ConvsUiWidget) UseFilter() bool

type CsvTableCopier added in v2.1.1

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

func (CsvTableCopier) CopyRow added in v2.1.1

func (c CsvTableCopier) CopyRow(id table.RowId) []gowid.ICopyResult

func (CsvTableCopier) CopyTable added in v2.1.1

func (c CsvTableCopier) CopyTable() []gowid.ICopyResult

type Direction added in v2.1.1

type Direction int
const (
	Any  Direction = 0
	To   Direction = iota
	From Direction = iota
)

type FilterCombinator added in v2.1.1

type FilterCombinator int
const (
	Selected       FilterCombinator = 0
	NotSelected    FilterCombinator = iota
	AndSelected    FilterCombinator = iota
	OrSelected     FilterCombinator = iota
	AndNotSelected FilterCombinator = iota
	OrNotSelected  FilterCombinator = iota
)

type FilterMask added in v2.1.1

type FilterMask int
const (
	AtfB   FilterMask = 0
	AtB    FilterMask = iota
	BtA    FilterMask = iota
	AtfAny FilterMask = iota
	AtAny  FilterMask = iota
	AnytA  FilterMask = iota
	AnytfB FilterMask = iota
	AnytB  FilterMask = iota
	BtAny  FilterMask = iota
)

type FilterResult added in v2.4.0

type FilterResult struct {
	PacketNum int
}

FilterResult represents a match via a display filter search. This is no more specific than a packet/frame number to jump to.

func (FilterResult) PacketNumber added in v2.4.0

func (s FilterResult) PacketNumber() int

type FilterSearchCallbacks added in v2.4.0

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

Search via a display filter

func NewFilterSearchCallbacks added in v2.4.0

func NewFilterSearchCallbacks(
	callbacks *commonSearchCallbacks,
	searchCh chan search.IntermediateResult) *FilterSearchCallbacks

func (FilterSearchCallbacks) OnError added in v2.4.0

func (s FilterSearchCallbacks) OnError(err error, app gowid.IApp)

func (FilterSearchCallbacks) OnTick added in v2.4.0

func (s FilterSearchCallbacks) OnTick(app gowid.IApp)

func (*FilterSearchCallbacks) RequestStop added in v2.4.0

func (w *FilterSearchCallbacks) RequestStop(app gowid.IApp)

func (*FilterSearchCallbacks) Reset added in v2.4.0

func (w *FilterSearchCallbacks) Reset(app gowid.IApp)

func (*FilterSearchCallbacks) SearchPacketsFrom added in v2.4.0

func (w *FilterSearchCallbacks) SearchPacketsFrom(ifrom interface{}, istart interface{}, term search.INeedle, app gowid.IApp)

startPacketNumber >= 1

func (*FilterSearchCallbacks) SearchPacketsResult added in v2.4.0

func (s *FilterSearchCallbacks) SearchPacketsResult(res search.Result, app gowid.IApp)

func (*FilterSearchCallbacks) StartingPosition added in v2.4.0

func (w *FilterSearchCallbacks) StartingPosition() (interface{}, error)

type IFilterBuilder added in v2.1.1

type IFilterBuilder interface {
	fmt.Stringer
	FilterFrom(vals ...string) string
	FilterTo(vals ...string) string
	FilterAny(vals ...string) string
	AIndex() []int
	BIndex() []int
}

Use to construct a string like "ip.addr == 1.2.3.4 && tcp.port == 12345"

type IFilterModel added in v2.3.0

type IFilterModel interface {
	GetAFilter(Direction) string
	GetBFilter(Direction) string
}

type IOnDataSync added in v2.1.1

type IOnDataSync interface {
	OnData(data string, app gowid.IApp)
	OnCancel(gowid.IApp)
}

type IPleaseWait added in v2.1.1

type IPleaseWait interface {
	OpenPleaseWait(app gowid.IApp)
	ClosePleaseWait(app gowid.IApp)
}

type ListResult added in v2.4.0

type ListResult struct {
	Column    int
	PacketNum int
}

ListResult represents a match for a search within the packet list view. This is really just the PSML already generated by tshark. The result is a packet number and a column; on a match, the packet list view will be updated to show the matched row and column.

func (ListResult) PacketNumber added in v2.4.0

func (s ListResult) PacketNumber() int

type ListSearchCallbacks added in v2.4.0

type ListSearchCallbacks struct {
	*SearchStopper
	// contains filtered or unexported fields
}

Search in the packet list view: 1 0.000000 10.44.10.228 8.8.4.4 DNS 77 Standard query 0x51fe A ac.duckduckgo.com 2 0.024306 10.44.10.228 176.103.130. DNS 77 Standard query 0x51fe A ac.duckduckgo.com 3 0.024875 8.8.4.4 10.44.10.228 DNS 139 Standard query response 0x51fe A ac.duckduckgo.com CNAME 4 0.025500 10.44.10.228 184.72.104.1 TCP 66 55408 → 443 [SYN] Seq=0 Win=8192 Len=0 MSS=1460 WS=256 S 0

func (ListSearchCallbacks) OnError added in v2.4.0

func (s ListSearchCallbacks) OnError(err error, app gowid.IApp)

func (ListSearchCallbacks) OnTick added in v2.4.0

func (s ListSearchCallbacks) OnTick(app gowid.IApp)

func (*ListSearchCallbacks) Reset added in v2.4.0

func (w *ListSearchCallbacks) Reset(app gowid.IApp)

func (*ListSearchCallbacks) SearchPacketsFrom added in v2.4.0

func (w *ListSearchCallbacks) SearchPacketsFrom(ifrom interface{}, istart interface{}, term search.INeedle, app gowid.IApp)

own goroutine startPacketNumber >= 1

func (*ListSearchCallbacks) SearchPacketsResult added in v2.4.0

func (s *ListSearchCallbacks) SearchPacketsResult(res search.Result, app gowid.IApp)

func (*ListSearchCallbacks) StartingPosition added in v2.4.0

func (w *ListSearchCallbacks) StartingPosition() (interface{}, error)

type LoadResult

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

type ManageCapinfoCache added in v2.1.0

type ManageCapinfoCache struct{}

func (ManageCapinfoCache) OnClear added in v2.2.0

func (ManageCapinfoCache) OnNewSource added in v2.1.0

func (t ManageCapinfoCache) OnNewSource(pcap.HandlerCode, gowid.IApp)

Make sure that existing stream widgets are discarded if the user loads a new pcap.

type ManageConvsCache added in v2.1.1

type ManageConvsCache struct{}

func (ManageConvsCache) OnNewSource added in v2.1.1

func (t ManageConvsCache) OnNewSource(pcap.HandlerCode, gowid.IApp)

Make sure that existing data is discarded if the user loads a new pcap.

type ManageSearchData added in v2.4.0

type ManageSearchData struct{}

func (ManageSearchData) OnClear added in v2.4.0

func (t ManageSearchData) OnClear(c pcap.HandlerCode, app gowid.IApp)

func (ManageSearchData) OnNewSource added in v2.4.0

func (t ManageSearchData) OnNewSource(c pcap.HandlerCode, app gowid.IApp)

Make sure that existing stream widgets are discarded if the user loads a new pcap.

type ManageStreamCache

type ManageStreamCache struct{}

func (ManageStreamCache) OnClear added in v2.2.0

func (ManageStreamCache) OnNewSource

func (t ManageStreamCache) OnNewSource(pcap.HandlerCode, gowid.IApp)

Make sure that existing stream widgets are discarded if the user loads a new pcap.

type MenuHolder struct {
	gowid.IMenuCompatible
}

type MultiMenuOpener added in v2.3.0

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

func (*MultiMenuOpener) CloseMenu added in v2.3.0

func (o *MultiMenuOpener) CloseMenu(mnu *menu.Widget, app gowid.IApp)

func (*MultiMenuOpener) OpenMenu added in v2.3.0

func (o *MultiMenuOpener) OpenMenu(mnu *menu.Widget, site menu.ISite, app gowid.IApp) bool

type NextMenu

type NextMenu struct {
	Cur       *menu.Widget
	Next      *menu.Widget // nil if menu is nil
	Site      *menu.SiteWidget
	Container gowid.IFocus // container holding menu buttons, etc
	Focus     int          // index of next menu in container
}

type NoHandlers

type NoHandlers struct{}

type OpenErrorDialog added in v2.4.0

type OpenErrorDialog struct{}

func (OpenErrorDialog) OnError added in v2.4.0

func (f OpenErrorDialog) OnError(err error, app gowid.IApp)

type PacketSearcher added in v2.4.0

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

PacketSearcher coordinates a packet search and communicates results back from the search implementations via resultChan.

func (*PacketSearcher) SearchPackets added in v2.4.0

func (w *PacketSearcher) SearchPackets(term search.INeedle, cbs search.ICallbacks, app gowid.IApp)

SearchPackets looks for the given search term in the currently loaded packets. It is written generically, with the specifics of the packet details to be searched provided by a set of callbacks. These give the search algorithm the starting position, the mechanics of the search, and so on. An instance of a search can return a matching position, or a value indicating that the algorithm needs to wait until packet data is available (e.g. if PDML data needs to be searched but is not currently loaded). If a match is found, the callbacks also determine how to update the UI to represent the match.

type PaletteSwitcher

type PaletteSwitcher struct {
	P1        gowid.IPalette
	P2        gowid.IPalette
	ChooseOne *bool
}

func (PaletteSwitcher) CellStyler

func (p PaletteSwitcher) CellStyler(name string) (gowid.ICellStyler, bool)

func (PaletteSwitcher) RangeOverPalette

func (p PaletteSwitcher) RangeOverPalette(f func(key string, value gowid.ICellStyler) bool)

type Prog

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

Prog hold a progress model - a current value on the way up to the max value

func (Prog) Add added in v2.2.0

func (p Prog) Add(y Prog) Prog

func (Prog) Complete

func (p Prog) Complete() bool

func (Prog) Div added in v2.2.0

func (p Prog) Div(y int64) Prog

func (Prog) String

func (p Prog) String() string

type RenderRatioUpTo added in v2.3.0

type RenderRatioUpTo struct {
	gowid.RenderWithRatio
	// contains filtered or unexported fields
}

func (RenderRatioUpTo) MaxUnits added in v2.3.0

func (r RenderRatioUpTo) MaxUnits() int

func (RenderRatioUpTo) String added in v2.3.0

func (r RenderRatioUpTo) String() string

type RenderWeightUpTo

type RenderWeightUpTo struct {
	gowid.RenderWithWeight
	// contains filtered or unexported fields
}

func (RenderWeightUpTo) MaxUnits

func (s RenderWeightUpTo) MaxUnits() int

type SaveRecents

type SaveRecents struct {
	Pcap   string
	Filter string
}

func MakeSaveRecents

func MakeSaveRecents(pcap string, filter string) SaveRecents

func (SaveRecents) BeforeBegin added in v2.2.0

func (t SaveRecents) BeforeBegin(code pcap.HandlerCode, app gowid.IApp)

type SearchStopper added in v2.4.0

type SearchStopper struct {
	RequestedMutex sync.Mutex
	Requested      bool
}

func (*SearchStopper) DoIfStopped added in v2.4.0

func (s *SearchStopper) DoIfStopped(f func())

func (*SearchStopper) RequestStop added in v2.4.0

func (s *SearchStopper) RequestStop(app gowid.IApp)

type SetStructWidgets

type SetStructWidgets struct {
	Ld *pcap.PacketLoader
}

used for the pdml loader

func (SetStructWidgets) AfterEnd

func (s SetStructWidgets) AfterEnd(code pcap.HandlerCode, app gowid.IApp)

Close the channel before the callback. When the global loader state is idle, app.Quit() will stop accepting app callbacks, so the goroutine that waits for ch to be closed will never terminate.

func (SetStructWidgets) BeforeBegin

func (s SetStructWidgets) BeforeBegin(code pcap.HandlerCode, app gowid.IApp)

func (SetStructWidgets) OnError

func (s SetStructWidgets) OnError(code pcap.HandlerCode, app gowid.IApp, err error)

type SimpleErrors added in v2.2.0

type SimpleErrors struct{}

func (SimpleErrors) OnError added in v2.2.0

func (t SimpleErrors) OnError(code pcap.HandlerCode, app gowid.IApp, err error)

type SimpleMenuItem

type SimpleMenuItem struct {
	Txt string
	Key gowid.IKey
	CB  gowid.WidgetChangedFunction
}

func MakeMenuDivider

func MakeMenuDivider() SimpleMenuItem

type StartUIWhenThereArePackets added in v2.2.0

type StartUIWhenThereArePackets struct{}

func (StartUIWhenThereArePackets) OnPsmlHeader added in v2.2.0

func (t StartUIWhenThereArePackets) OnPsmlHeader(code pcap.HandlerCode, app gowid.IApp)

type StructResult added in v2.4.0

type StructResult struct {
	PacketNum int
	TreePos   tree.IPos
	Model     *pdmltree.Model
}

StructResult represents a match for a search within the packet structure. The result is a specific location in the packet struct model. The UI will be updated to show this match, expanded, when a search succeeds.

func (StructResult) PacketNumber added in v2.4.0

func (s StructResult) PacketNumber() int

type StructSearchCallbacks added in v2.4.0

type StructSearchCallbacks struct {
	*SearchStopper
	// contains filtered or unexported fields
}

Search in the packet struct view:

<proto name="ip" showname="Internet Protocol Version 4, Src: 10.215.173.1, Dst: 64.13.139.230" size="20" pos="0">

<field name="ip.version" showname="0100 .... = Version: 4" size="1" pos="0" show="4" value="45"/>
<field name="ip.hdr_len" showname=".... 0101 = Header Length: 20 bytes (5)" size="1" pos="0" show="20" value="45"/>
<field name="ip.dsfield" showname="Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)" size="1" pos="1" show="0x00000000" value="00">
  <field name="ip.dsfield.dscp" showname="0000 00.. = Differentiated Services Codepoint: Default (0)" size="1" pos="1" show="0" value="0" unmaskedvalue="00"/>
  <field name="ip.dsfield.ecn" showname=".... ..00 = Explicit Congestion Notification: Not ECN-Capable Transport (0)" size="1" pos="1" show="0" value="0" unmaskedvalue="00"/>
</field>

func (*StructSearchCallbacks) CheckNode added in v2.4.0

func (w *StructSearchCallbacks) CheckNode(tr tree.IModel, pos tree.IPos) bool

CheckNode is provided to implement ISearchPred for the gowid tree's depth first search.

func (StructSearchCallbacks) OnError added in v2.4.0

func (s StructSearchCallbacks) OnError(err error, app gowid.IApp)

func (StructSearchCallbacks) OnTick added in v2.4.0

func (s StructSearchCallbacks) OnTick(app gowid.IApp)

func (*StructSearchCallbacks) Reset added in v2.4.0

func (w *StructSearchCallbacks) Reset(app gowid.IApp)

func (*StructSearchCallbacks) SearchPacketsFrom added in v2.4.0

func (w *StructSearchCallbacks) SearchPacketsFrom(ifrom interface{}, istart interface{}, term search.INeedle, app gowid.IApp)

own goroutine startPacketNumber >= 1

func (*StructSearchCallbacks) SearchPacketsResult added in v2.4.0

func (s *StructSearchCallbacks) SearchPacketsResult(res search.Result, app gowid.IApp)

func (*StructSearchCallbacks) StartingPosition added in v2.4.0

func (w *StructSearchCallbacks) StartingPosition() (interface{}, error)

type WidgetOwner added in v2.4.0

type WidgetOwner int
const (
	NoOwner WidgetOwner = iota
	LoaderOwns
	SearchOwns
)

Directories

Path Synopsis
Package menuutil contains user-interface functions and helpers for termshark.
Package menuutil contains user-interface functions and helpers for termshark.
Package tableutil contains user-interface functions and helpers for termshark's tables - in particular, helpers for vim key sequences like 5gg and G
Package tableutil contains user-interface functions and helpers for termshark's tables - in particular, helpers for vim key sequences like 5gg and G

Jump to

Keyboard shortcuts

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