Index of every page on this site: llms.txt
All skills
wshobson avatar

/protocol-reverse-engineering

@4220308
by Seth Hobsonwshobson/agents43k stars
4,518
Run it yourself

Master network protocol reverse engineering including packet analysis, protocol dissection, and custom protocol documentation. Use when analyzing network traffic, understanding proprietary protocols, or debugging network communication.

Use this Skill: https://skilld.dev/gh/wshobson/agents/protocol-reverse-engineering

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesbinary-encryption-analysis.md

≈1.2k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Binary Protocol Analysis

Structure Identification

# Common patterns in binary protocols

# Length-prefixed message
struct Message {
    uint32_t length;      # Payload length (excludes header)
    uint16_t msg_type;    # Message type identifier
    uint8_t  flags;       # Flags/options
    uint8_t  reserved;    # Padding/alignment
    uint8_t  payload[];   # Variable-length payload
};

# Type-Length-Value (TLV)
struct TLV {
    uint8_t  type;        # Field type
    uint16_t length;      # Field length
    uint8_t  value[];     # Field data
};

# Fixed header + variable payload
struct Packet {
    uint8_t  magic[4];    # "ABCD" signature
    uint32_t version;
    uint32_t payload_len;
    uint32_t checksum;    # CRC32 or similar
    uint8_t  payload[];
};

Python Protocol Parser

import struct
from dataclasses import dataclass

@dataclass
class MessageHeader:
    magic: bytes
    version: int
    msg_type: int
    length: int

    @classmethod
    def from_bytes(cls, data: bytes):
        magic, version, msg_type, length = struct.unpack(
            ">4sHHI", data[:12]
        )
        return cls(magic, version, msg_type, length)

def parse_messages(data: bytes):
    offset = 0
    messages = []

    while offset < len(data):
        if len(data) - offset < 12:
            raise ValueError("truncated message header")
        header = MessageHeader.from_bytes(data[offset:])
        if header.length > len(data) - offset - 12:
            raise ValueError("truncated message payload")
        payload = data[offset+12:offset+12+header.length]
        messages.append((header, payload))
        offset += 12 + header.length

    return messages

# Parse TLV structure
def parse_tlv(data: bytes):
    fields = []
    offset = 0

    while offset < len(data):
        if len(data) - offset < 3:
            raise ValueError("truncated TLV header")
        field_type = data[offset]
        length = struct.unpack(">H", data[offset+1:offset+3])[0]
        if length > len(data) - offset - 3:
            raise ValueError("truncated TLV value")
        value = data[offset+3:offset+3+length]
        fields.append((field_type, value))
        offset += 3 + length

    return fields

Hex Dump Analysis

def hexdump(data: bytes, width: int = 16):
    """Format binary data as hex dump."""
    lines = []
    for i in range(0, len(data), width):
        chunk = data[i:i+width]
        hex_part = ' '.join(f'{b:02x}' for b in chunk)
        ascii_part = ''.join(
            chr(b) if 32 <= b < 127 else '.'
            for b in chunk
        )
        lines.append(f'{i:08x}  {hex_part:<{width*3}}  {ascii_part}')
    return '\n'.join(lines)

# Example output:
# 00000000  48 54 54 50 2f 31 2e 31  20 32 30 30 20 4f 4b 0d  HTTP/1.1 200 OK.
# 00000010  0a 43 6f 6e 74 65 6e 74  2d 54 79 70 65 3a 20 74  .Content-Type: t

Encryption Analysis

Identifying Encryption

# Entropy analysis - high entropy suggests encryption/compression
import math
from collections import Counter

def entropy(data: bytes) -> float:
    if not data:
        return 0.0
    counter = Counter(data)
    probs = [count / len(data) for count in counter.values()]
    return -sum(p * math.log2(p) for p in probs)

# Entropy thresholds:
# < 6.0: Likely plaintext or structured data
# 6.0-7.5: Possibly compressed
# > 7.5: Likely encrypted or random

# Common encryption indicators
# - High, uniform entropy
# - No obvious structure or patterns
# - Length often multiple of block size (16 for AES)
# - Possible IV at start (16 bytes for AES-CBC)

TLS Analysis

These fields follow the TLS and X.509 display-filter references (JA3/JA3S requires Wireshark 3.6+).

# Extract TLS metadata
tshark -r capture.pcap -Y "tls.handshake" \
    -T fields -e ip.src -e tls.handshake.ciphersuite

# JA3 fingerprinting (client)
tshark -r capture.pcap -Y "tls.handshake.type == 1" \
    -T fields -e tls.handshake.ja3

# JA3S fingerprinting (server)
tshark -r capture.pcap -Y "tls.handshake.type == 2" \
    -T fields -e tls.handshake.ja3s

# Certificate name/attribute strings. TLS 1.3 encrypts the certificate, so
# pass a key log (see Decryption Approaches below).
tshark -r capture.pcap -o tls.keylog_file:/tmp/keys.log \
    -Y "tls.handshake.certificate" -T fields -e x509sat.PrintableString

Decryption Approaches

# Pre-master secret log (browser)
export SSLKEYLOGFILE=/tmp/keys.log

# Configure Wireshark
# Edit > Preferences > Protocols > TLS
# (Pre)-Master-Secret log filename: /tmp/keys.log

# Decrypt with private key (if available)
# Only works for RSA key exchange
# Edit > Preferences > Protocols > TLS > RSA keys list

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

2 warnings1mo5 checks · Risk SAFE
  • Gen Agent Trust Hub1mo

    This skill provides tools and techniques for network protocol reverse engineering. While the content is educational and uses industry-standard tools, the inherent capability to capture and inject network traffic presents an indirect prompt injection surface when processing untrusted data.

  • Socket1mo

    1 alert: gptSecurity

  • Snyk1mo

    Risk: LOW · No issues

  • Runlayer8mo

    1/1 file flagged

  • ZeroLeaks7mo

    1 finding · Score: 86/100

Signed by skilld at 4220308. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 days ago.

Activeupdated last month
  • wireshark
  • tcpdump
  • packet-analysis
  • tshark
  • scapy
  • protocol-analysis
  • network-security
  • binary-protocols
  • reverse-engineering
  • mitmproxy

README badge

README badge for wshobson/agents/protocol-reverse-engineering

Analyzes network protocols through traffic capture, packet dissection, and binary protocol parsing using Wireshark, tcpdump, and Scapy. Includes techniques for identifying encryption, extracting TLS metadata, documenting custom protocols, and active testing with fuzzing and replay.

Generated from the current SKILL.md.

What tools does this skill cover?
The skill covers Wireshark, tcpdump, tshark, mitmproxy, Scapy, and Boofuzz for traffic capture, analysis, and protocol testing. It also includes examples for writing custom Wireshark dissectors in Lua and Python-based protocol parsers.
Can this skill help me reverse engineer encrypted protocols?
Yes. The skill includes techniques for identifying encryption via entropy analysis, extracting TLS metadata with tshark, JA3 fingerprinting, and decryption approaches using SSLKEYLOGFILE or RSA keys if available.
Does this cover binary protocol analysis?
Yes. The skill provides pattern identification for length-prefixed messages, Type-Length-Value structures, and includes Python code for parsing binary headers and hex dump utilities.
Can I use this to test a custom protocol I'm developing?
Yes. The skill includes active testing techniques with Boofuzz for fuzzing, packet replay and modification with Scapy, and a template for documenting custom protocol specifications.
Does this skill require specific prerequisites or languages?
Most examples use Python (Scapy, struct module) and Lua (for Wireshark dissectors), but the CLI tools like Wireshark and tcpdump work independently. Basic understanding of TCP/IP and binary formats is assumed.

Generated from the current SKILL.md. These answers refresh after source changes.