How to extract protocol from a pcap file ? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Networking (https://python-forum.io/forum-12.html) +--- Thread: How to extract protocol from a pcap file ? (/thread-25551.html) |
How to extract protocol from a pcap file ? - salwa17 - Apr-02-2020 I developed this code to extract all protocols (transport and application) from a pcap file: load_layer('http') load_layer('tls') load_contrib("modbus") def find_proto(s): def expand(x): yield x.name while x.payload: x = x.payload yield x.name if s[0]: proto = list(expand(s[0])) sProto = ["HTTP", "DNS", "ModbusADU", "TLS", "TCP", "UDP", "FTP-DATA", "Raw"] for p in sProto: if p in proto: return p return "Unknown"Here I limited the extract to "HTTP", "DNS", "ModbusADU", "TLS", "TCP", "UDP", "FTP-DATA", "Raw" but if I want to extract all the protocol like in wireshark |