Analyser for Application Layer¶
pcapkit.foundation.analysis works as a header quarter to
analyse and match application layer protocol. Then, call
corresponding modules and functions to extract the attributes.
-
pcapkit.foundation.analysis._analyse(protocol, file, length=None, *, seekset=0)[source]¶ Analyse packet.
- Parameters
protocol (Protocol) – target protocol class
file (io.BytesIO) – source data stream
length (Optional[int]) – packet length
- Keyword Arguments
seekset (int) – original file offset
- Returns
If the packet is parsed successfully, returns the parsed packet; otherwise returns
None.- Return type
Optional[Protocol]
-
pcapkit.foundation.analysis.analyse(file, length=None, *, termination=False)[source]¶ Analyse application layer packets.
- Parameters
file (io.BytesIO) – source data stream
length (Optional[int]) – packet length
- Keyword Arguments
termination (bool) – If terminate parsing application layer protocol.
- Returns
Parsed application layer protocol.
- Return type
See also
The analysis processes order is defined by
ANALYSE_PROTO.
-
pcapkit.foundation.analysis.register(module, class_, *, index=None)[source]¶ Register a new protocol class.
- Parameters
- Keyword Arguments
index (Optional[int]) – Index of the protocol class when inserted to
ANALYSE_PROTO.
Notes
The full qualified class name of the new protocol class should be as
{module}.{class_}.
-
pcapkit.foundation.analysis.ANALYSE_PROTO= [('pcapkit.protocols.application.ftp', 'FTP'), ('pcapkit.protocols.application.httpv1', 'HTTPv1'), ('pcapkit.protocols.application.httpv2', 'HTTPv2')]¶ List of protocols supported by the analyser.