This trophy shows you how to implement a new protocol into Scapy.
- edit the
templates/proto_trophy.py
file - modify the
GreHack
packet - add a
ByteField
named id - add a
ByteEnumField
named type (type 0 is called Guess, type 1 is Reply, and type 2 Trophy) - add a
IntField
named value
- modify
hashret()
to return the packed id (i.e. a single byte, not an integer) - modify
answers()
to returnTrue
if the packet is an answer toother
- check the results of the unit tests
- use the
bind_layers()
function to tell Scapy that theGreHack
protocol is on top of UDP with source and destination ports equal to 1811 - check the results of the unit tests
- protocols inherit from
Packet
, have a name, and field description hashret()
is used by Scapy to ease matching Queries and Repliesanswers()
is used by Scapy to find if a packet is a reply to another one