MCPcopy Index your code
hub / github.com/gcla/termshark

github.com/gcla/termshark @v2.4.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.4.0 ↗ · + Follow
2,170 symbols 5,498 edges 132 files 524 documented · 24% updated 2y agov2.4.0 · 2022-07-11★ 9,92439 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Termshark

A terminal user-interface for tshark, inspired by Wireshark.

V2.4 is out now with packet search and profiles for colors and columns! See the ChangeLog.

demo24

If you're debugging on a remote machine with a large pcap and no desire to scp it back to your desktop, termshark can help!

Features

  • Read pcap files or sniff live interfaces (where tshark is permitted)
  • Filter pcaps or live captures using Wireshark's display filters
  • Reassemble and inspect TCP and UDP flows
  • View network conversations by protocol
  • Copy ranges of packets to the clipboard from the terminal
  • Written in Golang, compiles to a single executable on each platform - downloads available for Linux, macOS, BSD variants, Android (termux) and Windows

tshark has many more features that termshark doesn't expose yet! See What's Next.

Install Packages

Termshark is pre-packaged for the following platforms: Arch Linux, Debian (unstable), FreeBSD, Homebrew, MacPorts, Kali Linux, NixOS, SnapCraft, Termux (Android) and Ubuntu.

Building

Termshark uses Go modules. Set GO111MODULE=on then run:

go install github.com/gcla/termshark/v2/cmd/termshark

For versions of Go between 1.14 and 1.17, use

go get github.com/gcla/termshark/v2/cmd/termshark

Then add ~/go/bin/ to your PATH.

For all packet analysis, termshark depends on tshark from the Wireshark project. Make sure tshark is in your PATH.

Quick Start

Inspect a local pcap:

termshark -r test.pcap

Capture ping packets on interface eth0:

termshark -i eth0 icmp

Run termshark -h for options.

Downloads

Pre-compiled executables are available via Github releases. Or download the latest build from the master branch - Build Status.

Documentation

See the termshark user guide, and my best guess at some FAQs. For a summary of updates, see the ChangeLog.

Dependencies

Termshark depends on these open-source packages:

  • tshark - command-line network protocol analyzer, part of Wireshark
  • tcell - a cell based terminal handling package, inspired by termbox
  • gowid - compositional terminal UI widgets, inspired by urwid, built on tcell

Note that tshark is a run-time dependency, and must be in your PATH for termshark to function. Version 1.10.2 or higher is required (approx 2013).

Contributors

Thanks to everyone that's contributed ports, patches and effort!

Ross Jacobs 💻 🐛 📓 Hongarc 📖 Ryan Steinmetz 📦 Nicolai Søborg 📦 Elliott Sales de Andrade 💻 Romanos 💻 Denys 🐛
jerry73204 📦 Jon Knapp 📦 Mario Harjac 📦 Andrew Benson 🐛 sagis-tikal 🐛 punkymaniac 🐛 msenturk 🐛
Sandor Szücs 🐛 Dawid Dziurla 🐛 📦 jJit0 🐛 inzel 🐛 thejerrod 🤔 gdluca 🐛 Patrick Winter 📦
Robert Larsen 🤔 📓 MinJae Kwon 🐛 the-c0d3r 🤔 Gisle Vanem 🐛 hook 🐛 Lennart Koopmann 🤔 Fernandez, ReK2 🐛
mazball 🤔 wfailla 🤔 荣怡 🤔 thebyrdman-git 🐛 Clemens Mosig 🐛 Michael Rash 📓 joelparker 📓<

Extension points exported contracts — how you extend this code

IMainRunner (Interface)
IMainRunner is implemented by a type that runs a closure on termshark's main loop (via gowid's App.Run) [10 implementers]
pkg/pcap/loader.go
IAction (Interface)
IAction represents a command that can be run in the minibuffer e.g. "set". It can decide whether or not to show in the l [9 …
widgets/minibuffer/minibuffer.go
IFilterBuilder (Interface)
Use to construct a string like "ip.addr == 1.2.3.4 && tcp.port == 12345" [5 implementers]
ui/convsui.go
IPrefixCompleter (Interface)
(no doc) [9 implementers]
pkg/fields/fields.go
IErrorHandler (Interface)
(no doc) [8 implementers]
widgets/search/search.go
IScrollOneLine (Interface)
Implemented by widgets that can scroll [4 implementers]
widgets/withscrollbar/withscrollbar.go
IRowCopier (Interface)
====================================================================== [4 implementers]
widgets/copymodetable/copymodetable.go
IValidator (Interface)
====================================================================== IValidator is passed to the filter constructor [4 …
widgets/filter/filter.go

Core symbols most depended-on inside this repo

SetSubWidget
called by 66
widgets/appkeys/appkeys.go
Run
called by 65
pkg/pcap/loader.go
Close
called by 56
pkg/pcap/loader.go
OpenError
called by 48
ui/ui.go
SetConf
called by 42
configs/profiles/profiles.go
OpenMessage
called by 41
ui/dialog.go
dfg
called by 40
ui/palette.go
dbg
called by 39
ui/palette.go

Shape

Method 1,162
Function 533
Struct 318
Interface 92
TypeAlias 47
FuncType 18

Languages

Go100%

Modules by API surface

ui/ui.go186 symbols
pkg/pcap/loader.go134 symbols
pkg/streams/follow.go133 symbols
pkg/shark/wiresharkcfg/parser.go115 symbols
utils.go113 symbols
widgets/streamwidget/streamwidget.go90 symbols
widgets/search/search.go88 symbols
ui/lastline.go74 symbols
widgets/filter/filter.go62 symbols
ui/convsui.go56 symbols
widgets/hexdumper/hexdumper.go51 symbols
widgets/hexdumper2/hexdumper2.go50 symbols

Dependencies from manifests, versioned

github.com/adam-hanna/arrayOperationsv0.2.6 · 1×
github.com/antchfx/xmlqueryv1.3.3 · 1×
github.com/antchfx/xpathv1.1.11 · 1×
github.com/blang/semverv3.5.1+incompatible · 1×
github.com/flytam/filenamifyv1.1.0 · 1×
github.com/gcla/deepv1.0.2 · 1×
github.com/gcla/gowidv1.4.0 · 1×
github.com/gcla/tailv1.0.1-0.20190505190 · 1×
github.com/gcla/termv0.0.0-2022060123470 · 1×
github.com/go-test/deepv1.0.2 · 1×

For agents

$ claude mcp add termshark \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact