Read/Write TCP options field
<p>I want to read and write custom data to TCP options field using Scapy. I know how to use TCP options field in Scapy in "normal" way as dictionary, but is it possible to write to it byte per byte?</p>

<p>You can not directly write the TCP options field byte per byte, however you can either:</p>

<ul>
<li>write your entire TCP segment byte per byte: <code>TCP("\x01...\x0n")</code></li>
<li>add an option to Scapy's code manually in scapy/layers/inet.py <code>TCPOptions</code> structure</li>
</ul>

<p>These are workarounds and a definitive solution to this would be to implement a byte per byte TCP options field and commit on Scapy's github of course.</p>

python tcp scapy