Extract custom Wireshark extension fields
masterYou can extract specific Wireshark fields by passing them in the extension list to extract(). The resulting value.extension attribute is a dictionary where:
- Key: The field name you requested.
- Value: A list of tuples
[(value, packet_index), ...].value: The extracted data.
packet_index: The index of the IP packet in the stream where this value appeared.
Common Extension Fields:
| Field Name | Extension Key | Tshark Requirement |
|---|---|---|
| SNI | tls.handshake.extensions_server_name | $\ge$ 3.0.0 |
| SSL Ciphersuites | tls.handshake.ciphersuite | $\ge$ 3.0.0 |
| X509 Certificate | tls.handshake.certificate | $\ge$ 3.0.0 |
| UDP Payload | udp.payload | $\ge$ 3.3.0 |
| TCP Payload | tcp.payload | N/A |
Warning: Do not attempt to re-extract fields that are already provided by default (e.g., ip.src, tcp.port, ip.length), as this will cause parsing errors.
# Example: Extracting TLS ciphersuites
result = extract("file.pcap", extension=["tls.handshake.ciphersuite"])
for key, value in result.items():
# extension is a dict: {'tls.handshake.ciphersuite': [('value', index), ...]}
print(value.extension)