Add Scapy packet/field design skill with UTScapy, session, payload binding, and implementation-pattern guidance#34
Conversation
Agent-Logs-Url: https://github.com/polybassa/scapy-1/sessions/447aadac-7f80-461b-bee8-0af099a49f16 Co-authored-by: polybassa <1676055+polybassa@users.noreply.github.com>
| - Extensive bindings in `scapy/layers/l2.py` and `scapy/layers/inet.py` | ||
| - Custom dispatch in `ICMP.guess_payload_class` | ||
|
|
||
| ### 5) Use specialized field helpers for protocol correctness |
There was a problem hiding this comment.
Add more information about specialised fields
There was a problem hiding this comment.
Added a dedicated expansion of specialized fields (length-coupled, bit-packed, conditional/variant typing, container/composition, enum/display helpers, and RawVal) with concrete layer examples in commit 14995ed.
| - `UDP.post_build`: len + checksum | ||
| - `GRE.post_build`: conditional checksum | ||
|
|
||
| ### 3) Split payload/padding with `extract_padding` when length is explicit |
There was a problem hiding this comment.
Add information about hashret and answers and session reassemble
There was a problem hiding this comment.
Added a new section covering hashret, answers, and session reassembly hooks (IPSession, TCPSession, and tcp_reassemble(data, metadata, session)) in commit 14995ed.
Agent-Logs-Url: https://github.com/polybassa/scapy-1/sessions/294230af-e2c3-4f43-8bd0-0e5185a5c803 Co-authored-by: polybassa <1676055+polybassa@users.noreply.github.com>
polybassa
left a comment
There was a problem hiding this comment.
Describe guess_payload and the pattern where a layer base class encodes the actual packets.
Add a list of all existing field types and their purpose and intended use.
Describe bind_layers and bind up and buttom
Agent-Logs-Url: https://github.com/polybassa/scapy-1/sessions/959fa83f-3433-4f9a-a08b-07171f148156 Co-authored-by: polybassa <1676055+polybassa@users.noreply.github.com>
Added |
|
Study the slides and add further informations to the skill file |
Agent-Logs-Url: https://github.com/polybassa/scapy-1/sessions/9edf02fe-d106-4bc4-91be-7c45bcaf461d Co-authored-by: polybassa <1676055+polybassa@users.noreply.github.com>
Agent-Logs-Url: https://github.com/polybassa/scapy-1/sessions/9edf02fe-d106-4bc4-91be-7c45bcaf461d Co-authored-by: polybassa <1676055+polybassa@users.noreply.github.com>
Implemented in commits |
This PR adds a focused skill document that distills how Scapy
Packet/Fieldabstractions are used across layers, and extends it with UTScapy usage so protocol work and regression coverage are documented in one place.What was added
.github/skills/scapy-packet-fields/SKILL.mdname,description) so the skill is discoverable and purpose-scoped.Packet/Field implementation patterns captured
Packetsubclasses +fields_desc).h2i,i2h,i2m,m2i,any2i).post_buildfor deferred values (len/checksum/data offset),extract_paddingfor explicit-length payload separation,guess_payload_class,bind_layers,bind_bottom_up, andbind_top_down.scapy.fieldscatalog grouped by intended usage:RawValusage for intentional conversion bypass.Request/response and session behavior guidance added
hashret()usage for stable request/response correlation keys.answers(other)usage for protocol-level reply matching.IPSession,TCPSession, andtcp_reassemble(data, metadata, session)patterns.Payload dispatch patterns expanded
payload_guess-based dispatch and fallback behavior.dispatch_hookwhere a base layer decodes into a concrete sibling/subclass (e.g.Ether/Dot3).Additional implementation guidance integrated from protocol slides
pkt[Layer],.underlayer,.payload).X*,LE*,Signed*,*Enum*).PacketFieldandPacketListField.post_dissectfor post-parse mutation workflows,extract_paddingfor explicit trailing-byte handling in variable-length decoding,addfield/getfieldoverrides.Layer usage references included
scapy/packet.pyscapy/fields.pyscapy/layers/inet.pyscapy/layers/l2.pyscapy/sessions.pydoc/scapy/build_dissect.rstscapy/contrib/mpls.pyscapy/layers/inet6.pyscapy/contrib/automotive/doip.pyscapy/layers/dot11.pyscapy/layers/tftp.pyUTScapy section added
%,+,=,~,*) and result semantics (last expression truthiness).-t,-k,-K,-n,-c,-f,-R,-N) and intended usage.