[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M77VH5ZSWC0FBT5MFXFJNXP4":3,"skill-same:01M77VH5ZSWC0FBT5MFXFJNXP4":46},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M77VH5ZSWC0FBT5MFXFJNXP4","protocol-reverse-engineering",null,"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.","Reihantt6\u002Fsns-myagent","Reihantt6","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F219822095?v=4","01M77KK94PV8B7C2D9XWXNS8DJ","Mohamad Reihan tegar prasetya","01M77KK958QFMTHYXGXFV7KZ79",2,"MIT","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fprotocol-reverse-engineering\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\ndescription: \"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.\"\n---\n# Protocol Reverse Engineering\n\nComprehensive techniques for capturing, analyzing, and documenting network protocols for security research, interoperability, and debugging.\n\n## Traffic Capture\n\n### Wireshark Capture\n\n```bash\n# Capture on specific interface\nwireshark -i eth0 -k\n\n# Capture with filter\nwireshark -i eth0 -k -f \"port 443\"\n\n# Capture to file\ntshark -i eth0 -w capture.pcap\n\n# Ring buffer capture (rotate files)\ntshark -i eth0 -b filesize:100000 -b files:10 -w capture.pcap\n```\n\n### tcpdump Capture\n\n```bash\n# Basic capture\ntcpdump -i eth0 -w capture.pcap\n\n# With filter\ntcpdump -i eth0 port 8080 -w capture.pcap\n\n# Capture specific bytes\ntcpdump -i eth0 -s 0 -w capture.pcap  # Full packet\n\n# Real-time display\ntcpdump -i eth0 -X port 80\n```\n\n### Man-in-the-Middle Capture\n\n```bash\n# mitmproxy for HTTP\u002FHTTPS\nmitmproxy --mode transparent -p 8080\n\n# SSL\u002FTLS interception\nmitmproxy --mode transparent --ssl-insecure\n\n# Dump to file\nmitmdump -w traffic.mitm\n\n# Burp Suite\n# Configure browser proxy to 127.0.0.1:8080\n```\n\n## Protocol Analysis\n\n### Wireshark Analysis\n\n```\n# Display filters\ntcp.port == 8080\nhttp.request.method == \"POST\"\nip.addr == 192.168.1.1\ntcp.flags.syn == 1 && tcp.flags.ack == 0\nframe contains \"password\"\n\n# Following streams\nRight-click > Follow > TCP Stream\nRight-click > Follow > HTTP Stream\n\n# Export objects\nFile > Export Objects > HTTP\n\n# Decryption\nEdit > Preferences > Protocols > TLS\n  - (Pre)-Master-Secret log filename\n  - RSA keys list\n```\n\n### tshark Analysis\n\n```bash\n# Extract specific fields\ntshark -r capture.pcap -T fields -e ip.src -e ip.dst -e tcp.port\n\n# Statistics\ntshark -r capture.pcap -q -z conv,tcp\ntshark -r capture.pcap -q -z endpoints,ip\n\n# Filter and extract\ntshark -r capture.pcap -Y \"http\" -T json > http_traffic.json\n\n# Protocol hierarchy\ntshark -r capture.pcap -q -z io,phs\n```\n\n### Scapy for Custom Analysis\n\n```python\nfrom scapy.all import *\n\n# Read pcap\npackets = rdpcap(\"capture.pcap\")\n\n# Analyze packets\nfor pkt in packets:\n    if pkt.haslayer(TCP):\n        print(f\"Src: {pkt[IP].src}:{pkt[TCP].sport}\")\n        print(f\"Dst: {pkt[IP].dst}:{pkt[TCP].dport}\")\n        if pkt.haslayer(Raw):\n            print(f\"Data: {pkt[Raw].load[:50]}\")\n\n# Filter packets\nhttp_packets = [p for p in packets if p.haslayer(TCP)\n                and (p[TCP].sport == 80 or p[TCP].dport == 80)]\n\n# Create custom packets\npkt = IP(dst=\"target\")\u002FTCP(dport=80)\u002FRaw(load=\"GET \u002F HTTP\u002F1.1\\r\\n\")\nsend(pkt)\n```\n\n## Protocol Identification\n\n### Common Protocol Signatures\n\n```\nHTTP        - \"HTTP\u002F1.\" or \"GET \" or \"POST \" at start\nTLS\u002FSSL     - 0x16 0x03 (record layer)\nDNS         - UDP port 53, specific header format\nSMB         - 0xFF 0x53 0x4D 0x42 (\"SMB\" signature)\nSSH         - \"SSH-2.0\" banner\nFTP         - \"220 \" response, \"USER \" command\nSMTP        - \"220 \" banner, \"EHLO\" command\nMySQL       - 0x00 length prefix, protocol version\nPostgreSQL  - 0x00 0x00 0x00 startup length\nRedis       - \"*\" RESP array prefix\nMongoDB     - BSON documents with specific header\n```\n\n### Protocol Header Patterns\n\n```\n+--------+--------+--------+--------+\n|  Magic number \u002F Signature         |\n+--------+--------+--------+--------+\n|  Version       |  Flags          |\n+--------+--------+--------+--------+\n|  Length        |  Message Type   |\n+--------+--------+--------+--------+\n|  Sequence Number \u002F Session ID     |\n+--------+--------+--------+--------+\n|  Payload...                       |\n+--------+--------+--------+--------+\n```\n\n## Binary Protocol Analysis\n\n### Structure Identification\n\n```python\n# Common patterns in binary protocols\n\n# Length-prefixed message\nstruct Message {\n    uint32_t length;      # Total message length\n    uint16_t msg_type;    # Message type identifier\n    uint8_t  flags;       # Flags\u002Foptions\n    uint8_t  reserved;    # Padding\u002Falignment\n    uint8_t  payload[];   # Variable-length payload\n};\n\n# Type-Length-Value (TLV)\nstruct TLV {\n    uint8_t  type;        # Field type\n    uint16_t length;      # Field length\n    uint8_t  value[];     # Field data\n};\n\n# Fixed header + variable payload\nstruct Packet {\n    uint8_t  magic[4];    # \"ABCD\" signature\n    uint32_t version;\n    uint32_t payload_len;\n    uint32_t checksum;    # CRC32 or similar\n    uint8_t  payload[];\n};\n```\n\n### Python Protocol Parser\n\n```python\nimport struct\nfrom dataclasses import dataclass\n\n@dataclass\nclass MessageHeader:\n    magic: bytes\n    version: int\n    msg_type: int\n    length: int\n\n    @classmethod\n    def from_bytes(cls, data: bytes):\n        magic, version, msg_type, length = struct.unpack(\n            \">4sHHI\", data[:12]\n        )\n        return cls(magic, version, msg_type, length)\n\ndef parse_messages(data: bytes):\n    offset = 0\n    messages = []\n\n    while offset \u003C len(data):\n        header = MessageHeader.from_bytes(data[offset:])\n        payload = data[offset+12:offset+12+header.length]\n        messages.append((header, payload))\n        offset += 12 + header.length\n\n    return messages\n\n# Parse TLV structure\ndef parse_tlv(data: bytes):\n    fields = []\n    offset = 0\n\n    while offset \u003C len(data):\n        field_type = data[offset]\n        length = struct.unpack(\">H\", data[offset+1:offset+3])[0]\n        value = data[offset+3:offset+3+length]\n        fields.append((field_type, value))\n        offset += 3 + length\n\n    return fields\n```\n\n### Hex Dump Analysis\n\n```python\ndef hexdump(data: bytes, width: int = 16):\n    \"\"\"Format binary data as hex dump.\"\"\"\n    lines = []\n    for i in range(0, len(data), width):\n        chunk = data[i:i+width]\n        hex_part = ' '.join(f'{b:02x}' for b in chunk)\n        ascii_part = ''.join(\n            chr(b) if 32 \u003C= b \u003C 127 else '.'\n            for b in chunk\n        )\n        lines.append(f'{i:08x}  {hex_part:\u003C{width*3}}  {ascii_part}')\n    return '\\n'.join(lines)\n\n# Example output:\n# 00000000  48 54 54 50 2f 31 2e 31  20 32 30 30 20 4f 4b 0d  HTTP\u002F1.1 200 OK.\n# 00000010  0a 43 6f 6e 74 65 6e 74  2d 54 79 70 65 3a 20 74  .Content-Type: t\n```\n\n## Encryption Analysis\n\n### Identifying Encryption\n\n```python\n# Entropy analysis - high entropy suggests encryption\u002Fcompression\nimport math\nfrom collections import Counter\n\ndef entropy(data: bytes) -> float:\n    if not data:\n        return 0.0\n    counter = Counter(data)\n    probs = [count \u002F len(data) for count in counter.values()]\n    return -sum(p * math.log2(p) for p in probs)\n\n# Entropy thresholds:\n# \u003C 6.0: Likely plaintext or structured data\n# 6.0-7.5: Possibly compressed\n# > 7.5: Likely encrypted or random\n\n# Common encryption indicators\n# - High, uniform entropy\n# - No obvious structure or patterns\n# - Length often multiple of block size (16 for AES)\n# - Possible IV at start (16 bytes for AES-CBC)\n```\n\n### TLS Analysis\n\n```bash\n# Extract TLS metadata\ntshark -r capture.pcap -Y \"ssl.handshake\" \\\n    -T fields -e ip.src -e ssl.handshake.ciphersuite\n\n# JA3 fingerprinting (client)\ntshark -r capture.pcap -Y \"ssl.handshake.type == 1\" \\\n    -T fields -e ssl.handshake.ja3\n\n# JA3S fingerprinting (server)\ntshark -r capture.pcap -Y \"ssl.handshake.type == 2\" \\\n    -T fields -e ssl.handshake.ja3s\n\n# Certificate extraction\ntshark -r capture.pcap -Y \"ssl.handshake.certificate\" \\\n    -T fields -e x509sat.printableString\n```\n\n### Decryption Approaches\n\n```bash\n# Pre-master secret log (browser)\nexport SSLKEYLOGFILE=\u002Ftmp\u002Fkeys.log\n\n# Configure Wireshark\n# Edit > Preferences > Protocols > TLS\n# (Pre)-Master-Secret log filename: \u002Ftmp\u002Fkeys.log\n\n# Decrypt with private key (if available)\n# Only works for RSA key exchange\n# Edit > Preferences > Protocols > TLS > RSA keys list\n```\n\n## Custom Protocol Documentation\n\n### Protocol Specification Template\n\n```markdown\n# Protocol Name Specification\n\n## Overview\n\nBrief description of protocol purpose and design.\n\n## Transport\n\n- Layer: TCP\u002FUDP\n- Port: XXXX\n- Encryption: TLS 1.2+\n\n## Message Format\n\n### Header (12 bytes)\n\n| Offset | Size | Field   | Description             |\n| ------ | ---- | ------- | ----------------------- |\n| 0      | 4    | Magic   | 0x50524F54 (\"PROT\")     |\n| 4      | 2    | Version | Protocol version (1)    |\n| 6      | 2    | Type    | Message type identifier |\n| 8      | 4    | Length  | Payload length in bytes |\n\n### Message Types\n\n| Type | Name      | Description            |\n| ---- | --------- | ---------------------- |\n| 0x01 | HELLO     | Connection initiation  |\n| 0x02 | HELLO_ACK | Connection accepted    |\n| 0x03 | DATA      | Application data       |\n| 0x04 | CLOSE     | Connection termination |\n\n### Type 0x01: HELLO\n\n| Offset | Size | Field      | Description              |\n| ------ | ---- | ---------- | ------------------------ |\n| 0      | 4    | ClientID   | Unique client identifier |\n| 4      | 2    | Flags      | Connection flags         |\n| 6      | var  | Extensions | TLV-encoded extensions   |\n\n## State Machine\n```\n\n[INIT] --HELLO--> [WAIT_ACK] --HELLO_ACK--> [CONNECTED]\n|\nDATA\u002FDATA\n|\n[CLOSED] \u003C--CLOSE--+\n\n```\n\n## Examples\n### Connection Establishment\n```\n\nClient -> Server: HELLO (ClientID=0x12345678)\nServer -> Client: HELLO_ACK (Status=OK)\nClient -> Server: DATA (payload)\n\n```\n\n```\n\n### Wireshark Dissector (Lua)\n\n```lua\n-- custom_protocol.lua\nlocal proto = Proto(\"custom\", \"Custom Protocol\")\n\n-- Define fields\nlocal f_magic = ProtoField.string(\"custom.magic\", \"Magic\")\nlocal f_version = ProtoField.uint16(\"custom.version\", \"Version\")\nlocal f_type = ProtoField.uint16(\"custom.type\", \"Type\")\nlocal f_length = ProtoField.uint32(\"custom.length\", \"Length\")\nlocal f_payload = ProtoField.bytes(\"custom.payload\", \"Payload\")\n\nproto.fields = { f_magic, f_version, f_type, f_length, f_payload }\n\n-- Message type names\nlocal msg_types = {\n    [0x01] = \"HELLO\",\n    [0x02] = \"HELLO_ACK\",\n    [0x03] = \"DATA\",\n    [0x04] = \"CLOSE\"\n}\n\nfunction proto.dissector(buffer, pinfo, tree)\n    pinfo.cols.protocol = \"CUSTOM\"\n\n    local subtree = tree:add(proto, buffer())\n\n    -- Parse header\n    subtree:add(f_magic, buffer(0, 4))\n    subtree:add(f_version, buffer(4, 2))\n\n    local msg_type = buffer(6, 2):uint()\n    subtree:add(f_type, buffer(6, 2)):append_text(\n        \" (\" .. (msg_types[msg_type] or \"Unknown\") .. \")\"\n    )\n\n    local length = buffer(8, 4):uint()\n    subtree:add(f_length, buffer(8, 4))\n\n    if length > 0 then\n        subtree:add(f_payload, buffer(12, length))\n    end\nend\n\n-- Register for TCP port\nlocal tcp_table = DissectorTable.get(\"tcp.port\")\ntcp_table:add(8888, proto)\n```\n\n## Active Testing\n\n### Fuzzing with Boofuzz\n\n```python\nfrom boofuzz import *\n\ndef main():\n    session = Session(\n        target=Target(\n            connection=TCPSocketConnection(\"target\", 8888)\n        )\n    )\n\n    # Define protocol structure\n    s_initialize(\"HELLO\")\n    s_static(b\"\\x50\\x52\\x4f\\x54\")  # Magic\n    s_word(1, name=\"version\")       # Version\n    s_word(0x01, name=\"type\")       # Type (HELLO)\n    s_size(\"payload\", length=4)     # Length field\n    s_block_start(\"payload\")\n    s_dword(0x12345678, name=\"client_id\")\n    s_word(0, name=\"flags\")\n    s_block_end()\n\n    session.connect(s_get(\"HELLO\"))\n    session.fuzz()\n\nif __name__ == \"__main__\":\n    main()\n```\n\n### Replay and Modification\n\n```python\nfrom scapy.all import *\n\n# Replay captured traffic\npackets = rdpcap(\"capture.pcap\")\nfor pkt in packets:\n    if pkt.haslayer(TCP) and pkt[TCP].dport == 8888:\n        send(pkt)\n\n# Modify and replay\nfor pkt in packets:\n    if pkt.haslayer(Raw):\n        # Modify payload\n        original = pkt[Raw].load\n        modified = original.replace(b\"client\", b\"CLIENT\")\n        pkt[Raw].load = modified\n        # Recalculate checksums\n        del pkt[IP].chksum\n        del pkt[TCP].chksum\n        send(pkt)\n```\n\n## Best Practices\n\n### Analysis Workflow\n\n1. **Capture traffic**: Multiple sessions, different scenarios\n2. **Identify boundaries**: Message start\u002Fend markers\n3. **Map structure**: Fixed header, variable payload\n4. **Identify fields**: Compare multiple samples\n5. **Document format**: Create specification\n6. **Validate understanding**: Implement parser\u002Fgenerator\n7. **Test edge cases**: Fuzzing, boundary conditions\n\n### Common Patterns to Look For\n\n- Magic numbers\u002Fsignatures at message start\n- Version fields for compatibility\n- Length fields (often before variable data)\n- Type\u002Fopcode fields for message identification\n- Sequence numbers for ordering\n- Checksums\u002FCRCs for integrity\n- Timestamps for timing\n- Session\u002Fconnection identifiers\n","# Protocol Reverse Engineering\n\nComprehensive techniques for capturing, analyzing, and documenting network protocols for security research, interoperability, and debugging.\n\n## Traffic Capture\n\n### Wireshark Capture\n\n```bash\n# Capture on specific interface\nwireshark -i eth0 -k\n\n# Capture with filter\nwireshark -i eth0 -k -f \"port 443\"\n\n# Capture to file\ntshark -i eth0 -w capture.pcap\n\n# Ring buffer capture (rotate files)\ntshark -i eth0 -b filesize:100000 -b files:10 -w capture.pcap\n```\n\n### tcpdump Capture\n\n```bash\n# Basic capture\ntcpdump -i eth0 -w capture.pcap\n\n# With filter\ntcpdump -i eth0 port 8080 -w capture.pcap\n\n# Capture specific bytes\ntcpdump -i eth0 -s 0 -w capture.pcap  # Full packet\n\n# Real-time display\ntcpdump -i eth0 -X port 80\n```\n\n### Man-in-the-Middle Capture\n\n```bash\n# mitmproxy for HTTP\u002FHTTPS\nmitmproxy --mode transparent -p 8080\n\n# SSL\u002FTLS interception\nmitmproxy --mode transparent --ssl-insecure\n\n# Dump to file\nmitmdump -w traffic.mitm\n\n# Burp Suite\n# Configure browser proxy to 127.0.0.1:8080\n```\n\n## Protocol Analysis\n\n### Wireshark Analysis\n\n```\n# Display filters\ntcp.port == 8080\nhttp.request.method == \"POST\"\nip.addr == 192.168.1.1\ntcp.flags.syn == 1 && tcp.flags.ack == 0\nframe contains \"password\"\n\n# Following streams\nRight-click > Follow > TCP Stream\nRight-click > Follow > HTTP Stream\n\n# Export objects\nFile > Export Objects > HTTP\n\n# Decryption\nEdit > Preferences > Protocols > TLS\n  - (Pre)-Master-Secret log filename\n  - RSA keys list\n```\n\n### tshark Analysis\n\n```bash\n# Extract specific fields\ntshark -r capture.pcap -T fields -e ip.src -e ip.dst -e tcp.port\n\n# Statistics\ntshark -r capture.pcap -q -z conv,tcp\ntshark -r capture.pcap -q -z endpoints,ip\n\n# Filter and extract\ntshark -r capture.pcap -Y \"http\" -T json > http_traffic.json\n\n# Protocol hierarchy\ntshark -r capture.pcap -q -z io,phs\n```\n\n### Scapy for Custom Analysis\n\n```python\nfrom scapy.all import *\n\n# Read pcap\npackets = rdpcap(\"capture.pcap\")\n\n# Analyze packets\nfor pkt in packets:\n    if pkt.haslayer(TCP):\n        print(f\"Src: {pkt[IP].src}:{pkt[TCP].sport}\")\n        print(f\"Dst: {pkt[IP].dst}:{pkt[TCP].dport}\")\n        if pkt.haslayer(Raw):\n            print(f\"Data: {pkt[Raw].load[:50]}\")\n\n# Filter packets\nhttp_packets = [p for p in packets if p.haslayer(TCP)\n                and (p[TCP].sport == 80 or p[TCP].dport == 80)]\n\n# Create custom packets\npkt = IP(dst=\"target\")\u002FTCP(dport=80)\u002FRaw(load=\"GET \u002F HTTP\u002F1.1\\r\\n\")\nsend(pkt)\n```\n\n## Protocol Identification\n\n### Common Protocol Signatures\n\n```\nHTTP        - \"HTTP\u002F1.\" or \"GET \" or \"POST \" at start\nTLS\u002FSSL     - 0x16 0x03 (record layer)\nDNS         - UDP port 53, specific header format\nSMB         - 0xFF 0x53 0x4D 0x42 (\"SMB\" signature)\nSSH         - \"SSH-2.0\" banner\nFTP         - \"220 \" response, \"USER \" command\nSMTP        - \"220 \" banner, \"EHLO\" command\nMySQL       - 0x00 length prefix, protocol version\nPostgreSQL  - 0x00 0x00 0x00 startup length\nRedis       - \"*\" RESP array prefix\nMongoDB     - BSON documents with specific header\n```\n\n### Protocol Header Patterns\n\n```\n+--------+--------+--------+--------+\n|  Magic number \u002F Signature         |\n+--------+--------+--------+--------+\n|  Version       |  Flags          |\n+--------+--------+--------+--------+\n|  Length        |  Message Type   |\n+--------+--------+--------+--------+\n|  Sequence Number \u002F Session ID     |\n+--------+--------+--------+--------+\n|  Payload...                       |\n+--------+--------+--------+--------+\n```\n\n## Binary Protocol Analysis\n\n### Structure Identification\n\n```python\n# Common patterns in binary protocols\n\n# Length-prefixed message\nstruct Message {\n    uint32_t length;      # Total message length\n    uint16_t msg_type;    # Message type identifier\n    uint8_t  flags;       # Flags\u002Foptions\n    uint8_t  reserved;    # Padding\u002Falignment\n    uint8_t  payload[];   # Variable-length payload\n};\n\n# Type-Length-Value (TLV)\nstruct TLV {\n    uint8_t  type;        # Field type\n    uint16_t length;      # Field length\n    uint8_t  value[];     # Field data\n};\n\n# Fixed header + variable payload\nstruct Packet {\n    uint8_t  magic[4];    # \"ABCD\" signature\n    uint32_t version;\n    uint32_t payload_len;\n    uint32_t checksum;    # CRC32 or similar\n    uint8_t  payload[];\n};\n```\n\n### Python Protocol Parser\n\n```python\nimport struct\nfrom dataclasses import dataclass\n\n@dataclass\nclass MessageHeader:\n    magic: bytes\n    version: int\n    msg_type: int\n    length: int\n\n    @classmethod\n    def from_bytes(cls, data: bytes):\n        magic, version, msg_type, length = struct.unpack(\n            \">4sHHI\", data[:12]\n        )\n        return cls(magic, version, msg_type, length)\n\ndef parse_messages(data: bytes):\n    offset = 0\n    messages = []\n\n    while offset \u003C len(data):\n        header = MessageHeader.from_bytes(data[offset:])\n        payload = data[offset+12:offset+12+header.length]\n        messages.append((header, payload))\n        offset += 12 + header.length\n\n    return messages\n\n# Parse TLV structure\ndef parse_tlv(data: bytes):\n    fields = []\n    offset = 0\n\n    while offset \u003C len(data):\n        field_type = data[offset]\n        length = struct.unpack(\">H\", data[offset+1:offset+3])[0]\n        value = data[offset+3:offset+3+length]\n        fields.append((field_type, value))\n        offset += 3 + length\n\n    return fields\n```\n\n### Hex Dump Analysis\n\n```python\ndef hexdump(data: bytes, width: int = 16):\n    \"\"\"Format binary data as hex dump.\"\"\"\n    lines = []\n    for i in range(0, len(data), width):\n        chunk = data[i:i+width]\n        hex_part = ' '.join(f'{b:02x}' for b in chunk)\n        ascii_part = ''.join(\n            chr(b) if 32 \u003C= b \u003C 127 else '.'\n            for b in chunk\n        )\n        lines.append(f'{i:08x}  {hex_part:\u003C{width*3}}  {ascii_part}')\n    return '\\n'.join(lines)\n\n# Example output:\n# 00000000  48 54 54 50 2f 31 2e 31  20 32 30 30 20 4f 4b 0d  HTTP\u002F1.1 200 OK.\n# 00000010  0a 43 6f 6e 74 65 6e 74  2d 54 79 70 65 3a 20 74  .Content-Type: t\n```\n\n## Encryption Analysis\n\n### Identifying Encryption\n\n```python\n# Entropy analysis - high entropy suggests encryption\u002Fcompression\nimport math\nfrom collections import Counter\n\ndef entropy(data: bytes) -> float:\n    if not data:\n        return 0.0\n    counter = Counter(data)\n    probs = [count \u002F len(data) for count in counter.values()]\n    return -sum(p * math.log2(p) for p in probs)\n\n# Entropy thresholds:\n# \u003C 6.0: Likely plaintext or structured data\n# 6.0-7.5: Possibly compressed\n# > 7.5: Likely encrypted or random\n\n# Common encryption indicators\n# - High, uniform entropy\n# - No obvious structure or patterns\n# - Length often multiple of block size (16 for AES)\n# - Possible IV at start (16 bytes for AES-CBC)\n```\n\n### TLS Analysis\n\n```bash\n# Extract TLS metadata\ntshark -r capture.pcap -Y \"ssl.handshake\" \\\n    -T fields -e ip.src -e ssl.handshake.ciphersuite\n\n# JA3 fingerprinting (client)\ntshark -r capture.pcap -Y \"ssl.handshake.type == 1\" \\\n    -T fields -e ssl.handshake.ja3\n\n# JA3S fingerprinting (server)\ntshark -r capture.pcap -Y \"ssl.handshake.type == 2\" \\\n    -T fields -e ssl.handshake.ja3s\n\n# Certificate extraction\ntshark -r capture.pcap -Y \"ssl.handshake.certificate\" \\\n    -T fields -e x509sat.printableString\n```\n\n### Decryption Approaches\n\n```bash\n# Pre-master secret log (browser)\nexport SSLKEYLOGFILE=\u002Ftmp\u002Fkeys.log\n\n# Configure Wireshark\n# Edit > Preferences > Protocols > TLS\n# (Pre)-Master-Secret log filename: \u002Ftmp\u002Fkeys.log\n\n# Decrypt with private key (if available)\n# Only works for RSA key exchange\n# Edit > Preferences > Protocols > TLS > RSA keys list\n```\n\n## Custom Protocol Documentation\n\n### Protocol Specification Template\n\n```markdown\n# Protocol Name Specification\n\n## Overview\n\nBrief description of protocol purpose and design.\n\n## Transport\n\n- Layer: TCP\u002FUDP\n- Port: XXXX\n- Encryption: TLS 1.2+\n\n## Message Format\n\n### Header (12 bytes)\n\n| Offset | Size | Field   | Description             |\n| ------ | ---- | ------- | ----------------------- |\n| 0      | 4    | Magic   | 0x50524F54 (\"PROT\")     |\n| 4      | 2    | Version | Protocol version (1)    |\n| 6      | 2    | Type    | Message type identifier |\n| 8      | 4    | Length  | Payload length in bytes |\n\n### Message Types\n\n| Type | Name      | Description            |\n| ---- | --------- | ---------------------- |\n| 0x01 | HELLO     | Connection initiation  |\n| 0x02 | HELLO_ACK | Connection accepted    |\n| 0x03 | DATA      | Application data       |\n| 0x04 | CLOSE     | Connection termination |\n\n### Type 0x01: HELLO\n\n| Offset | Size | Field      | Description              |\n| ------ | ---- | ---------- | ------------------------ |\n| 0      | 4    | ClientID   | Unique client identifier |\n| 4      | 2    | Flags      | Connection flags         |\n| 6      | var  | Extensions | TLV-encoded extensions   |\n\n## State Machine\n```\n\n[INIT] --HELLO--> [WAIT_ACK] --HELLO_ACK--> [CONNECTED]\n|\nDATA\u002FDATA\n|\n[CLOSED] \u003C--CLOSE--+\n\n```\n\n## Examples\n### Connection Establishment\n```\n\nClient -> Server: HELLO (ClientID=0x12345678)\nServer -> Client: HELLO_ACK (Status=OK)\nClient -> Server: DATA (payload)\n\n```\n\n```\n\n### Wireshark Dissector (Lua)\n\n```lua\n-- custom_protocol.lua\nlocal proto = Proto(\"custom\", \"Custom Protocol\")\n\n-- Define fields\nlocal f_magic = ProtoField.string(\"custom.magic\", \"Magic\")\nlocal f_version = ProtoField.uint16(\"custom.version\", \"Version\")\nlocal f_type = ProtoField.uint16(\"custom.type\", \"Type\")\nlocal f_length = ProtoField.uint32(\"custom.length\", \"Length\")\nlocal f_payload = ProtoField.bytes(\"custom.payload\", \"Payload\")\n\nproto.fields = { f_magic, f_version, f_type, f_length, f_payload }\n\n-- Message type names\nlocal msg_types = {\n    [0x01] = \"HELLO\",\n    [0x02] = \"HELLO_ACK\",\n    [0x03] = \"DATA\",\n    [0x04] = \"CLOSE\"\n}\n\nfunction proto.dissector(buffer, pinfo, tree)\n    pinfo.cols.protocol = \"CUSTOM\"\n\n    local subtree = tree:add(proto, buffer())\n\n    -- Parse header\n    subtree:add(f_magic, buffer(0, 4))\n    subtree:add(f_version, buffer(4, 2))\n\n    local msg_type = buffer(6, 2):uint()\n    subtree:add(f_type, buffer(6, 2)):append_text(\n        \" (\" .. (msg_types[msg_type] or \"Unknown\") .. \")\"\n    )\n\n    local length = buffer(8, 4):uint()\n    subtree:add(f_length, buffer(8, 4))\n\n    if length > 0 then\n        subtree:add(f_payload, buffer(12, length))\n    end\nend\n\n-- Register for TCP port\nlocal tcp_table = DissectorTable.get(\"tcp.port\")\ntcp_table:add(8888, proto)\n```\n\n## Active Testing\n\n### Fuzzing with Boofuzz\n\n```python\nfrom boofuzz import *\n\ndef main():\n    session = Session(\n        target=Target(\n            connection=TCPSocketConnection(\"target\", 8888)\n        )\n    )\n\n    # Define protocol structure\n    s_initialize(\"HELLO\")\n    s_static(b\"\\x50\\x52\\x4f\\x54\")  # Magic\n    s_word(1, name=\"version\")       # Version\n    s_word(0x01, name=\"type\")       # Type (HELLO)\n    s_size(\"payload\", length=4)     # Length field\n    s_block_start(\"payload\")\n    s_dword(0x12345678, name=\"client_id\")\n    s_word(0, name=\"flags\")\n    s_block_end()\n\n    session.connect(s_get(\"HELLO\"))\n    session.fuzz()\n\nif __name__ == \"__main__\":\n    main()\n```\n\n### Replay and Modification\n\n```python\nfrom scapy.all import *\n\n# Replay captured traffic\npackets = rdpcap(\"capture.pcap\")\nfor pkt in packets:\n    if pkt.haslayer(TCP) and pkt[TCP].dport == 8888:\n        send(pkt)\n\n# Modify and replay\nfor pkt in packets:\n    if pkt.haslayer(Raw):\n        # Modify payload\n        original = pkt[Raw].load\n        modified = original.replace(b\"client\", b\"CLIENT\")\n        pkt[Raw].load = modified\n        # Recalculate checksums\n        del pkt[IP].chksum\n        del pkt[TCP].chksum\n        send(pkt)\n```\n\n## Best Practices\n\n### Analysis Workflow\n\n1. **Capture traffic**: Multiple sessions, different scenarios\n2. **Identify boundaries**: Message start\u002Fend markers\n3. **Map structure**: Fixed header, variable payload\n4. **Identify fields**: Compare multiple samples\n5. **Document format**: Create specification\n6. **Validate understanding**: Implement parser\u002Fgenerator\n7. **Test edge cases**: Fuzzing, boundary conditions\n\n### Common Patterns to Look For\n\n- Magic numbers\u002Fsignatures at message start\n- Version fields for compatibility\n- Length fields (often before variable data)\n- Type\u002Fopcode fields for message identification\n- Sequence numbers for ordering\n- Checksums\u002FCRCs for integrity\n- Timestamps for timing\n- Session\u002Fconnection identifiers\n",{"description":7},"main","58843b159d7a4050d6b785a98b908cce505c0b92","agent\u002Fskills\u002Fprotocol-reverse-engineering",0,"https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent","https:\u002F\u002Fgithub.com\u002FReihantt6","reihsns.web.id","2026-08-19 20:08:18",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add Reihantt6\u002Fsns-myagent --skill protocol-reverse-engineering",{"tool":38,"command":39},"bunx","bunx skills add Reihantt6\u002Fsns-myagent --skill protocol-reverse-engineering",{"tool":41,"command":42},"pnpm","pnpm dlx skills add Reihantt6\u002Fsns-myagent --skill protocol-reverse-engineering","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fprotocol-reverse-engineering\u002FSKILL.md",true,[],[47,54,61,68,75,82],{"skillNo":48,"name":49,"nameZh":6,"description":50,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":51,"categories":52,"keywords":53,"publishedAt":19},"01M77XDCYZ407XYMF2T4P6F7VT","youtube-transcript","Extract transcripts from YouTube videos. Use when the user asks for a transcript, subtitles, or captions of a YouTube video and provides a YouTube URL (youtube.com\u002Fwatch?v=, youtu.be\u002F, or similar). Supports output with or without timestamps.","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fyoutube-transcript\u002FSKILL.md",[],[],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":19},"01M77XD7PBC98J6MXGJJ2TJ8DX","youtube-thumbnail-design","YouTube thumbnail design with specific dimensions, contrast rules, and mobile preview optimization. Covers safe zones, text placement, face expression psychology, and A\u002FB testing. Use for: YouTube thumbnails, video cover images, click-through optimization. Triggers: youtube thumbnail, thumbnail design, video thumbnail, click through rate, ctr optimization, youtube cover, video cover image, thumbnail maker, thumbnail tips, youtube design, video preview image","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fyoutube-thumbnail-design\u002FSKILL.md",[],[],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":19},"01M77XD2541C8HXJ6RHYZP4NGJ","youtube-short-maker","Make YouTube Shorts that hold attention with Pexo — vertical 9:16, fast-paced, hook in the first 3 seconds. Describe your topic and Pexo writes the script, generates the shots, picks the models, and assembles a finished Short with music and captions. Use for YouTube Shorts: \"youtube short\", \"make a youtube short\", \"shorts video\", \"short-form video\". NOT for long-form or landscape video.","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fyoutube-short-maker\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":19},"01M77XCXKVSYK7KTZ3PQBVVGFD","xcode-project-setup","Safely modifies Xcode projects (.pbxproj) to add Swift Packages and link files. Use this skill whenever an iOS project needs dependencies installed (e.g. Firebase, Alamofire).","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fxcode-project-setup\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M77XCR1DV8ZQK2NHWKVY4EWX","x402","Set up Browser Use Cloud payments with x402 — pay per request from a crypto wallet (USDC on Base mainnet), no signup or API key. Two setups it works out up front — \"just use it\" (set up a wallet so you or Claude Code can run cloud browser tasks paid from the wallet — Claude writes and runs throwaway scripts, nothing touches your codebase) or \"build it in\" (install the SDK and write the key + code into your project). Walks through wallet setup, funding, .env, and a ~$1 test run. Use when the user asks about x402, pay-per-use, USDC payments, or wants Browser Use Cloud without an API key. For the free-tier signup (reverse-CAPTCHA → API key), use `browser-use cloud signup` or the `cloud` skill instead.","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fx402\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M77XCMD3R3ZBZQQSW6E0793B","x-twitter-scraper","Build GitHub Copilot workflows with Xquik X API SDKs, REST endpoints, hosted Apify Actor runs, MCP tools, TweetClaw OpenClaw plugin installs, signed webhooks, tweet search, user lookup, follower exports, media actions, and agent automation.","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fx-twitter-scraper\u002FSKILL.md",[],[]]