Libtins – High-level and multiplatform C++ network packet sniffing and crafting
libtins.github.io
libtins.github.io
With no "if" anywhere in the code, I wondered how it knew to print only TCP packets and not others. And the answer turns out to be that it throws a C++ exception on every non-TCP packet!
If most of the packets on your network are TCP, this is sort of OK. But if you have mostly non-TCP packets, this toy program costs about 10x the CPU utilization that it would if it used "if" instead of magic.
So for the cost of a few expensive frames at start, afterwards no exceptions get thrown.
Generally speaking though, I'm only replying because I hate people negging on minutia of new projects. If you're going to be critical of something especially when it's a lone wolf effort (or even a small team), try to be constructive, there are real people on the other end of the wire.
If high efficiency wasn't touted as a feature then it would have been fine. But when it turns out that one of the main selling points is performance (with no expressed limitations or restrictions) and regular patterns perform badly, as a consequence of the design, then it is quite valid criticism. (Whether this is the case in practice I don't know but GP brings up a very valid point)
GPs point begs the question - Why was it designed in such as way? Quite possibly the tradeoffs were considered and the current solution was targeted because of several reasons. But the page doesn't convey any of that, it simply states that "In fact, it is one of the fastest packet sniffing and interpretation libraries available.".
While I agree with your point the library isn't exactly marketed as a lone wolf effort either, and that will also affect the criticism it will receive.
Heuristic construction of a packet filter based on previously seen exceptions is infeasible with the current API because rejection of the first N non-TCP packets does not guarantee rejection of the next one.
(rfind_pdu uses it internally: https://github.com/mfontanini/libtins/blob/37c92fcf5c83b034a...)
If you want to do things right, you can read the docs and use the appropriate API call (like using the non throwing PDU::find_pdu, use bpf filters, etc).
It should be readily available on most package managers, atleast debian based last time I checked.
At least in Sid.
libnet-based modular utilities that can be used in shell scripts:
http://nemesis.sourceforge.net/docs.html
Also, earlier was nc-data. Slow but allows constructing any packet from the command line. Not limited to known packet formats.
Let us hear your criticisms.
wow, they weren't kidding. In the first and the last graph, scapy is ten times slower than the next slowest lib.
https://github.com/secdev/scapy/blob/728177bff883f170e9ac004...
pcapy can read from a live stream or from a packet capture file (.pcap format).