I am using scapy 2.3.1-dev not interactively (i.e. as a library) in the tool that I am creating. I would like to get a line of readable package information, for example, you get from scapy.all.Packet.show(). I tried to use all three methods ( packet.show(), packet.show2()and packet.display()) that provide information, but none of them returns anything, instead they print out the information I need.
In addition, the information returned packet.__repr__()is not enough.
Are there any functions / methods that return well-formatted text in the same way as, for example, packet.show()prints them? If there is no way to capture / intercept the output show()before it is printed to the console?
I know that I can do my own string formatting using the information from packet.fields, but I try not to.
source
share