The greatest problem when looking for implementations of network packet sniffers in Python 3 is that nearly all of them rely heavily in third-party libraries like Scapy or kamene that, though very convenient, may not be at hand when an ethical hacking engagement has to take place in restrictive environments.
For this reason I implemented this basic packet sniffer using just built-in libraries and fully compatible with Python 3.x. It is implemented in OOP, leverages libraries like ctypes, socket, argparse and others and relies on the use of abstract base classes, inheritance, special methods, decorators and design patterns (command, observer and template). We also employ some manipulation of binary and hexadecimal values that are formatted for the use on raw sockets.
This tool is part of an upcoming (though not nearly ready) series of video tutorials I plan to launch some time in the next year. It might be a rather long course given how much we’d need to cover about all the underlying networking and programming topics.
It’s available on GitHub. Use wisely.[https://github.com/EONRaider/Packet-Sniffer](https://github.com/EONRaider/Packet-Sniffer)