protocol-reverse-engineering – skill Dữ liệu & Khoa học cho agent AI
Thành thạo kỹ thuật dịch ngược giao thức mạng, bao gồm phân tích gói tin, phân tách giao thức và tài liệu hóa giao thức tùy chỉnh. Dùng khi phân tích lưu lượng mạng, tìm hiểu giao thức độc quyền hoặc gỡ lỗi giao tiếp mạng.
Cài skill protocol-reverse-engineering bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/protocol-reverse-engineering-fcc29.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /protocol-reverse-engineering – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/protocol-reverse-engineering-fcc29.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $protocol-reverse-engineering – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/protocol-reverse-engineering-fcc29.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /protocol-reverse-engineering – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/protocol-reverse-engineering-fcc29.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /protocol-reverse-engineering – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
Protocol Reverse Engineering
Comprehensive techniques for capturing, analyzing, and documenting network protocols for security research, interoperability, and debugging.
Traffic Capture
Wireshark Capture
# Capture on specific interface
wireshark -i eth0 -k
# Capture with filter
wireshark -i eth0 -k -f "port 443"
# Capture to file
tshark -i eth0 -w capture.pcap
# Ring buffer capture (rotate files)
tshark -i eth0 -b filesize:100000 -b files:10 -w capture.pcaptcpdump Capture
# Basic capture
tcpdump -i eth0 -w capture.pcap
# With filter
tcpdump -i eth0 port 8080 -w capture.pcap
# Capture specific bytes
tcpdump -i eth0 -s 0 -w capture.pcap # Full packet
# Real-time display
tcpdump -i eth0 -X port 80Man-in-the-Middle Capture
# mitmproxy for HTTP/HTTPS
mitmproxy --mode transparent -p 8080
# SSL/TLS interception
mitmproxy --mode transparent --ssl-insecure
# Dump to file
mitmdump -w traffic.mitm
# Burp Suite
# Configure browser proxy to 127.0.0.1:8080Protocol Analysis
Wireshark Analysis
# Display filters
tcp.port == 8080
http.request.method == "POST"
ip.addr == 192.168.1.1
tcp.flags.syn == 1 && tcp.flags.ack == 0
frame contains "password"
# Following streams
Right-click > Follow > TCP Stream
Right-click > Follow > HTTP Stream
# Export objects
File > Export Objects > HTTP
# Decryption
Edit > Preferences > Protocols > TLS
- (Pre)-Master-Secret log filename
- RSA keys listtshark Analysis
# Extract specific fields
tshark -r capture.pcap -T fields -e ip.src -e ip.dst -e tcp.port
# Statistics
tshark -r capture.pcap -q -z conv,tcp
tshark -r capture.pcap -q -z endpoints,ip
# Filter and extract
tshark -r capture.pcap -Y "http" -T json > http_traffic.json
# Protocol hierarchy
tshark -r capture.pcap -q -z io,phsScapy for Custom Analysis
from scapy.all import *
# Read pcap
packets = rdpcap("capture.pcap")
# Analyze packets
for pkt in packets:
if pkt.haslayer(TCP):
print(f"Src: {pkt[IP].src}:{pkt[TCP].sport}")
print(f"Dst: {pkt[IP].dst}:{pkt[TCP].dport}")
if pkt.haslayer(Raw):
print(f"Data: {pkt[Raw].load[:50]}")
# Filter packets
http_packets = [p for p in packets if p.haslayer(TCP)
and (p[TCP].sport == 80 or p[TCP].dport == 80)]
# Create custom packets
pkt = IP(dst="target")/TCP(dport=80)/Raw(load="GET / HTTP/1.1\r\n")
send(pkt)Protocol Identification
Common Protocol Signatures
HTTP - "HTTP/1." or "GET " or "POST " at start
TLS/SSL - 0x16 0x03 (record layer)
DNS - UDP port 53, specific header format
SMB - 0xFF 0x53 0x4D 0x42 ("SMB" signature)
SSH - "SSH-2.0" banner
FTP - "220 " response, "USER " command
SMTP - "220 " banner, "EHLO" command
MySQL - 0x00 length prefix, protocol version
PostgreSQL - 0x00 0x00 0x00 startup length
Redis - "*" RESP array prefix
MongoDB - BSON documents with specific headerProtocol Header Patterns
+--------+--------+--------+--------+
| Magic number / Signature |
+--------+--------+--------+--------+
| Version | Flags |
+--------+--------+--------+--------+
| Length | Message Type |
+--------+--------+--------+--------+
| Sequence Number / Session ID |
+--------+--------+--------+--------+
| Payload... |
+--------+--------+--------+--------+Before binary protocol or encryption analysis, read [parsers, structure identification, and TLS techniques](references/binary-encryption-analysis.md).
Before documenting a protocol or writing a dissector, read [the specification template and Lua example](references/protocol-documentation.md).
Active Testing
Fuzzing with Boofuzz
from boofuzz import *
def main():
session = Session(
target=Target(
connection=TCPSocketConnection("target", 8888)
)
)
# Define protocol structure
s_initialize("HELLO")
s_static(b"\x50\x52\x4f\x54") # Magic
s_word(1, name="version") # Version
s_word(0x01, name="type") # Type (HELLO)
s_size("payload", length=4) # Length field
s_block_start("payload")
s_dword(0x12345678, name="client_id")
s_word(0, name="flags")
s_block_end()
session.connect(s_get("HELLO"))
session.fuzz()
if __name__ == "__main__":
main()Replay and Modification
from scapy.all import *
# Replay captured traffic
packets = rdpcap("capture.pcap")
for pkt in packets:
if pkt.haslayer(TCP) and pkt[TCP].dport == 8888:
send(pkt)
# Modify and replay
for pkt in packets:
if pkt.haslayer(Raw):
# Modify payload
original = pkt[Raw].load
modified = original.replace(b"client", b"CLIENT")
pkt[Raw].load = modified
# Recalculate checksums
del pkt[IP].chksum
del pkt[TCP].chksum
send(pkt)Best Practices
Analysis Workflow
1. Capture traffic: Multiple sessions, different scenarios
2. Identify boundaries: Message start/end markers
3. Map structure: Fixed header, variable payload
4. Identify fields: Compare multiple samples
5. Document format: Create specification
6. Validate understanding: Implement parser/generator
7. Test edge cases: Fuzzing, boundary conditions
Common Patterns to Look For
- Magic numbers/signatures at message start
- Version fields for compatibility
- Length fields (often before variable data)
- Type/opcode fields for message identification
- Sequence numbers for ordering
- Checksums/CRCs for integrity
- Timestamps for timing
- Session/connection identifiers
Skill liên quan
- gdpr-dsgvo-expert – Tự động hóa tuân thủ GDPR và DSGVO của Đức. Quét codebase tìm rủi ro quyền riêng tư, tạo…
- obliteratus – OBLITERATUS: gỡ bỏ cơ chế từ chối của LLM (abliterate) bằng phương pháp diff-in-means.
- pkpd-modeling – Mô hình hóa và mô phỏng dược động học (PK) và dược lực học (PD): phân tích không phân…
- build – Dùng khi phát triển tính năng lớn: nghiên cứu dự án, lập kế hoạch triển khai theo giai…
- polars – Thư viện DataFrame hiệu năng cao cho Python ETL, phân tích và chuyển từ pandas. Hỗ trợ…
- business-analyst – Thành thạo phân tích nghiệp vụ hiện đại với phân tích bằng AI, dashboard thời gian thực…
- business-continuity – Xây dựng kế hoạch đảm bảo hoạt động kinh doanh và phân tích tác động. Triển khai kiểm…
- polars-bio – Thực hiện các phép chồng lấp khoảng genomic, láng giềng gần nhất, gộp, coverage…