Skip to main content

runspec-wireshark

Packet captures as a runspec runnable, over Wireshark's tshark. One runnable — pcap — with a verb per tool, chosen from the open-source Wireshark MCP servers (all of which wrap tshark): mcp-wireshark, WireMCP, sharkline and wireshark-mcp. pip install it into a venv and it's discoverable by runspec local, runspec serve (MCP), and runspec-console.

runspec serve flattens each verb into a leaf MCP tool (pcap_summary, pcap_follow, …), so a runspec-console agent can read a capture over SSH on the host where it was taken, without copying the file anywhere.

The runnable is called pcap, not wireshark or tshark, so it never shadows the real Wireshark binaries on PATH.

Install

pip install runspec-wireshark

It needs tshark on the host (capinfos and mergecap come with it):

OS Install
Debian / Ubuntu sudo apt install tshark
RHEL / Fedora sudo dnf install wireshark-cli
Windows, macOS the Wireshark installer

pcap check says whether tshark was found and which version. If it isn't on PATH, set TSHARK_PATH (or --tshark) to it; capinfos and mergecap are looked for in the same folder. The usual Windows and macOS install folders are tried too.

Verbs

Reading a capture is read-only and autonomous. The four verbs that create files are confirm.

Area Verbs
Install and files check, list-interfaces, file-info
First look summary — protocols, busiest hosts and connections, TCP resets, expert warnings
Packets packets (one row per packet, paged), packet (one packet decoded layer by layer), fields (any tshark fields), top (most common values of a field)
Statistics protocols, conversations, endpoints, expert, io (packets and bytes per interval), stats (any tshark -z report)
Streams follow — the text of a TCP, UDP, TLS, HTTP, HTTP/2 or QUIC stream, both directions in order
Applications dns (lookups, failures first, slow answers), http (requests joined to responses, errors and slow ones), tls (handshakes with SNI, version, cipher, certificate names and alerts)
Files (confirm) capture (live, bounded by --duration / --count / --max-mb), save-filtered, merge, export-objects

Every reading verb takes a positional capture file and --filter / -Y, a Wireshark display filter (tcp.flags.reset == 1, http.response.code >= 400, ip.addr == 10.0.0.5). capture takes a BPF capture filter instead (-f 'host 10.0.0.5 and port 443').

pcap summary /tmp/outage.pcapng
pcap packets /tmp/outage.pcapng -Y 'tcp.flags.reset == 1'
pcap follow /tmp/outage.pcapng 3
pcap tls /tmp/outage.pcapng --failed
pcap capture -i eth0 --duration 30 -f 'host 10.0.0.5 and port 443'

Output

Results are compact by default, because an agent re-reads every tool result on each later step:

  • Lists are capped by --limit and say truncated: true; packets and fields page with --offset (next_offset says where the next page starts).
  • packet returns each layer's title and its fields as indented lines (up to 40 per layer, --depth levels deep); --layer http details one layer, --include bytes adds the hex dump, --raw returns tshark's JSON for the packet.
  • follow returns each direction's chunks in order and stops at --max-bytes (4000).
  • conversations, endpoints and io are computed from one pass over the file, so bytes are exact and each TCP/UDP conversation carries its stream index for follow.

A person at a terminal gets readable text; agents, pipes, the console's Forms tab and schedulers get JSON. Name resolution is off (no DNS lookup for every address); --resolve-names turns it on.

Capturing

capture needs capture rights: root, or on Linux an account in the wireshark group (sudo usermod -aG wireshark <user>, after sudo dpkg-reconfigure wireshark-common on Debian/Ubuntu); on Windows, Npcap. It always stops — after --duration seconds (default 10, at most 3600), --count packets or --max-mb megabytes (default 100) — and writes to --output, or a capture-<time>.pcapng in --capture-dir (WIRESHARK_CAPTURE_DIR, default the temp folder). No verb overwrites an existing file unless --overwrite, and export-objects only writes into a new or empty folder.

capture and export-objects are recorded as audit events (pcap.capture, pcap.export_objects). Files exported from a capture came off the network: treat them as untrusted.

TLS decryption

With a TLS key log (the SSLKEYLOGFILE a browser, curl or a JVM agent can write), --keylog-file decrypts TLS: then follow --protocol tls and http show the payload. It reads WIRESHARK_KEYLOG_FILE, then SSLKEYLOGFILE.

Settings — env vars

Variable Arg Meaning
TSHARK_PATH, WIRESHARK_TSHARK --tshark tshark when it isn't on PATH
WIRESHARK_KEYLOG_FILE, SSLKEYLOGFILE --keylog-file TLS key log
WIRESHARK_TIMEOUT --timeout seconds before a tshark run is stopped (120)
WIRESHARK_CAPTURE_DIR capture --capture-dir where captures go without --output

Each arg declares its variables as its env, so runspec-console's Env files window lists them for a venv's .runspec_env.

Mock responses

runspec_wireshark/mocks/pcap.json holds recorded answers for every verb, so RUNSPEC_MOCK=1 pcap … (runspec 0.74.0+) answers without tshark — for trying the runnable in the console or testing an agent. The recordings come from the real code reading a sample capture of made-up traffic (DNS, HTTP 200/404/500, a TCP reset, TLS 1.2 and 1.3, a failed unknown_ca handshake); file paths are left out of the keys, so pcap follow <any file> 2 gets the recording for stream 2. Re-record with scripts/record_mocks.py.

Not ported

Some of those MCP servers do more; these were left out on purpose:

  • Credential extraction (tshark -z credentials, WireMCP's and others' password dumps) — stats refuses credentials; a tool result is the wrong place for secrets.
  • Threat-intel and GeoIP lookups, YARA scanning and beaconing detection — they call outside services or need rule sets; build them on the core if you need them.
  • WPA/WEP decryption, and editcap trimming and splitting.

Building your own runnables

The logic lives in runspec-wireshark-core, which has no runspec dependency and surfaces no runnables. A private package can depend on it alone and wrap the helpers as narrower runnables — for example one that checks a team's service for resets and failed handshakes:

from runspec_wireshark_core import config_from_env, packets, tls

cfg = config_from_env()
resets = packets(cfg, "/var/tmp/checkout.pcapng", filter="tcp.flags.reset == 1 and tcp.port == 8443")
failed = tls(cfg, "/var/tmp/checkout.pcapng", failed=True)

Metadata

Release files for runspec-wireshark 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for runspec-wireshark 0.1.0
File Size Uploaded Provenance Actions
runspec_wireshark-0.1.0.tar.gz 28.2 kB With provenance Details for runspec_wireshark-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for runspec-wireshark 0.1.0
File Interpreter ABI Platform Actions
runspec_wireshark-0.1.0-py3-none-any.whl Python 3 none any Details for runspec_wireshark-0.1.0-py3-none-any.whl

Total release size: 51.8 kB

Release files / runspec_wireshark-0.1.0.tar.gz

Download URL runspec_wireshark-0.1.0.tar.gz
Size 28.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e29e75d631597f90ab9283d2e1650171657b3787ff4cc44020dd0871fea610e6
BLAKE2b-256 checksum
How to use checksums
f1e83466e51489bbcd4e789d6a3c826f477dd1e573b26a2abb3e4186584cd9f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.

Transparency log

Release files / runspec_wireshark-0.1.0-py3-none-any.whl

Download URL runspec_wireshark-0.1.0-py3-none-any.whl
Size 23.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3be29efefdf96230f927d4e84b2fcfab9d208eb6f5bdd62c7448df4f8cb9f622
BLAKE2b-256 checksum
How to use checksums
a796554febd8e7cdb2fa5a272536c8b56809bb08c91b42e9ba66fdc2fa2e53ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.

Transparency log

Security for runspec-wireshark 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for runspec_wireshark-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page