Auxiliary Interface

pcapkit.interface.misc contains miscellaneous user interface functions, classes, etc., which are generally provided per user’s requests.

pcapkit.interface.misc.follow_tcp_stream(fin=None, verbose=False, extension=True, engine=None, fout=None, format=None, byteorder='little', nanosecond=False, trace_bidirectional=True, trace_analyse=False)[source]

Follow TCP streams.

Parameters:
  • fin (str | None) – file name to be read; if file not exist, raise FileNotFound

  • extension (bool) – if check and append extensions to output file

  • verbose (bool) – if print verbose output information

  • engine (Literal['default', 'pcapkit', 'dpkt', 'scapy', 'pyshark', 'pypcap', 'pcap_ct', 'pypcapfile'] | None) – extraction engine to be used

  • fout (str | None) – path name for flow tracer if necessary

  • format (Literal['pcap', 'cap', 'json', 'tree', 'text', 'txt', 'plist', 'xml'] | None) – output file format of flow tracer

  • byteorder (Literal['little', 'big']) – output file byte order

  • nanosecond (bool) – output nanosecond-resolution file flag

  • trace_bidirectional (bool) – whether both halves of a conversation are followed as one stream, which is the default – a stream then holds the frames and the reassembled payload of both directions, which is what “following a TCP stream” means elsewhere. False restores one stream per direction.

  • trace_analyse (bool) – whether each traced flow reassembles its application layer, so that Index.packet can be read off Extractor.trace. Off by default, and independent of the conversations this function returns – those come from the reassembly below, which runs either way.

Return type:

tuple[Stream, ...]

Returns:

List of extracted TCP streams.

Data Models

class pcapkit.interface.misc.Stream(*args: VT, **kwargs: VT)[source]

Bases: Info

Data model for TCP streams.

filename: str | None

Output filename.

packets: tuple[Frame | PCAPNG | Packet | Packet | Packet | pcapfile.structs.pcap_packet | tuple[float, bytes], ...]

Packet list.

conversations: tuple[bytes | tuple[bytes, ...], ...]

TCP conversation.