ui

package
v2.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2025 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

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

don't claim the keypress

func ApplyCurrentProfile

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

vp and vc guaranteed to be non-nil

func ApplyCurrentTheme

func ApplyCurrentTheme(app gowid.IApp)

func Build

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

func ClearProgressWidgetFor

func ClearProgressWidgetFor(app gowid.IApp, owner WidgetOwner)

func ClosePleaseWait

func ClosePleaseWait(app gowid.IApp)

func ComputeConvFilterOp

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

func ComputeFilterCombOp

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

func EnsureTemplateData

func EnsureTemplateData()

func IsProgressIndeterminate

func IsProgressIndeterminate() bool

func IsTerminalLegible

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

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

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

func NewDefaultPsmlColumnsModel(app gowid.IApp) *psmlColumnsModel

func NewPsmlColumnsModel

func NewPsmlColumnsModel(app gowid.IApp) *psmlColumnsModel

func NewPsmlColumnsModelFrom

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

func NewPsmlTableRowWidget

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

func NewRowFocusTableWidget

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

func OpenError

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

func OpenLongError

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

func OpenLongMessage

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

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

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

func RequestLoadInterfaces

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

func RequestLoadPcap

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

Call from app goroutine context

func RequestNewFilter

func RequestNewFilter(displayFilter string, app gowid.IApp)

func RequestQuit

func RequestQuit()

func RequestReload

func RequestReload(app gowid.IApp)

func SetDarkMode

func SetDarkMode(mode bool)

func SetProgressDeterminateFor

func SetProgressDeterminateFor(app gowid.IApp, owner WidgetOwner)

func SetProgressIndeterminateFor

func SetProgressIndeterminateFor(app gowid.IApp, owner WidgetOwner)

func SetProgressWidget

func SetProgressWidget(app gowid.IApp)

func SetProgressWidgetCustom

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

func SetSearchProgressWidget

func SetSearchProgressWidget(app gowid.IApp)

func SetupColors

func SetupColors()

func StopEmptyHexViewTimer

func StopEmptyHexViewTimer()

func StopEmptyStructViewTimer

func StopEmptyStructViewTimer()

func SuggestSwitchingTerm

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

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

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

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

func (s BytesResult) PacketNumber() int

type BytesSearchCallbacks

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

Search in the packet hex view

func (BytesSearchCallbacks) OnError

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

func (BytesSearchCallbacks) OnTick

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

func (*BytesSearchCallbacks) Reset

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

func (*BytesSearchCallbacks) SearchPacketsFrom

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

own goroutine startPacketNumber >= 1

func (*BytesSearchCallbacks) SearchPacketsResult

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

func (*BytesSearchCallbacks) StartingPosition

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

type CancelledMessage

type CancelledMessage struct{}

func (CancelledMessage) AfterEnd

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

type ClearMarksHandler

type ClearMarksHandler struct{}

type ClearWormholeState

type ClearWormholeState struct{}

func (ClearWormholeState) OnNewSource

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

type ConvAddr

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

type ConvsModel

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

func (ConvsModel) GetAFilter

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

func (ConvsModel) GetBFilter

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

type ConvsUiOptions

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

type ConvsUiWidget

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

func NewConvsUi

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

func (*ConvsUiWidget) AbsoluteTime

func (w *ConvsUiWidget) AbsoluteTime() bool

func (*ConvsUiWidget) Context

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

func (*ConvsUiWidget) FilterValue

func (w *ConvsUiWidget) FilterValue() string

func (*ConvsUiWidget) OnCancel

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

func (*ConvsUiWidget) OnData

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

func (*ConvsUiWidget) ReloadNeeded

func (w *ConvsUiWidget) ReloadNeeded()

func (*ConvsUiWidget) Render

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

func (*ConvsUiWidget) ResolveNames

func (w *ConvsUiWidget) ResolveNames() bool

func (*ConvsUiWidget) SetAbsoluteTime

func (w *ConvsUiWidget) SetAbsoluteTime(val bool)

func (*ConvsUiWidget) SetResolveNames

func (w *ConvsUiWidget) SetResolveNames(val bool)

func (*ConvsUiWidget) SetUseFilter

func (w *ConvsUiWidget) SetUseFilter(val bool)

func (*ConvsUiWidget) UseFilter

func (w *ConvsUiWidget) UseFilter() bool

type CsvTableCopier

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

func (CsvTableCopier) CopyRow

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

func (CsvTableCopier) CopyTable

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

type Direction

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

type FilterCombinator

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

type FilterMask

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

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

func (s FilterResult) PacketNumber() int

type FilterSearchCallbacks

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

Search via a display filter

func NewFilterSearchCallbacks

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

func (FilterSearchCallbacks) OnError

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

func (FilterSearchCallbacks) OnTick

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

func (*FilterSearchCallbacks) RequestStop

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

func (*FilterSearchCallbacks) Reset

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

func (*FilterSearchCallbacks) SearchPacketsFrom

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

startPacketNumber >= 1

func (*FilterSearchCallbacks) SearchPacketsResult

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

func (*FilterSearchCallbacks) StartingPosition

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

type IFilterBuilder

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

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

type IOnDataSync

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

type IPleaseWait

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

type ListResult

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

func (s ListResult) PacketNumber() int

type ListSearchCallbacks

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

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

func (ListSearchCallbacks) OnTick

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

func (*ListSearchCallbacks) Reset

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

func (*ListSearchCallbacks) SearchPacketsFrom

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

own goroutine startPacketNumber >= 1

func (*ListSearchCallbacks) SearchPacketsResult

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

func (*ListSearchCallbacks) StartingPosition

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

type LoadResult

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

type ManageCapinfoCache

type ManageCapinfoCache struct{}

func (ManageCapinfoCache) OnClear

func (ManageCapinfoCache) OnNewSource

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

type ManageConvsCache struct{}

func (ManageConvsCache) OnNewSource

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

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

type ManageSearchData

type ManageSearchData struct{}

func (ManageSearchData) OnClear

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

func (ManageSearchData) OnNewSource

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

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

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

func (*MultiMenuOpener) CloseMenu

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

func (*MultiMenuOpener) OpenMenu

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

type OpenErrorDialog struct{}

func (OpenErrorDialog) OnError

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

type PacketSearcher

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

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

func (p Prog) Add(y Prog) Prog

func (Prog) Complete

func (p Prog) Complete() bool

func (Prog) Div

func (p Prog) Div(y int64) Prog

func (Prog) String

func (p Prog) String() string

type RenderRatioUpTo

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

func (RenderRatioUpTo) MaxUnits

func (r RenderRatioUpTo) MaxUnits() int

func (RenderRatioUpTo) String

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

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

type SearchStopper

type SearchStopper struct {
	RequestedMutex sync.Mutex
	Requested      bool
}

func (*SearchStopper) DoIfStopped

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

func (*SearchStopper) RequestStop

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

type SimpleErrors struct{}

func (SimpleErrors) OnError

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

type StartUIWhenThereArePackets struct{}

func (StartUIWhenThereArePackets) OnPsmlHeader

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

type StructResult

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

func (s StructResult) PacketNumber() int

type StructSearchCallbacks

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

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

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

func (StructSearchCallbacks) OnTick

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

func (*StructSearchCallbacks) Reset

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

func (*StructSearchCallbacks) SearchPacketsFrom

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

own goroutine startPacketNumber >= 1

func (*StructSearchCallbacks) SearchPacketsResult

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

func (*StructSearchCallbacks) StartingPosition

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

type WidgetOwner

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