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.

referencesprotocol-documentation.md

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

Custom Protocol Documentation

Protocol Specification Template

# Protocol Name Specification

## Overview

Brief description of protocol purpose and design.

## Transport

- Layer: TCP/UDP
- Port: XXXX
- Encryption: TLS for TCP; DTLS for UDP (specify the negotiated protocol version)

## Message Format

### Header (12 bytes)

| Offset | Size | Field   | Description             |
| ------ | ---- | ------- | ----------------------- |
| 0      | 4    | Magic   | 0x50524F54 ("PROT")     |
| 4      | 2    | Version | Protocol version (1)    |
| 6      | 2    | Type    | Message type identifier |
| 8      | 4    | Length  | Payload length in bytes |

### Message Types

| Type | Name      | Description            |
| ---- | --------- | ---------------------- |
| 0x01 | HELLO     | Connection initiation  |
| 0x02 | HELLO_ACK | Connection accepted    |
| 0x03 | DATA      | Application data       |
| 0x04 | CLOSE     | Connection termination |

### Type 0x01: HELLO

| Offset | Size | Field      | Description              |
| ------ | ---- | ---------- | ------------------------ |
| 0      | 4    | ClientID   | Unique client identifier |
| 4      | 2    | Flags      | Connection flags         |
| 6      | var  | Extensions | TLV-encoded extensions   |

## State Machine
```

[INIT] --HELLO--> [WAIT_ACK] --HELLO_ACK--> [CONNECTED]
[CONNECTED] --DATA--> [CONNECTED]
[CONNECTED] --CLOSE--> [CLOSED]

```

## Examples
### Connection Establishment
```

Client -> Server: HELLO (ClientID=0x12345678)
Server -> Client: HELLO_ACK (Status=OK)
Client -> Server: DATA (payload)

```

Wireshark Dissector (Lua)

Use Wireshark's TCP PDU helper for fragmented headers/payloads and multiple messages per segment. TCP desegmentation must be enabled; a capture missing bytes cannot be repaired by the dissector.

-- custom_protocol.lua
local proto = Proto("custom", "Custom Protocol")

-- Define fields
local f_magic = ProtoField.string("custom.magic", "Magic")
local f_version = ProtoField.uint16("custom.version", "Version")
local f_type = ProtoField.uint16("custom.type", "Type")
local f_length = ProtoField.uint32("custom.length", "Length")
local f_payload = ProtoField.bytes("custom.payload", "Payload")

proto.fields = { f_magic, f_version, f_type, f_length, f_payload }

-- Message type names
local msg_types = {
    [0x01] = "HELLO",
    [0x02] = "HELLO_ACK",
    [0x03] = "DATA",
    [0x04] = "CLOSE"
}

local function dissect_pdu(buffer, pinfo, tree)
    -- Reject incomplete captures before creating any packet ranges.
    if buffer:len() < 12 or buffer(0, 4):string() ~= "PROT" then return 0 end
    local length = buffer(8, 4):uint()
    if length > buffer:len() - 12 then return 0 end

    pinfo.cols.protocol = "CUSTOM"

    local subtree = tree:add(proto, buffer())

    -- Parse header
    subtree:add(f_magic, buffer(0, 4))
    subtree:add(f_version, buffer(4, 2))

    local msg_type = buffer(6, 2):uint()
    subtree:add(f_type, buffer(6, 2)):append_text(
        " (" .. (msg_types[msg_type] or "Unknown") .. ")"
    )

    subtree:add(f_length, buffer(8, 4))

    if length > 0 then
        subtree:add(f_payload, buffer(12, length))
    end
    return buffer:len()
end

-- Set this to the largest payload the protocol allows.
local MAX_PAYLOAD = 65536

-- The helper requests missing TCP bytes and invokes dissect_pdu for every PDU.
local function get_pdu_length(buffer, pinfo, offset)
    local length = buffer(offset + 8, 4):uint()
    -- For an impossible length, return only the header size, so the helper
    -- does not wait for bytes that never arrive and dissect_pdu rejects it.
    if length > MAX_PAYLOAD then return 12 end
    return 12 + length
end

function proto.dissector(buffer, pinfo, tree)
    -- Leave traffic that does not start with the magic to other dissectors.
    if buffer:len() < 4 or buffer(0, 4):string() ~= "PROT" then return 0 end
    dissect_tcp_pdus(buffer, tree, 12, get_pdu_length, dissect_pdu, true)
end

-- Register for TCP port
local tcp_table = DissectorTable.get("tcp.port")
tcp_table:add(8888, proto)

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.