convez.ai
MCP ServerSegurançaIntermediário
higebu

dsct – Dissector de Pacotes para LLMs

higebu/dsct

Dissector de pacotes LLM-friendly com suporte a capturas gigantes

Ver no GitHub
InicialPluginScore · de 0 a 100

CLI de dissecção de pacotes otimizado para LLMs e capturas grandes, com saída JSONL estruturada e consumo de memória previsível. Inclui MCP server integrado para integração direta com agentes de IA, além de TUI opcional com memory-mapping para análise de arquivos pcap/pcapng de grande volume.

Instalação

$npx convez-ai higebu/dsct

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
0
Forks
1
Acompanhando
0
Saúde
42%
Último commit
há 20 horas
Versão
v0.3.2
Issues abertas
8
Contribuidores
3

Casos de uso

  • Análise de tráfego de rede com agentes de IA
  • Processamento de arquivos pcap/pcapng grandes com baixa memória
  • Extração estruturada de pacotes para pipelines de automação
  • Investigação forense de rede com ferramentas LLM

Veredito

Ferramenta especializada e bem-engineered para dissecção de pacotes em contextos de IA. A abordagem LLM-first com JSONL, MCP integrado e suporte eficiente a capturas grandes a torna valiosa para pesquisadores de segurança e engenheiros que precisam automatizar análise de tráfego.

README

A tradução para o português deste README ainda está na fila.

dsct

crates.io docs.rs MSRV CI codecov

dsct is a packet dissector CLI for LLMs and large captures.

It is built around two ideas:

  • machine-readable output by default
  • predictable memory use on big pcap / pcapng files

dsct read streams packet records as JSONL, dsct stats scans captures in a single pass, and the optional TUI opens large files with memory mapping and on-demand dissection instead of decoding the whole capture up front.

Why dsct

LLM-friendly by default

  • dsct read emits JSONL packet records
  • dsct stats, dsct list, dsct fields, dsct version, and dsct schema emit JSON
  • errors, warnings, and progress updates are structured JSON on stderr
  • capabilities and schemas can be discovered from the CLI itself

Works well on large captures

  • read and stats process captures one packet at a time
  • stdin is supported, so tcpdump -w - | dsct ... works naturally
  • no human-oriented table parsing is required before automation can start

MCP server built in

dsct mcp starts a Model Context Protocol server over stdio. AI agents can call tools like dsct_read_packets and dsct_get_stats directly, without shelling out to the CLI.

Low-memory TUI for large files

The optional TUI is designed for large captures too:

  • capture files are opened with memory-mapped I/O
  • indexing starts from packet headers instead of fully decoding every packet
  • packet list rows are dissected on demand for visible rows
  • the selected packet is decoded in detail only when needed
  • the hex view reads directly from the mapped file

Installation

CLI only:

cargo install dsct

With the optional TUI:

cargo install dsct --features tui
brew install higebu/tap/dsct

AI coding agent plugins

Install as a plugin via the marketplace to get the MCP server and the analyze-packets skill automatically:

Claude Code

claude plugin marketplace add higebu/dsct
claude plugin install dsct@dsct

GitHub Copilot CLI

copilot plugin marketplace add higebu/dsct
copilot plugin install dsct@dsct

OpenAI Codex CLI

Add the MCP server, then install the analyze-packets skill inside Codex:

codex mcp add dsct -- dsct mcp
$skill-installer higebu/dsct skills/analyze-packets

Gemini CLI

gemini extensions install https://github.com/higebu/dsct

Quick start

Get a capture overview:

dsct stats capture.pcap

Read packets as JSONL:

dsct read capture.pcap

By default, dsct read outputs at most 1 000 packets. Use --count to change the limit or --no-limit to remove it:

dsct read capture.pcap --count 50
dsct read capture.pcap --no-limit

Filter packets:

dsct read capture.pcap -f dns --count 10
dsct read capture.pcap -f "dns AND dns.qr = 'Query'"

Filter expressions use SQL syntax with AND, OR, NOT, parentheses, and comparison operators (=, !=, >, <, >=, <=):

dsct read capture.pcap -f "dns OR (tcp AND ipv4.src = '10.0.0.1')"
dsct read capture.pcap -f "tcp.dst_port > 1024 AND NOT dns"

Sample evenly across the capture:

dsct read capture.pcap --sample-rate 100
dsct read capture.pcap -f dns --sample-rate 10 --count 50

Read from a pipe:

tcpdump -w - -c 1000 | dsct read -
tcpdump -w - -i eth0 udp port 53 | dsct read - -f dns

Include the original packet bytes (link-layer included) as a hex string under raw_bytes for downstream parsing or reconstruction:

dsct read capture.pcap --raw-bytes --count 1

Speed up filter evaluation on large files with --threads:

dsct read capture.pcap -f "udp" --no-limit --threads 4
DSCT_THREADS=4 dsct read capture.pcap -f "tcp.dst_port > 1024" --no-limit

--threads distributes dissection and filter evaluation across N worker threads when the filter is stateless (L2–L4 protocols: tcp, udp, ipv4, etc.). Filters that require TCP reassembly such as http, dns, tls, and tcp.stream_id automatically fall back to sequential processing regardless of --threads. Stdin input always uses the sequential path.

Inspect available fields and schemas:

dsct fields dns
dsct schema read

Open the TUI for a large file (when built with --features tui):

dsct tui capture.pcap

In the TUI, press ? to open the built-in help overlay and q to quit.

Typical workflow

# 1. Discover supported protocols
dsct list

# 2. Inspect available filter fields
dsct fields dns

# 3. Read matching packets as JSONL
dsct read capture.pcap -f "dns AND dns.qr = 'Query'" --count 20

# 4. Get capture-wide statistics
dsct stats capture.pcap --top-talkers

Commands

CommandWhat it does
dsct read <FILE>Stream packet records as JSONL
dsct stats <FILE>Emit capture statistics as JSON
dsct listList supported protocols as JSON
dsct fields [PROTOCOL...]List filterable fields as JSON
dsct schema [COMMAND]Show JSON Schema for command output
dsct versionShow version and capability information as JSON
dsct mcpStart an MCP server over stdio
dsct tui <FILE>Open the interactive TUI for a capture file (tui feature only)

Run --help on any command for the full option list.

MCP tools

dsct mcp exposes the following tools over the Model Context Protocol:

ToolDescription
dsct_read_packetsDissect packets from a pcap/pcapng capture file. Returns an array of dissected packet objects with protocol layers and fields.
dsct_get_statsGet protocol statistics from a capture file. Returns packet counts, timing, protocol distribution, and optional deep analysis.
dsct_list_protocolsList all supported protocols with their specification references and layer information.
dsct_list_fieldsList available field names for protocols. Fields can be used with dsct_read_packets for filtering.
dsct_get_schemaGet the JSON schema for command output formats (read or stats).

Key parameters

dsct_read_packets: file (required), filter, count, offset, packet_number, decode_as, esp_sa, verbose

dsct_get_stats: file (required), protocol, top_talkers, stream_summary, top, decode_as, esp_sa

dsct_list_fields: protocol

dsct_get_schema: command ("read" or "stats")

Configuration example

Add dsct to your MCP client (e.g. Claude Desktop):

{
  "mcpServers": {
    "dsct": {
      "command": "dsct",
      "args": ["mcp"]
    }
  }
}

Default limits

When count is omitted, dsct_read_packets returns at most 1 000 packets (configurable via DSCT_MCP_DEFAULT_COUNT). dsct_get_stats processes the entire capture by default. All tool calls are subject to a per-execution timeout; on timeout the server returns a JSON-RPC error and no partial output is sent.

Environment variables

Resource limits can be tuned via environment variables:

VariableDefaultDescription
DSCT_MCP_DEFAULT_COUNT1000Default packet count when count is not specified
DSCT_MCP_TIMEOUT300Timeout per tool execution in seconds
DSCT_MCP_WRITE_BUFFER_SIZE65536Stdout write buffer size in bytes
DSCT_MCP_MAX_FILE_SIZE10737418240Maximum capture file size in bytes
DSCT_THREADSphysical CPU countWorker threads for dsct read --filter (see --threads)

Output

dsct read emits one JSON object per line:

{"number":1,"timestamp":"2024-01-15T10:30:00.123456Z","length":71,"original_length":71,"stack":"Ethernet:IPv4:UDP:DNS","layers":[{"protocol":"Ethernet","fields":{"dst":"ff:ff:ff:ff:ff:ff","src":"00:11:22:33:44:55","ethertype":2048,"ethertype_name":"IPv4"}},{"protocol":"IPv4","fields":{"ttl":64,"protocol":17,"src":"10.0.0.1","dst":"10.0.0.2"}},{"protocol":"UDP","fields":{"src_port":12345,"dst_port":53}},{"protocol":"DNS","fields":{"id":4660,"qr":0,"opcode":0,"rcode":0,"questions":[{"name":"example.com","type":1,"class":1}]}}]}

The other commands emit a single JSON object or array on stdout.

Supported protocols

The default build currently includes 50+ protocol dissectors across link, network, transport, tunneling, and application layers.

Use dsct list to see the exact protocol set in your build.

Errors

Errors and warnings are emitted as structured JSON on stderr.

Example:

{"error":{"code":"file_not_found","message":"failed to open capture file: test.pcap"}}

Exit codes:

CodeMeaning
0Success
1General error
2Invalid arguments
3File not found or permission denied
4Invalid capture format

License

Licensed under either of Apache License 2.0 or MIT License at your option.

Ver o original no GitHub

Bom para

Relacionados