<story><title>Scapy: Low level packet hacking toolkit for Python</title><url>https://www.trickster.dev/post/scapy-low-level-packet-hacking-toolkit-for-python/</url></story><parent_chain></parent_chain><comment><author>octagons</author><text>I’ve used scapy for years and found it especially useful when performing internal penetration tests. It has useful patterns for tasks like quickly putting together a custom DNS server, UDP source spoofing, walking all ICMP codes (or a quick and dirty ICMP redirect tool), or couple it with matplotlib and to estimate how many active hosts are communicating with a remote server based on TCP sequence numbers (I believe this is part of the scapy examples.)&lt;p&gt;Coupled with interfaces to import and export PCAP files, it’s also a great way to learn about or explore&amp;#x2F;tamper with network protocols.&lt;p&gt;The fact that it’s implemented in Python might scare some off, but I personally feel that this only adds to its usefulness since it can benefit from all of the external tooling and flexibility that comes with the language.</text></comment>
<story><title>Scapy: Low level packet hacking toolkit for Python</title><url>https://www.trickster.dev/post/scapy-low-level-packet-hacking-toolkit-for-python/</url></story><parent_chain></parent_chain><comment><author>therealchiggs</author><text>Scapy is great if you want to send and receive packets onto a network from Python.  There are a few gotchas, for example it can be eager to send real packets out in order to resolve names which might not always be what you want if you&amp;#x27;re doing offline analysis.&lt;p&gt;If you are parsing packet captures or defining custom protocols then dpkt[0] is also worth a look.  It&amp;#x27;s a simpler module with substantially higher performance.&lt;p&gt;[0] &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;dpkt.readthedocs.io&amp;#x2F;en&amp;#x2F;latest&amp;#x2F;&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;dpkt.readthedocs.io&amp;#x2F;en&amp;#x2F;latest&amp;#x2F;&lt;/a&gt;</text></comment>