Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Environment:0xKoda WireMCP tshark Wireshark

From Leeroopedia
Knowledge Sources
Domains Infrastructure, Networking, Packet_Capture
Last Updated 2026-10-28 00:00 GMT

Overview

Wireshark/tshark command-line packet analyzer binary (v3+) required for all live capture, packet dissection, statistics, and credential-field extraction in WireMCP.

Description

This environment provides the `tshark` CLI — the terminal-mode packet capture and analysis tool from the Wireshark suite. WireMCP shells out to `tshark` via `child_process.exec` for every network operation: live interface capture (`-i ... -w ... -a duration:`), JSON dissection (`-T json -e ...`), field extraction (`-T fields -e ...`), protocol hierarchy stats (`-qz io,phs`), TCP conversation stats (`-qz conv,tcp`), and credential field extraction. The binary is located at runtime by `findTshark`, which tries `which` then platform-specific fallback paths. No GPU is required; tshark is CPU-bound. Capture requires appropriate OS permissions (e.g., `sudo`/root or `CAP_NET_RAW` on Linux, admin privileges on macOS/Windows) to read from a network interface.

Usage

Use this environment for any WireMCP tool that performs packet capture or PCAP analysis. It is the mandatory prerequisite for all tshark-based implementations: `tshark_live_capture`, `tshark_json_dissection`, `tshark_protocol_hierarchy_stats`, `tshark_tcp_conversation_stats`, `tshark_ip_field_extraction`, `tshark_plaintext_credential_fields`, and `tshark_kerberos_credential_fields`, as well as the `findTshark` binary resolver.

System Requirements

Category Requirement Notes
OS macOS, Windows, or Linux Wireshark is cross-platform
Hardware Any modern CPU No GPU required
Software Wireshark (with tshark) >= 3.0 `tshark` must be installed and in PATH (or at a fallback location)
Permissions Capture privileges Live capture needs root/admin/`CAP_NET_RAW`; PCAP file analysis needs only read access

Dependencies

System Packages

  • `wireshark` / `tshark` >= 3.0 (provides the `tshark` binary)
  • On Linux: `libpcap` (bundled with Wireshark install)
  • On macOS: Wireshark.app bundle (includes tshark at `.../Contents/MacOS/tshark`)
  • On Windows: Wireshark installer (includes `tshark.exe`)

npm Packages

  • `which` >= 5.0.0 (used by `findTshark` to locate the binary on PATH)

Credentials

No API credentials are required. Live capture may require OS-level privileges:

  • `SUDO_PRIVILEGES` or `CAP_NET_RAW` capability (Linux) — to read from a network interface.
  • Administrator privileges (macOS / Windows) — for live interface capture.

These are OS permission grants, not secrets.

Quick Install

# macOS (Homebrew)
brew install --cask wireshark

# Debian/Ubuntu
sudo apt-get install tshark

# Verify tshark is available
tshark -v

Code Evidence

Binary location and fallback-path logic from `index.js:17-39`:

async function findTshark() {
  try {
    const tsharkPath = await which('tshark');
    return tsharkPath;
  } catch (err) {
    const fallbacks = process.platform === 'win32'
      ? ['C:\\Program Files\\Wireshark\\tshark.exe', 'C:\\Program Files (x86)\\Wireshark\\tshark.exe']
      : ['/usr/bin/tshark', '/usr/local/bin/tshark', '/opt/homebrew/bin/tshark',
         '/Applications/Wireshark.app/Contents/MacOS/tshark'];
    for (const path of fallbacks) {
      try {
        await execAsync(`${path} -v`);
        return path;
      } catch (e) { /* try next */ }
    }
    throw new Error('tshark not found. Please install Wireshark ...');
  }
}

PATH augmentation for tshark invocation from `index.js:64`:

{ env: { ...process.env, PATH: `${process.env.PATH}:/usr/bin:/usr/local/bin:/opt/homebrew/bin` } }

Common Errors

Error Message Cause Solution
`tshark not found. Please install Wireshark` tshark not on PATH or any fallback location Install Wireshark from https://www.wireshark.org/download.html and ensure tshark is in PATH
`The capture device could not be opened on interface 'en0'` Insufficient capture privileges Run with `sudo` or grant `CAP_NET_RAW` (Linux); run terminal as admin (Windows/macOS)
`tshark: "io,phs" is not a valid ...` Older tshark version Upgrade to Wireshark/tshark >= 3.0
`tshark stderr: ...` (non-fatal) tshark emitted warnings to stderr Usually harmless; logged via `console.error` and processing continues

Compatibility Notes

  • Linux: Live capture requires root or `CAP_NET_RAW`. PCAP file analysis works unprivileged.
  • macOS: tshark lives inside the Wireshark.app bundle if installed via the official installer; Homebrew Cask install places a symlink in PATH. Both are covered by fallback paths.
  • Windows: Requires Wireshark installer; tshark.exe is not on PATH by default — `findTshark` checks `C:\Program Files\Wireshark\tshark.exe`.
  • tshark version: The `-T json` output format and `-qz io,phs`/`-qz conv,tcp` stats are stable from tshark 3.0+. Kerberos field names (`kerberos.CNameString`, `kerberos.cipher`, etc.) are available from tshark 3.0+.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment