Skip to content
matcgoPublic

About

a tool used to resolve pcap fiels and record packet information in markdown format.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pkt2md

Convert pcap/pcapng network captures to Markdown — designed for AI-assisted traffic analysis.

pkt2md capture.pcap
# → capture_pkt2md.md

Why

Wireshark is great for humans. pkt2md produces structured Markdown that is easy for LLMs to read and reason about: summary statistics, protocol distribution, anomaly indicators, and per-packet details in a flat, hierarchical format that fits naturally in a prompt or document.

Features

  • No system dependencies — pure Go, no libpcap, no CGO; single static binary
  • pcap and pcapng support
  • Application layer decoding: HTTP, DNS, NTP, SIP, TLS (SNI + JA3 fingerprint)
  • Anomaly indicators: repeated IP IDs, fixed-TTL source groups, duplicate payloads (MD5)
  • Software filter — BPF-style expressions without libpcap (tcp port 80, host 1.2.3.4, …)
  • Protocol filter — output only specific app-layer protocols (--proto http,dns)
  • Structured output: summary table → protocol distribution → top-N IPs/ports → anomalies → per-packet details

Install

go install github.com/matcgo/pkt2md@latest

Or build from source:

git clone https://github.com/matcgo/pkt2md
cd pkt2md
go build -o pkt2md .

Usage

pkt2md [options] <file.pcap|file.pcapng>

Options:
  -o <path>         Output file (default: <pcap-basename>_pkt2md.md in current dir)
  -n <count>        Maximum packets to parse (default: 10000)
  -filter <expr>    Filter expression (see below)
  -proto <list>     Comma-separated app protocols to include (http, dns, tls, sip, ntp)

Examples

# Basic usage
pkt2md capture.pcap

# Only HTTP and DNS traffic
pkt2md --proto http,dns capture.pcap

# TCP traffic to port 443, max 5000 packets
pkt2md -filter "tcp port 443" -n 5000 -o tls_traffic.md capture.pcap

# Filter by host
pkt2md -filter "host 192.168.1.1" capture.pcap

Filter Expressions

Expression Matches
tcp TCP packets
udp UDP packets
icmp / icmpv6 ICMP packets
port 80 src or dst port 80
src port 443 source port 443
dst port 53 destination port 53
host 1.2.3.4 src or dst IP
src host 10.0.0.1 source IP
tcp port 8080 TCP on port 8080

Output Format

# pkt2md Report: capture.pcap

## Summary
- Total packets in file: 15234
- Parsed packets: 10000
- Time range: 2024-01-01 10:00:00 → 2024-01-01 10:05:23

### Protocol Distribution
| Protocol | Count | Ratio |
|----------|-------|-------|
| TCP      | 8500  | 85.0% |
| UDP      | 1200  | 12.0% |

### Top Source IPs
...

### Anomaly Indicators

#### Repeated IP IDs
| IP ID  | Count | Packet Indexes |
|--------|-------|----------------|
| 0x1234 | 5     | #1, #45, #102, #300, #881 |

---

## Packets

### Packet #1 — 2024-01-01 10:00:00.123456
- **IP** src=1.2.3.4 dst=5.6.7.8 proto=TCP ttl=64 id=0x1234 len=120
- **TCP** sport=54321 dport=443 flags=SYN seq=1000000 ack=0 datalen=0
- **TLS** Version=TLS1.2 SNI=example.com JA3=abc123...

Application Layer Decoding

Protocol Detection Fields
HTTP port 80/8080/8000 or payload prefix Method, Host, URI, Status-Code, Content-Type, User-Agent
DNS port 53 or wire format Transaction ID, Query/Response, Query Name, Query Type, Answers
TLS port 443/8443 or 0x16 0x03 magic Record Type, Version, SNI, Cipher Suites, JA3 fingerprint
SIP port 5060/5061 or SIP/ prefix Method/Response, From, To, Call-ID, Via
NTP port 123 + 48-byte UDP Mode, Version, Stratum, Reference ID, Transmit Timestamp

Protocol detection falls back to payload feature matching for non-standard ports.

License

MIT

About

a tool used to resolve pcap fiels and record packet information in markdown format.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages