I understand that I’ve asked a similar question that of custom packets.
But this is different. This is protocol.
Has anyone constructed a custom protocol, such as UDT, in Ruby?
What would one use to construct a custom protocol?
Right now, I’m using code from metasploit 3.0 (written in Ruby :-), and
the CStruct2 library included. Some sample stuff I have…
UDT_CTRL_PKT = Rex::Struct2::CStructTemplate.new(
[ ‘uint1v’, ‘PktType’, 0 ],
[ ‘uint8v’, ‘Type’, 0 ],
[ ‘uint16v’, ‘ExtType’, 0 ],
[ ‘uint1’, ‘X’, 0 ],
[ ‘uint30v’, ‘SubSeqNum’, 0 ],
[ ‘uint32v’, ‘TimeStamp’, 0 ]
)
UDT_DATA_PKT = Rex::Struct2::CStructTemplate.new(
[ ‘uint1v’, ‘PktType’, 0 ],
[ ‘uint30v’, ‘SeqNum’, 0 ],
[ ‘uint2v’, ‘FF’, 0 ],
[ ‘uint1v’, ‘O’, 0 ],
[ ‘uint28v’, ‘MsgNum’, 0 ],
[ ‘uint32v’, ‘TimeStamp’, 0 ]
)
What I’m intending to do - what you’re supposed to do - with the
CStruct2 lib is to create a binary string out of it and write that
to a raw socket.
What are some techniques someone would use to accomplish the goal of a
new protocol?
Thanks,
Ari B.