Skip to content

Tag: networking

Receive foreign UDP Broadcast with Python

I have a device in the network at 192.168.123.204 which broadcasts UDP datagrams(Artnet) as 2.168.123.204 to 2.255.255.255:6454. (The network address is 192.168.123.204 but the datagram is sent with 2.168.123.204 as source.) The address 2.255.255.255 can’t be changed (no setting for that). My Python scr…

How to read pcapng (wireshark) files in Python?

I have a capture of some TCP packets in pcapng format and I’d like to open it in python to inspect the TCP payloads with address 192.168.1.198. I’ve only found this library: https://python-pcapng.readthedocs.io/en/latest/api/blocks.html but it does not support inspecting TCP payloads. Is there an …

Efficient way to store and forward based on 5 tuple data

I am making a Ryu application which has to keep track of network “conversations”, that is to say, the bidirectional L4 flows. The issue is that while there are many ways to do this, efficiency is a big problem. Problems: Bidirectional data must be easily looked up. For example, a naive approach mi…

how to turn protocol number to name with python?

the protocol like tcp and udp is all represented by a number. the above code will return 6. How I can get the protocol name if I know the protocol number? Answer I’m going to say there is almost definitely a better way then this, but all the protocol names (and values) are stored as constants prefixed b…