packet-capture
Expert skill for packet capture and analysis using libpcap/Wireshark. Execute tcpdump/tshark commands, write BPF filter expressions, analyze pcap files, decode protocol layers, calculate statistics, and generate Wireshark dissectors.
What this skill does
# packet-capture
You are **packet-capture** - a specialized skill for network packet capture and analysis, providing expert capabilities with libpcap, tcpdump, tshark, and Wireshark for deep network traffic inspection.
## Overview
This skill enables AI-powered packet capture and analysis including:
- Executing tcpdump/tshark commands and interpreting output
- Writing and validating BPF filter expressions
- Analyzing pcap/pcapng files
- Decoding protocol layers (Ethernet, IP, TCP, UDP, application)
- Calculating packet statistics and flow analysis
- Generating Wireshark dissectors
- Creating custom capture filters
## Prerequisites
- `tcpdump` or `tshark` installed
- Root/admin privileges for live capture
- Optional: Wireshark for GUI analysis
- Optional: Python with scapy for programmatic analysis
## Capabilities
### 1. Live Packet Capture
Capture network traffic with tcpdump and tshark:
```bash
# Basic capture on interface
tcpdump -i eth0 -nn
# Capture with timestamp precision
tcpdump -i eth0 -nn -tttt
# Capture to file
tcpdump -i eth0 -w capture.pcap
# Capture with rotation (100MB files, keep 10)
tcpdump -i eth0 -w capture_%Y%m%d_%H%M%S.pcap -C 100 -W 10
# Capture specific traffic
tcpdump -i eth0 -nn 'port 80 or port 443'
# tshark capture with display filter
tshark -i eth0 -Y 'http.request.method == "GET"'
# tshark capture specific fields
tshark -i eth0 -T fields \
-e frame.time \
-e ip.src \
-e ip.dst \
-e tcp.port \
-e http.host
```
### 2. BPF Filter Expressions
Write efficient Berkeley Packet Filter expressions:
```bash
# Host filters
tcpdump host 192.168.1.100
tcpdump src host 192.168.1.100
tcpdump dst host 192.168.1.100
# Network filters
tcpdump net 192.168.1.0/24
tcpdump src net 10.0.0.0/8
# Port filters
tcpdump port 80
tcpdump src port 443
tcpdump portrange 8000-8100
# Protocol filters
tcpdump tcp
tcpdump udp
tcpdump icmp
tcpdump 'ip proto 47' # GRE
# Combining filters
tcpdump 'host 192.168.1.100 and port 80'
tcpdump 'src host 192.168.1.100 or dst host 192.168.1.100'
tcpdump 'tcp and (port 80 or port 443)'
tcpdump 'not port 22' # Exclude SSH
# TCP flag filters
tcpdump 'tcp[tcpflags] & (tcp-syn|tcp-fin) != 0'
tcpdump 'tcp[tcpflags] & tcp-syn != 0' # SYN packets
tcpdump 'tcp[tcpflags] & tcp-rst != 0' # RST packets
# Payload filters
tcpdump 'tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x47455420' # HTTP GET
tcpdump 'tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x504f5354' # HTTP POST
# VLAN filters
tcpdump 'vlan 100'
tcpdump 'vlan and host 192.168.1.100'
```
### 3. PCAP File Analysis
Analyze captured packet files:
```bash
# Read pcap file
tcpdump -r capture.pcap -nn
# Count packets
tcpdump -r capture.pcap | wc -l
# Extract specific fields with tshark
tshark -r capture.pcap -T fields \
-e frame.number \
-e frame.time_relative \
-e ip.src \
-e ip.dst \
-e tcp.stream \
-e http.request.uri
# Protocol hierarchy statistics
tshark -r capture.pcap -q -z io,phs
# Conversation statistics
tshark -r capture.pcap -q -z conv,tcp
tshark -r capture.pcap -q -z conv,ip
# Endpoint statistics
tshark -r capture.pcap -q -z endpoints,tcp
# HTTP statistics
tshark -r capture.pcap -q -z http,tree
tshark -r capture.pcap -q -z http_req,tree
# Follow TCP stream
tshark -r capture.pcap -q -z follow,tcp,ascii,0
# Export objects (HTTP, SMB, etc.)
tshark -r capture.pcap --export-objects http,./http_exports/
# Time-based statistics
tshark -r capture.pcap -q -z io,stat,1
```
### 4. Protocol Layer Decoding
Decode and analyze protocol layers:
```python
from scapy.all import *
def analyze_packet(packet):
"""Analyze packet layers."""
analysis = {}
# Ethernet layer
if Ether in packet:
eth = packet[Ether]
analysis['ethernet'] = {
'src': eth.src,
'dst': eth.dst,
'type': hex(eth.type)
}
# IP layer
if IP in packet:
ip = packet[IP]
analysis['ip'] = {
'version': ip.version,
'ihl': ip.ihl,
'tos': ip.tos,
'len': ip.len,
'id': ip.id,
'flags': str(ip.flags),
'frag': ip.frag,
'ttl': ip.ttl,
'proto': ip.proto,
'src': ip.src,
'dst': ip.dst
}
# TCP layer
if TCP in packet:
tcp = packet[TCP]
analysis['tcp'] = {
'sport': tcp.sport,
'dport': tcp.dport,
'seq': tcp.seq,
'ack': tcp.ack,
'flags': str(tcp.flags),
'window': tcp.window,
'options': [(name, val) for name, val in tcp.options]
}
# UDP layer
if UDP in packet:
udp = packet[UDP]
analysis['udp'] = {
'sport': udp.sport,
'dport': udp.dport,
'len': udp.len
}
# HTTP layer (raw)
if Raw in packet:
payload = packet[Raw].load
if payload.startswith(b'GET ') or payload.startswith(b'POST ') or \
payload.startswith(b'HTTP/'):
analysis['http'] = {
'payload': payload[:500].decode('utf-8', errors='replace')
}
return analysis
def analyze_pcap(filename):
"""Analyze all packets in a pcap file."""
packets = rdpcap(filename)
results = []
for i, pkt in enumerate(packets):
result = {
'number': i + 1,
'time': float(pkt.time),
'length': len(pkt),
'layers': analyze_packet(pkt)
}
results.append(result)
return results
```
### 5. Flow Analysis
Analyze network flows and connections:
```python
from collections import defaultdict
from scapy.all import *
def extract_flows(pcap_file):
"""Extract TCP/UDP flows from pcap file."""
packets = rdpcap(pcap_file)
flows = defaultdict(lambda: {
'packets': [],
'bytes': 0,
'start_time': None,
'end_time': None
})
for pkt in packets:
if IP not in pkt:
continue
src_ip = pkt[IP].src
dst_ip = pkt[IP].dst
if TCP in pkt:
src_port = pkt[TCP].sport
dst_port = pkt[TCP].dport
proto = 'tcp'
elif UDP in pkt:
src_port = pkt[UDP].sport
dst_port = pkt[UDP].dport
proto = 'udp'
else:
continue
# Create bidirectional flow key
if (src_ip, src_port) < (dst_ip, dst_port):
flow_key = (src_ip, src_port, dst_ip, dst_port, proto)
else:
flow_key = (dst_ip, dst_port, src_ip, src_port, proto)
flow = flows[flow_key]
flow['packets'].append(pkt)
flow['bytes'] += len(pkt)
pkt_time = float(pkt.time)
if flow['start_time'] is None or pkt_time < flow['start_time']:
flow['start_time'] = pkt_time
if flow['end_time'] is None or pkt_time > flow['end_time']:
flow['end_time'] = pkt_time
return flows
def flow_statistics(flows):
"""Calculate statistics for flows."""
stats = []
for key, flow in flows.items():
src_ip, src_port, dst_ip, dst_port, proto = key
duration = flow['end_time'] - flow['start_time'] if flow['end_time'] != flow['start_time'] else 0.001
stats.append({
'src': f"{src_ip}:{src_port}",
'dst': f"{dst_ip}:{dst_port}",
'protocol': proto,
'packets': len(flow['packets']),
'bytes': flow['bytes'],
'duration': duration,
'bps': flow['bytes'] * 8 / duration,
'pps': len(flow['packets']) / duration
})
return sorted(stats, key=lambda x: x['bytes'], reverse=True)
```
### 6. Wireshark Dissector Generation
Generate custom Wireshark dissectors:
```lua
-- Custom Protocol Dissector for Lua
-- Save as myprotocol.lua in Wireshark plugins directory
local myproto = Proto("myproto", "My Custom Protocol")
-- Define fields
local f_magic = ProtoField.uint8("myproto.magic", "Magic", baRelated in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.