PyPCAPKit - Stream PCAP File Extractor¶
The PyPCAPKit
project is an open source Python program focus
on PCAP parsing and analysis, which works as a stream PCAP file extractor.
With support of DictDumper
, it shall support multiple
output report formats.
Important
The whole project supports Python 3.6 or later.
Module Documentation¶
pcapkit
is an independent open source library, using only
DictDumper as its formatted output dumper.
Unlike popular PCAP file extractors, such as Scapy,
DPKT, PyShark, and etc, pcapkit
uses streaming
strategy to read input files. That is to read frame by
frame, decrease occupation on memory, as well as enhance
efficiency in some way.
User Interface¶
pcapkit.interface
defines several user-oriented
interfaces, variables, and etc. These interfaces are
designed to help and simplify the usage of pcapkit
.
Core User Interface¶
pcapkit.interface.core
defines core user-oriented
interfaces, variables, and etc., which wraps around the
foundation classes from pcapkit.foundation
.
PCAP Extration¶
- pcapkit.interface.core.extract(fin=None, fout=None, format=None, auto=True, extension=True, store=True, files=False, nofile=False, verbose=False, engine=None, layer=None, protocol=None, ip=False, ipv4=False, ipv6=False, tcp=False, strict=True, trace=False, trace_fout=None, trace_format=None, trace_byteorder='little', trace_nanosecond=False)[source]¶
Extract a PCAP file.
- Parameters
fin (Optional[str]) – file name to be read; if file not exist, raise
FileNotFound
fout (Optional[str]) – file name to be written
format (Optional[Formats]) – file format of output
auto (bool) – if automatically run till EOF
extension (bool) – if check and append extensions to output file
store (bool) – if store extracted packet info
files (bool) – if split each frame into different files
nofile (bool) – if no output file is to be dumped
verbose (bool | VerboseHandler) – a
bool
value or a function takes theExtract
instance and current parsed frame (depends on engine selected) as parameters to print verbose output informationengine (Optional[Engines]) – extraction engine to be used
layer (Optional[Layers | Type[Protocol]]) – extract til which layer
protocol (Optional[Protocols]) – extract til which protocol
ip (bool) – if record data for IPv4 & IPv6 reassembly
ipv4 (bool) – if perform IPv4 reassembly
ipv6 (bool) – if perform IPv6 reassembly
tcp (bool) – if perform TCP reassembly
strict (bool) – if set strict flag for reassembly
trace (bool) – if trace TCP traffic flows
trace_fout (Optional[str]) – path name for flow tracer if necessary
trace_format (Optional[Formats]) – output file format of flow tracer
trace_byteorder (Literal["big", "little"]) – output file byte order
trace_nanosecond (bool) – output nanosecond-resolution file flag
- Returns
An
Extractor
object.- Return type
Payload Reassembly¶
- pcapkit.interface.core.reassemble(protocol, strict=False)[source]¶
Reassemble fragmented datagrams.
- Parameters
- Returns
A
Reassembly
object of corresponding protocol.- Raises
FormatError – If
protocol
is NOT any of IPv4, IPv6 or TCP.- Return type
TCP Flow Tracing¶
Output File Formats¶
- pcapkit.interface.core.TREE = 'tree'¶
- pcapkit.interface.core.JSON = 'json'¶
- pcapkit.interface.core.PLIST = 'plist'¶
- pcapkit.interface.core.PCAP = 'pcap'¶
Layer Thresholds¶
- pcapkit.interface.core.RAW = 'none'¶
- pcapkit.interface.core.LINK = 'link'¶
- pcapkit.interface.core.INET = 'internet'¶
- pcapkit.interface.core.TRANS = 'transport'¶
- pcapkit.interface.core.APP = 'application'¶
Extration Engines¶
- pcapkit.interface.core.DPKT = 'dpkt'¶
- pcapkit.interface.core.Scapy = 'scapy'¶
- pcapkit.interface.core.PCAPKit = 'default'¶
- pcapkit.interface.core.PyShark = 'pyshark'¶
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)[source]¶
Follow TCP streams.
- Parameters
fin (Optional[str]) – 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 (Optional[Engines]) – extraction engine to be used
fout (Optional[str]) – path name for flow tracer if necessary
format (Optional[Formats]) – output file format of flow tracer
byteorder (ByteOrder) – output file byte order
nanosecond (bool) – output nanosecond-resolution file flag
- Returns
List of extracted TCP streams.
- Return type
Data Structures¶
Library Foundation¶
pcapkit.foundation
is a collection of foundations for
pcapkit
, including PCAP file extraction tool
Extrator
, TCP flow tracer
TraceFlow
, registry management
APIs for pcapkit
, and TCP/IP reassembly implementations.
Extractor for PCAP Files¶
pcapkit.foundation.extraction
contains
Extractor
only,
which synthesises file I/O and protocol analysis,
coordinates information exchange in all network layers,
extracts parametres from a PCAP file.
- class pcapkit.foundation.extraction.Extractor(fin=None, fout=None, format=None, auto=True, extension=True, store=True, files=False, nofile=False, verbose=False, engine=None, layer=None, protocol=None, ip=False, ipv4=False, ipv6=False, tcp=False, strict=True, trace=False, trace_fout=None, trace_format=None, trace_byteorder='little', trace_nanosecond=False)[source]¶
Bases:
object
Extractor for PCAP files.
Notes
For supported engines, please refer to
run()
.- Parameters
fin (Optional[str]) – file name to be read; if file not exist, raise
FileNotFound
fout (Optional[str]) – file name to be written
format (Optional[Formats]) – file format of output
auto (bool) – if automatically run till EOF
extension (bool) – if check and append extensions to output file
store (bool) – if store extracted packet info
files (bool) – if split each frame into different files
nofile (bool) – if no output file is to be dumped
verbose (bool | VerboseHandler) – a
bool
value or a function takes theExtractor
instance and current parsed frame (depends on engine selected) as parameters to print verbose output informationengine (Optional[Engines]) – extraction engine to be used
layer (Optional[Layers]) – extract til which layer
protocol (Optional[Protocols]) – extract til which protocol
ip (bool) – if record data for IPv4 & IPv6 reassembly
ipv4 (bool) – if perform IPv4 reassembly
ipv6 (bool) – if perform IPv6 reassembly
tcp (bool) – if perform TCP reassembly
strict (bool) – if set strict flag for reassembly
trace (bool) – if trace TCP traffic flows
trace_fout (Optional[str]) – path name for flow tracer if necessary
trace_format (Optional[Formats]) – output file format of flow tracer
trace_byteorder (Literal["big", "little"]) – output file byte order
trace_nanosecond (bool) – output nanosecond-resolution file flag
- __init__(fin=None, fout=None, format=None, auto=True, extension=True, store=True, files=False, nofile=False, verbose=False, engine=None, layer=None, protocol=None, ip=False, ipv4=False, ipv6=False, tcp=False, strict=True, trace=False, trace_fout=None, trace_format=None, trace_byteorder='little', trace_nanosecond=False)[source]¶
Initialise PCAP Reader.
- Parameters
fin (Optional[str]) – file name to be read; if file not exist, raise
FileNotFound
fout (Optional[str]) – file name to be written
format (Optional[Formats]) – file format of output
auto (bool) – if automatically run till EOF
extension (bool) – if check and append extensions to output file
store (bool) – if store extracted packet info
files (bool) – if split each frame into different files
nofile (bool) – if no output file is to be dumped
verbose (bool | VerboseHandler) – a
bool
value or a function takes theExtractor
instance and current parsed frame (depends on engine selected) as parameters to print verbose output informationengine (Optional[Engines]) – extraction engine to be used
layer (Optional[Layers]) – extract til which layer
protocol (Optional[Protocols]) – extract til which protocol
ip (bool) – if record data for IPv4 & IPv6 reassembly
ipv4 (bool) – if perform IPv4 reassembly
ipv6 (bool) – if perform IPv6 reassembly
tcp (bool) – if perform TCP reassembly
strict (bool) – if set strict flag for reassembly
trace (bool) – if trace TCP traffic flows
trace_fout (Optional[str]) – path name for flow tracer if necessary
trace_format (Optional[Formats]) – output file format of flow tracer
trace_byteorder (Literal["big", "little"]) – output file byte order
trace_nanosecond (bool) – output nanosecond-resolution file flag
- Warns
FormatWarning – Warns under following circumstances:
If using PCAP output for TCP flow tracing while the extraction engine is PyShark.
If output file format is not supported.
- Return type
None
- __iter__()[source]¶
Iterate and parse PCAP frame.
- Raises
IterableError – If
self._flag_a
isTrue
, as such operation is not applicable.- Return type
- __next__()[source]¶
Iterate and parse next PCAP frame.
It will call
_read_frame()
to parse next PCAP frame internally, until the EOF reached; then it calls_cleanup()
for the aftermath.- Return type
Frame | ScapyPacket | DPKTPacket
- __call__()[source]¶
Works as a simple wrapper for the iteration protocol.
- Raises
IterableError – If
self._flag_a
isTrue
, as iteration is not applicable.- Return type
Frame | ScapyPacket | DPKTPacket
- property info: VersionInfo¶
Version of input PCAP file.
- Raises
UnsupportedCall – If
self._exeng
is'scapy'
or'pyshark'
, as such engines does not reserve such information.- Return type
VersionInfo
- property format: Formats¶
Format of output file.
- Raises
UnsupportedCall – If
self._flag_q
is set asTrue
, as output is disabled by initialisation parameter.- Return type
Formats
- property output: str¶
Name of output file.
- Raises
UnsupportedCall – If
self._flag_q
is set asTrue
, as output is disabled by initialisation parameter.- Return type
- property frame: tuple[Frame, ...]¶
Extracted frames.
- Raises
UnsupportedCall – If
self._flag_d
isTrue
, as storing frame data is disabled.
- property reassembly: ReassemblyData¶
Frame record for reassembly.
ipv4
– tuple of TCP payload fragment (ipv4.datagram)ipv6
– tuple of TCP payload fragment (ipv6.datagram)tcp
– tuple of TCP payload fragment (tcp.datagram)
- Return type
- property trace: tuple[Index, ...]¶
Index table for traced flow.
- Raises
UnsupportedCall – If
self._flag_t
isTrue
, as TCP flow tracing is disabled.- Return type
- property engine: Engines¶
PCAP extraction engine.
- Return type
Engines
- run()[source]¶
Start extraction.
We uses
import_test()
to check if a certain engine is available or not. For supported engines, each engine has different driver method:Default drivers:
Global header:
record_header()
Packet frames:
record_frames()
DPKT driver:
_run_dpkt()
Scapy driver:
_run_scapy()
PyShark driver:
_run_pyshark()
- Warns
EngineWarning – If the extraction engine is not available. This is either due to dependency not installed, or supplied engine unknown.
- Return type
- record_header()[source]¶
Read global header.
The method will parse the PCAP global header and save the parsed result as
self._gbhdr
. Information such as PCAP version, data link layer protocol type, nanosecond flag and byteorder will also be save the currentExtractor
instance.If TCP flow tracing is enabled, the nanosecond flag and byteorder will be used for the output PCAP file of the traced TCP flows.
For output, the method will dump the parsed PCAP global header under the name of
Global Header
.- Return type
- record_frames()[source]¶
Read packet frames.
The method calls
_read_frame()
to parse each frame from the input PCAP file; and calls_cleanup()
upon complision.Notes
Under non-auto mode, i.e.
self._flag_a
isFalse
, the method performs no action.- Return type
- classmethod register(format, module, class_, ext)[source]¶
Register a new dumper class.
Notes
The full qualified class name of the new dumper class should be as
{module}.{class_}
.
- classmethod make_name(fin='in.pcap', fout='out', fmt='tree', extension=True, *, files=False, nofile=False)[source]¶
Generate input and output filenames.
The method will perform following processing:
sanitise
fin
as the input PCAP filename;in.pcap
as default value and append.pcap
extension if needed andextension
isTrue
; as well as test if the file exists;if
nofile
isTrue
, skips following processing;if
fmt
provided, then it presumes corresponding output file extension;if
fout
not provided, it presumes the output file name based on the presumptive file extension; the stem of the output file name is set asout
; should the file extension is not available, then it raisesFormatError
;if
fout
provided, it presumes corresponding output format if needed; should the presumption cannot be made, then it raisesFormatError
;it will also append corresponding file extension to the output file name if needed and
extension
isTrue
.
- Parameters
fin (str) – Input filename.
fout (str) – Output filename.
fmt (Formats) – Output file format.
extension (bool) – If append
.pcap
file extension to the input filename iffin
does not have such file extension; if check and append extensions to output file.files (bool) – If split each frame into different files.
nofile (bool) – If no output file is to be dumped.
- Returns
input filename
output filename / directory name
output format
output file extension (without
.
)if split each frame into different files
- Return type
Generated input and output filenames
- Raises
FileNotFound – If input file does not exists.
FormatError – If output format not provided and cannot be presumpted.
- _read_frame()[source]¶
Headquarters for frame reader.
This method is a dispatcher for parsing frames.
For Scapy engine, calls
_scapy_read_frame()
.For DPKT engine, calls
_dpkt_read_frame()
.For PyShark engine, calls
_pyshark_read_frame()
.For default (PyPCAPKit) engine, calls
_default_read_frame()
.
- Return type
Frame | ScapyPacket | DPKTPacket
- Returns
The parsed frame instance.
- _cleanup()[source]¶
Cleanup after extraction & analysis.
The method clears the
self._expkg
andself._extmp
attributes, setsself._flag_e
asTrue
and closes the input file.- Return type
- _default_read_frame()[source]¶
Read frames with default engine.
This method performs following operations:
extract frames and each layer of packets;
make
Info
object out of frame properties;write to output file with corresponding dumper;
reassemble IP and/or TCP datagram;
trace TCP flows if any;
record frame
Info
object to frame storage.
- Return type
- Returns
Parsed frame instance.
- _run_scapy(scapy_all)[source]¶
Call
scapy.all.sniff()
to extract PCAP files.This method assigns
self._expkg
asscapy.all
andself._extmp
as an iterator fromscapy.all.sniff()
.- Parameters
scapy_all (
module
) – Thescapy.all
module.- Warns
AttributeWarning – If
self._exlyr
and/orself._exptl
is provided as the Scapy engine currently does not support such operations.- Return type
- _scapy_read_frame()[source]¶
Read frames with Scapy engine.
- Return type
ScapyPacket
- Returns
Parsed frame instance.
See also
Please refer to
_default_read_frame()
for more operational information.
- _run_dpkt(dpkt)[source]¶
Call
dpkt.pcap.Reader
to extract PCAP files.This method assigns
self._expkg
asdpkt
andself._extmp
as an iterator fromdpkt.pcap.Reader
.- Parameters
dpkt (
module
) – Thedpkt
module.- Warns
AttributeWarning – If
self._exlyr
and/orself._exptl
is provided as the DPKT engine currently does not support such operations.- Return type
- _dpkt_read_frame()[source]¶
Read frames with DPKT engine.
- Returns
Parsed frame instance.
- Return type
See also
Please refer to
_default_read_frame()
for more operational information.
- _run_pyshark(pyshark)[source]¶
Call
pyshark.FileCapture
to extract PCAP files.This method assigns
self._expkg
aspyshark
andself._extmp
as an iterator frompyshark.FileCapture
.- Parameters
pyshark (types.ModuleType) – The
pyshark
module.- Warns
AttributeWarning – Warns under following circumstances:
if
self._exlyr
and/orself._exptl
is provided as the PyShark engine currently does not support such operations.if reassembly is enabled, as the PyShark engine currently does not support such operation.
- Return type
- _pyshark_read_frame()[source]¶
Read frames with PyShark engine.
- Return type
PySharkPacket
- Returns
Parsed frame instance.
See also
Please refer to
_default_read_frame()
for more operational information.
- _exptl: Protocols¶
Extract til protocol.
- _exlyr: Layers¶
Extract til layer.
- _exeng: Engines¶
Extract using engine.
- _expkg: Any¶
Extract module instance.
- _extmp: Any¶
Extract iterator instance.
Data Structures¶
Trace TCP Flows¶
pcapkit.foundation.traceflow
is the interface to trace
TCP flows from a series of packets and connections.
Note
This was implemented as the demand of my mate @gousaiyang
- class pcapkit.foundation.traceflow.TraceFlow(fout, format, byteorder='little', nanosecond=False)[source]¶
Bases:
object
Trace TCP flows.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
- __call__(packet)[source]¶
Dump frame to output files.
- Parameters
packet (
Packet
) – a flow packet (trace.packet)- Return type
- dump(packet)[source]¶
Dump frame to output files.
- Parameters
packet (Dict[str, Any]) – a flow packet (trace.packet)
- Return type
- trace(packet: Packet, *, output: Literal[True] = False) Dumper [source]¶
- trace(packet: Packet, *, output: Literal[False] = False) str
Trace packets.
- Parameters
packet – a flow packet (trace.packet)
output – flag if has formatted dumper
- Returns
If
output
isTrue
, returns the initiatedDumper
object, which will dump data to the output file named after the flow label; otherwise, returns the flow label itself.
Notes
The flow label is formatted as following:
f'{packet.src}_{packet.srcport}-{packet.dst}_{info.dstport}-{packet.timestamp}'
- submit()[source]¶
Submit traced TCP flows.
- Returns
Traced TCP flow (trace.index).
- Return type
- classmethod register(format, module, class_, ext)[source]¶
Register a new dumper class.
Notes
The full qualified class name of the new dumper class should be as
{module}.{class_}
.
- classmethod make_fout(fout='./tmp', fmt='pcap')[source]¶
Make root path for output.
- Parameters
- Returns
Dumper of specified format and file extension of output file.
- Warns
FormatWarning – If
fmt
is not supported.FileWarning – If
fout
exists andfmt
isNone
.
- Raises
FileExists – If
fout
exists andfmt
is NOTNone
.- Return type
Terminology¶
- trace.packet¶
Data structure for TCP flow tracing (
TraceFlow.dump
) is as following:tract_dict = dict( protocol=data_link, # data link type from global header index=frame.info.number, # frame number frame=frame.info, # extracted frame info syn=tcp.flags.syn, # TCP synchronise (SYN) flag fin=tcp.flags.fin, # TCP finish (FIN) flag src=ip.src, # source IP dst=ip.dst, # destination IP srcport=tcp.srcport, # TCP source port dstport=tcp.dstport, # TCP destination port timestamp=frame.info.time_epoch, # frame timestamp )
See also
- trace.buffer¶
Data structure for internal buffering when performing flow tracing algorithms (
TraceFlow._buffer
) is as following:(dict) buffer --> memory buffer for reassembly |--> (tuple) BUFID : (dict) | |--> ip.src | | |--> tcp.srcport | | |--> ip.dst | | |--> tcp.dstport | | |--> 'fpout' : (dictdumper.dumper.Dumper) output dumper object | |--> 'index': (list) list of frame index | | |--> (int) frame index | |--> 'label': (str) flow label generated from ``BUFID`` |--> (tuple) BUFID ...
See also
- trace.index¶
Data structure for TCP flow tracing (element from
TraceFlow.index
tuple) is as following:(tuple) index |--> (Info) data | |--> 'fpout' : (Optional[str]) output filename if exists | |--> 'index': (tuple) tuple of frame index | | |--> (int) frame index | |--> 'label': (str) flow label generated from ``BUFID`` |--> (Info) data ...
See also
Data Structures¶
- pcapkit.foundation.traceflow.BufferID: tuple[IPAddress, int, IPAddress, int]¶
Buffer ID is a tuple of source IP, source port, destination IP, and destination port.
- class pcapkit.foundation.traceflow.Packet(protocol, index, frame, syn, fin, src, dst, srcport, dstport, timestamp)[source]¶
Bases:
Info
,Generic
[IPAddress
]Data structure for TCP flow tracing.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- protocol: RegType_LinkType¶
Data link type from global header.
- src: IPAddress¶
Source IP.
- dst: IPAddress¶
Destination IP.
- class pcapkit.foundation.traceflow.Buffer(fpout, index, label)[source]¶
Bases:
Info
Data structure for TCP flow tracing.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- fpout: Dumper¶
Output dumper object.
- class pcapkit.foundation.traceflow.Index(fpout, index, label)[source]¶
Bases:
Info
Data structure for TCP flow tracing.
See also
element from
pcapkit.foundation.traceflow.TraceFlow.index
tuple
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
Fragmented Packets Reassembly¶
pcapkit.reassembly
bases on algorithms described
in RFC 791 and RFC 815, implements datagram reassembly
of IP and TCP packets.
Base Class¶
pcapkit.foundation.reassembly.reassembly
contains
Reassembly
only,
which is an abstract base class for all reassembly classes,
bases on algorithms described in RFC 791 and RFC 815,
implements datagram reassembly of IP and TCP packets.
- class pcapkit.foundation.reassembly.reassembly.Reassembly(*, strict=True)[source]¶
Bases:
Generic
[PT
,DT
,IT
,BT
]Base class for reassembly procedure.
- Parameters
strict (
bool
) – if return all datagrams (including those not implemented) when submit*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Reassembly[PT, DT, IT, BT]
- __init__(*, strict=True)[source]¶
Initialise packet reassembly.
- Parameters
strict (
bool
) – if return all datagrams (including those not implemented) when submit- Return type
None
- abstract submit(buf, **kwargs)[source]¶
Submit reassembled payload.
- Parameters
buf (BT) – buffer dict of reassembled packets
**kwargs (Any) – arbitrary keyword arguments
- Return type
list[DT]
- fetch()[source]¶
Fetch datagram.
- Returns
Tuple of reassembled datagrams.
- Return type
tuple[DT, …]
Fetch reassembled datagrams from
_dtgram
and returns a tuple of such datagrams.If no cache found, the method will call
submit()
to forcedly obtain newly reassembled payload. Otherwise, the already calculated_dtgram
will be returned.
IP Datagram Reassembly¶
The following algorithm implement is based on IP
reassembly procedure introduced in RFC 791, using
RCVBT
(fragment receivedbit table). Though another
algorithm is explained in RFC 815, replacing RCVBT
,
however, this implement still used the elder one.
Algorithm¶
See also
The algorithm is described in RFC 791.
|
Fragment Offset |
|
Internet Header Length |
|
More Fragments Flag |
|
Time To Live |
|
Number of Fragment Blocks |
|
Total Length |
|
Total Data Length |
|
Buffer Identifier |
|
Fragment Received Bit Table |
|
Timer Lower Bound |
DO {
BUFID <- source|destination|protocol|identification;
IF (FO = 0 AND MF = 0) {
IF (buffer with BUFID is allocated) {
flush all reassembly for this BUFID;
Submit datagram to next step;
DONE.
}
}
IF (no buffer with BUFID is allocated) {
allocate reassembly resources with BUFID;
TIMER <- TLB;
TDL <- 0;
put data from fragment into data buffer with BUFID
[from octet FO*8 to octet (TL-(IHL*4))+FO*8];
set RCVBT bits [from FO to FO+((TL-(IHL*4)+7)/8)];
}
IF (MF = 0) {
TDL <- TL-(IHL*4)+(FO*8)
}
IF (FO = 0) {
put header in header buffer
}
IF (TDL # 0 AND all RCVBT bits [from 0 to (TDL+7)/8] are set) {
TL <- TDL+(IHL*4)
Submit datagram to next step;
free all reassembly resources for this BUFID;
DONE.
}
TIMER <- MAX(TIMER,TTL);
} give up until (next fragment or timer expires);
timer expires: {
flush all reassembly with this BUFID;
DONE.
}
Base Class¶
pcapkit.foundation.reassembly.ip
contains
IP_Reassembly
only, which reconstructs fragmented IP packets back to
origin.
- class pcapkit.foundation.reassembly.ip.IP_Reassembly(*, strict=True)[source]¶
Bases:
Reassembly
[Packet
[AT
],Datagram
[AT
],Tuple
[AT
,AT
,int
,TransType
],Buffer
[AT
]],Generic
[AT
]Reassembly for IP payload.
Important
This class is not intended to be instantiated directly, but rather used as a base class for the protocol-aware reassembly classes.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Reassembly[PT, DT, IT, BT]
- class pcapkit.foundation.reassembly.ip.Packet(*args, **kwargs)[source]¶
-
Data model for ipv4.packet / ipv6.packet.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.foundation.reassembly.ip.DatagramID(*args, **kwargs)[source]¶
-
Data model for ipv4.datagram / ipv6.datagram original packet identifier.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- src: AT¶
Source address.
- dst: AT¶
Destination address.
- class pcapkit.foundation.reassembly.ip.Datagram(*args, **kwargs)[source]¶
-
Data model for ipv4.datagram / ipv6.datagram.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- id: DatagramID[AT]¶
Original packet identifier.
- class pcapkit.foundation.reassembly.ip.Buffer(*args, **kwargs)[source]¶
-
Data model for ipv4.buffer / ipv6.buffer.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
IPv4 Datagram Reassembly¶
pcapkit.foundation.reassembly.ipv4
contains
IPv4_Reassembly
only, which reconstructs fragmented IPv4 packets back to
origin. Please refer to Base Class for more information.
- class pcapkit.foundation.reassembly.ipv4.IPv4_Reassembly(*, strict=True)[source]¶
Bases:
IP_Reassembly
[IPv4Address
]Reassembly for IPv4 payload.
Example
>>> from pcapkit.reassembly import IPv4_Reassembly # Initialise instance: >>> ipv4_reassembly = IPv4_Reassembly() # Call reassembly: >>> ipv4_reassembly(packet_dict) # Fetch result: >>> result = ipv4_reassembly.datagram
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Reassembly[PT, DT, IT, BT]
- ipv4.packet¶
Data structure for IPv4 datagram reassembly (
IPv4_Reassembly.reassembly
) is as following:packet_dict = dict( bufid = tuple( ipv4.src, # source IP address ipv4.dst, # destination IP address ipv4.id, # identification ipv4.proto, # payload protocol type ), num = frame.number, # original packet range number fo = ipv4.frag_offset, # fragment offset ihl = ipv4.hdr_len, # internet header length mf = ipv4.flags.mf, # more fragment flag tl = ipv4.len, # total length, header includes header = ipv4.header, # raw bytes type header payload = ipv4.payload, # raw bytearray type payload )
- ipv4.datagram¶
Data structure for reassembled IPv4 datagram (element from
IPv4_Reassembly.datagram
tuple) is as following:(tuple) datagram |--> (Info) data | |--> 'completed' : (bool) True --> implemented | |--> 'id' : (Info) original packet identifier | | |--> 'src' --> (IPv4Address) ipv4.src | | |--> 'dst' --> (IPv4Address) ipv4.dst | | |--> 'id' --> (int) ipv4.id | | |--> 'proto' --> (EtherType) ipv4.proto | |--> 'index' : (tuple) packet numbers | | |--> (int) original packet range number | |--> 'header' : (bytes) IPv4 header | |--> 'payload' : (bytes) reassembled IPv4 payload | |--> 'packet' : (Protocol) parsed reassembled payload |--> (Info) data | |--> 'completed' : (bool) False --> not implemented | |--> 'id' : (Info) original packet identifier | | |--> 'src' --> (IPv4Address) ipv4.src | | |--> 'dst' --> (IPv4Address) ipv4.dst | | |--> 'id' --> (int) ipv4.id | | |--> 'proto' --> (EtherType) ipv4.proto | |--> 'index' : (tuple) packet numbers | | |--> (int) original packet range number | |--> 'header' : (bytes) IPv4 header | |--> 'payload' : (tuple) partially reassembled IPv4 payload | | |--> (bytes) IPv4 payload fragment | | |--> ... | |--> 'packet' : (None) |--> (Info) data ...
- ipv4.buffer¶
Data structure for internal buffering when performing reassembly algorithms (
IPv4_Reassembly._buffer
) is as following:(dict) buffer --> memory buffer for reassembly |--> (tuple) BUFID : (dict) | |--> ipv4.src | | |--> ipv4.dst | | |--> ipv4.id | | |--> ipv4.proto | | |--> 'TDL' : (int) total data length | |--> 'RCVBT' : (bytearray) fragment received bit table | | |--> (bytes) b'\\x00' -> not received | | |--> (bytes) b'\\x01' -> received | | |--> (bytes) ... | |--> 'index' : (list) list of reassembled packets | | |--> (int) packet range number | |--> 'header' : (bytes) header buffer | |--> 'datagram' : (bytearray) data buffer, holes set to b'\\x00' |--> (tuple) BUFID ...
IPv6 Datagram Reassembly¶
pcapkit.foundation.reassembly.ipv6
contains
IPv6_Reassembly
only, which reconstructs fragmented IPv6 packets back to
origin. Please refer to Base Class for more information.
- class pcapkit.foundation.reassembly.ipv6.IPv6_Reassembly(*, strict=True)[source]¶
Bases:
IP_Reassembly
[IPv6Address
]Reassembly for IPv6 payload.
Example
>>> from pcapkit.reassembly import IPv6_Reassembly # Initialise instance: >>> ipv6_reassembly = IPv6_Reassembly() # Call reassembly: >>> ipv6_reassembly(packet_dict) # Fetch result: >>> result = ipv6_reassembly.datagram
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Reassembly[PT, DT, IT, BT]
- ipv6.packet¶
Data structure for IPv6 datagram reassembly (
IPv6_Reassembly.reassembly
) is as following:packet_dict = dict( bufid = tuple( ipv6.src, # source IP address ipv6.dst, # destination IP address ipv6.label, # label ipv6_frag.next, # next header field in IPv6 Fragment Header ), num = frame.number, # original packet range number fo = ipv6_frag.offset, # fragment offset ihl = ipv6.hdr_len, # header length, only headers before IPv6-Frag mf = ipv6_frag.mf, # more fragment flag tl = ipv6.len, # total length, header includes header = ipv6.header, # raw bytes type header before IPv6-Frag payload = ipv6.payload, # raw bytearray type payload after IPv6-Frag )
- ipv6.datagram¶
Data structure for reassembled IPv6 datagram (element from
IPv6_Reassembly.datagram
tuple) is as following:(tuple) datagram |--> (Info) data | |--> 'completed' : (bool) True --> implemented | |--> 'id' : (Info) original packet identifier | | |--> 'src' --> (IPv6Address) ipv6.src | | |--> 'dst' --> (IPv6Address) ipv6.dst | | |--> 'id' --> (int) ipv6.label | | |--> 'proto' --> (EtherType) ipv6_frag.next | |--> 'index' : (tuple) packet numbers | | |--> (int) original packet range number | |--> 'payload' : (bytes) reassembled IPv4 packet | |--> 'packet' : (Protocol) parsed reassembled payload |--> (Info) data | |--> 'completed' : (bool) False --> not implemented | |--> 'id' : (Info) original packet identifier | | |--> 'src' --> (IPv6Address) ipv6.src | | |--> 'dst' --> (IPv6Address) ipv6.dst | | |--> 'id' --> (int) ipv6.id | | |--> 'proto' --> (EtherType) ipv6_frag.next | |--> 'index' : (tuple) packet numbers | | |--> (int) original packet range number | |--> 'header' : (bytes) IPv4 header | |--> 'payload' : (tuple) partially reassembled IPv4 payload | | |--> (bytes) IPv4 payload fragment | | |--> ... | |--> 'packet' : (None) |--> (Info) data ...
- ipv6.buffer¶
Data structure for internal buffering when performing reassembly algorithms (
IPv6_Reassembly._buffer
) is as following:(dict) buffer --> memory buffer for reassembly |--> (tuple) BUFID : (dict) | |--> ipv6.src | | |--> ipc6.dst | | |--> ipv6.label | | |--> ipv6_frag.next | | |--> 'TDL' : (int) total data length | |--> RCVBT : (bytearray) fragment received bit table | | |--> (bytes) b'\\x00' -> not received | | |--> (bytes) b'\\x01' -> received | | |--> (bytes) ... | |--> 'index' : (list) list of reassembled packets | | |--> (int) packet range number | |--> 'header' : (bytes) header buffer | |--> 'datagram' : (bytearray) data buffer, holes set to b'\\x00' |--> (tuple) BUFID ...
TCP Datagram Reassembly¶
pcapkit.foundation.reassembly.tcp
contains
TCP_Reassembly
only,
which reconstructs fragmented TCP packets back to origin.
The algorithm for TCP reassembly is described as below.
Algorithm¶
See also
This algorithm is an adaptation of the algorithm described in RFC 815.
|
Data Sequence Number |
|
TCP Acknowledgement |
|
TCP Synchronisation Flag |
|
TCP Finish Flag |
|
TCP Reset Connection Flag |
|
Buffer Identifier |
|
Hole Discriptor List |
|
Initial Sequence Number |
|
source IP |
|
destination IP |
|
source TCP port |
|
destination TCP port |
DO {
BUFID <- src|dst|srcport|dstport|ACK;
IF (SYN is true) {
IF (buffer with BUFID is allocated) {
flush all reassembly for this BUFID;
submit datagram to next step;
}
}
IF (no buffer with BUFID is allocated) {
allocate reassembly resources with BUFID;
ISN <- DSN;
put data from fragment into data buffer with BUFID
[from octet fragment.first to octet fragment.last];
update HDL;
}
IF (FIN is true or RST is true) {
submit datagram to next step;
free all reassembly resources for this BUFID;
BREAK.
}
} give up until (next fragment);
update HDL: {
DO {
select the next hole descriptor from HDL;
IF (fragment.first >= hole.first) CONTINUE.
IF (fragment.last <= hole.first) CONTINUE.
delete the current entry from HDL;
IF (fragment.first >= hole.first) {
create new entry "new_hole" in HDL;
new_hole.first <- hole.first;
new_hole.last <- fragment.first - 1;
BREAK.
}
IF (fragment.last <= hole.last) {
create new entry "new_hole" in HDL;
new_hole.first <- fragment.last + 1;
new_hole.last <- hole.last;
BREAK.
}
} give up until (no entry from HDL)
}
The following algorithm implement is based on IP Datagram
Reassembly Algorithm introduced in RFC 815. It described an
algorithm dealing with RCVBT
(fragment received bit table)
appeared in RFC 791. And here is the process:
Select the next hole descriptor from the hole descriptor list. If there are no more entries, go to step eight.
If
fragment.first
is greater thanhole.last
, go to step one.If
fragment.last
is less thanhole.first
, go to step one.Delete the current entry from the hole descriptor list.
If
fragment.first
is greater thanhole.first
, then create a new hole descriptornew_hole
withnew_hole.first
equal tohole.first
, andnew_hole.last
equal tofragment.first
minus one (-1
).If
fragment.last
is less thanhole.last
andfragment.more_fragments
istrue
, then create a new hole descriptornew_hole
, withnew_hole.first
equal tofragment.last
plus one (+1
) andnew_hole.last
equal tohole.last
.Go to step one.
If the hole descriptor list is now empty, the datagram is now complete. Pass it on to the higher level protocol processor for further handling. Otherwise, return.
Implementation¶
pcapkit.foundation.reassembly.tcp
contains
Reassembly
only,
which reconstructs fragmented TCP packets back to origin.
- class pcapkit.foundation.reassembly.tcp.TCP_Reassembly(*, strict=True)[source]¶
Bases:
Reassembly
[Packet
,Datagram
,Tuple
[IPAddress
,int
,IPAddress
,int
],Buffer
]Reassembly for TCP payload.
Example
>>> from pcapkit.reassembly import TCP_Reassembly # Initialise instance: >>> tcp_reassembly = TCP_Reassembly() # Call reassembly: >>> tcp_reassembly(packet_dict) # Fetch result: >>> result = tcp_reassembly.datagram
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Reassembly[PT, DT, IT, BT]
- property name: Literal['Transmission Control Protocol']¶
Protocol of current packet.
- Return type
Literal
[‘Transmission Control Protocol’]
- tcp.packet¶
Data structure for TCP datagram reassembly (
TCP_Reassembly.reassembly
) is as following:packet_dict = Info( bufid = tuple( ip.src, # source IP address tcp.srcport, # source port ip.dst, # destination IP address tcp.dstport, # destination port ), dsn = tcp.seq, # data sequence number ack = tcp.ack, # acknowledgement number num = frame.number, # original packet range number syn = tcp.flags.syn, # synchronise flag fin = tcp.flags.fin, # finish flag rst = tcp.flags.rst, # reset connection flag len = tcp.raw_len, # payload length, header excludes first = tcp.seq, # this sequence number last = tcp.seq + tcp.raw_len, # next (wanted) sequence number header = tcp.packet.header, # raw bytes type header payload = tcp.raw, # raw bytearray type payload )
- tcp.datagram¶
Data structure for reassembled TCP datagram (element from
TCP_Reassembly.datagram
tuple) is as following:(tuple) datagram |--> (Info) data | |--> 'completed' : (bool) True --> implemented | |--> 'id' : (Info) original packet identifier | | |--> 'src' --> (tuple) | | | |--> (IPv4Address) ip.src | | | |--> (int) tcp.srcport | | |--> 'dst' --> (tuple) | | | |--> (IPv4Address) ip.dst | | | |--> (int) tcp.dstport | | |--> 'ack' --> (int) original packet ACK number | |--> 'index' : (tuple) packet numbers | | |--> (int) original packet range number | | |--> ... | |--> 'header' : (bytes) initial TCP header | |--> 'payload' : (bytes) reassembled payload | |--> 'packet' : (Protocol) parsed reassembled payload |--> (Info) data | |--> 'completed' : (bool) False --> not implemented | |--> 'id' : (Info) original packet identifier | | |--> 'src' --> (tuple) | | | |--> (IPv4Address) ip.src | | | |--> (int) tcp.srcport | | |--> 'dst' --> (tuple) | | | |--> (IPv4Address) ip.dst | | | |--> (int) tcp.dstport | | |--> 'ack' --> (int) original packet ACK number | |--> 'index' : (tuple) packet numbers | | |--> (int) original packet range number | | |--> ... | |--> 'header' : (bytes) initial TCP header | |--> 'payload' : (tuple) partially reassembled payload | | |--> (bytes) payload fragment | | |--> ... | |--> 'packet' : (None) not implemented |--> (Info) data ...
- tcp.buffer¶
Data structure for internal buffering when performing reassembly algorithms (
TCP_Reassembly._buffer
) is as following:(dict) buffer --> memory buffer for reassembly |--> (tuple) BUFID : (dict) | |--> ip.src | | |--> ip.dst | | |--> tcp.srcport | | |--> tcp.dstport | | |--> 'hdl' : (list) hole descriptor list | | |--> (Info) hole --> hole descriptor | | |--> "first" --> (int) start of hole | | |--> "last" --> (int) stop of hole | |--> 'hdr' : (bytes) initial TCP header | |--> 'ack' : (dict) ACK list | |--> (int) ACK : (dict) | | |--> 'ind' : (list) list of reassembled packets | | | |--> (int) packet range number | | |--> 'isn' : (int) ISN of payload buffer | | |--> 'len' : (int) length of payload buffer | | |--> 'raw' : (bytearray) reassembled payload, | | holes set to b'\x00' | |--> (int) ACK ... | |--> ... |--> (tuple) BUFID ...
- class pcapkit.foundation.reassembly.tcp.Packet(bufid, dsn, ack, num, syn, fin, rst, len, first, last, header, payload)[source]¶
Bases:
Info
Data model for tcp.packet.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.foundation.reassembly.tcp.DatagramID(src, dst, ack)[source]¶
Bases:
Info
,Generic
[IPAddress
]Data model for tcp.datagram original packet identifier.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.foundation.reassembly.tcp.Datagram(completed, id, index, header, payload, packet)[source]¶
Bases:
Info
,Generic
[IPAddress
]Data model for tcp.datagram.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- id: DatagramID[IPAddress]¶
Original packet identifier.
- class pcapkit.foundation.reassembly.tcp.HoleDiscriptor(fisrt, last)[source]¶
Bases:
Info
Data model for tcp.buffer hole descriptor.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.foundation.reassembly.tcp.Fragment(ind, isn, len, raw)[source]¶
Bases:
Info
Data model for tcp.buffer ACK list fragment item.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.foundation.reassembly.tcp.Buffer(hdl, hdr, ack)[source]¶
Bases:
Info
Data model for tcp.buffer.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- hdl: list[HoleDiscriptor]¶
Hole descriptor list.
Registry Management¶
This module (pcapkit.foundation.registry
) provides the registry
management for pcapkit
, as the module contains various registry
points.
Auxiliary Methods¶
- pcapkit.foundation.registry.register_output(format, module, class_, ext)[source]¶
registered a new dumper class.
Notes
The full qualified class name of the new dumper class should be as
{module}.{class_}
.The function will register the given dumper class to the
pcapkit.foundation.traceflow.TraceFlow.__output__
andpcapkit.foundation.extraction.Extractor.__output__
registry.See also
- pcapkit.foundation.registry.register_linktype(code, module, class_)[source]¶
Register a new protocol class.
Notes
The full qualified class name of the new protocol class should be as
{module}.{class_}
.The function will register the given protocol class to the
pcapkit.protocols.misc.pcap.frame.Frame.__proto__
registry.
- pcapkit.foundation.registry.register_port(proto, code, module, class_)[source]¶
Register a new protocol class.
Notes
The full qualified class name of the new protocol class should be as
{module}.{class_}
.The function will register the given protocol class to the
pcapkit.protocols.transport.tcp.TCP.__proto__
and/orpcapkit.protocols.transport.udp.UDP.__proto__
registry.See also
Dumper Registries¶
- pcapkit.foundation.registry.register_extractor(format, module, class_, ext)[source]¶
registered a new dumper class.
Notes
The full qualified class name of the new dumper class should be as
{module}.{class_}
.The function will register the given dumper class to the
pcapkit.foundation.extraction.Extractor.__output__
registry.
- pcapkit.foundation.registry.register_traceflow(format, module, class_, ext)[source]¶
registered a new dumper class.
Notes
The full qualified class name of the new dumper class should be as
{module}.{class_}
.The function will register the given dumper class to the
pcapkit.foundation.traceflow.TraceFlow.__output__
registry.
Protocol Registries¶
- pcapkit.foundation.registry.register_protocol(protocol)[source]¶
registered protocol class.
The protocol class must be a subclass of
Protocol
, and will be registered to thepcapkit.protocols.__proto__
registry.
- pcapkit.foundation.registry.register_pcap(code, module, class_)[source]¶
Register a new protocol class.
Notes
The full qualified class name of the new protocol class should be as
{module}.{class_}
.The function will register the given protocol class to the
pcapkit.protocols.misc.pcap.frame.Frame.__proto__
registry.
Link Layer Registries¶
- pcapkit.foundation.registry.register_ethertype(code, module, class_)[source]¶
Register a new protocol class.
Notes
The full qualified class name of the new protocol class should be as
{module}.{class_}
.The function will register the given protocol class to the
pcapkit.protocols.link.link.Link.__proto__
registry.
Internet Layer Registries¶
- pcapkit.foundation.registry.register_transtype(code, module, class_)[source]¶
Register a new protocol class.
Notes
The full qualified class name of the new protocol class should be as
{module}.{class_}
.The function will register the given protocol class to the
pcapkit.protocols.internet.internet.Internet.__proto__
registry.
- pcapkit.foundation.registry.register_hopopt(code, meth)[source]¶
Register an option parser.
The function will register the given option parser to the
pcapkit.protocols.internet.hopopt.HOPOPT.__option__
registry.
- pcapkit.foundation.registry.register_ipv6_opts(code, meth)[source]¶
Register an option parser.
The function will register the given option parser to the
pcapkit.protocols.internet.ipv6_opts.IPv6_Opts.__option__
registry.
- pcapkit.foundation.registry.register_ipv6_route(code, meth)[source]¶
Register an routing data parser.
The function will register the given routing data parser to the
pcapkit.protocols.internet.ipv6_route.IPv6_Route.__routing__
registry.- Parameters
code (IPv6_Routing) –
IPv6-Route
data type code as inRouting
.meth (str | IPv6_Route_TypeParser) – Method name or callable to parse the data.
- Return type
None
Transport Layer Registries¶
- pcapkit.foundation.registry.register_tcp_port(code, module, class_)[source]¶
Register a new protocol class.
Notes
The full qualified class name of the new protocol class should be as
{module}.{class_}
.The function will register the given protocol class to the
pcapkit.protocols.transport.tcp.TCP.__proto__
registry.
- pcapkit.foundation.registry.register_tcp(code, meth)[source]¶
Register an option parser.
The function will register the given option parser to the
pcapkit.protocols.transport.tcp.TCP.__option__
registry.
- pcapkit.foundation.registry.register_mptcp(code, meth)[source]¶
Register an MPTCP option parser.
The function will register the given option parser to the
pcapkit.protocols.transport.tcp.TCP.__mp_option__
registry.- Parameters
code (TCP_MPTCPOption) – Multipath
TCP
option code as inMPTCPOption
.meth (str | TCP_MPOptionParser) – Method name or callable to parse the option.
- Return type
None
- pcapkit.foundation.registry.register_udp_port(code, module, class_)[source]¶
Register a new protocol class.
Notes
The full qualified class name of the new protocol class should be as
{module}.{class_}
.The function will register the given protocol class to the
pcapkit.protocols.transport.udp.UDP.__proto__
registry.
Application Layer Registries¶
Protocol Family¶
pcapkit.protocols
is collection of all protocol families,
with detailed implementation and methods.
Root Protocol¶
pcapkit.protocols.protocol
contains
Protocol
only, which is
an abstract base class for all protocol family, with pre-defined
utility arguments and methods of specified protocols.
- class pcapkit.protocols.protocol.Protocol(file=None, length=None, **kwargs)[source]¶
Bases:
Generic
[PT
]Abstract base class for all protocol family.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- __init__(file: BinaryIO, length: Optional[int] = None, **kwargs: Any) None [source]¶
- __init__(**kwargs: Any) None
Initialisation.
- Parameters
- __post_init__(file: BinaryIO, length: Optional[int] = None, **kwargs: Any) None [source]¶
- __post_init__(**kwargs: Any) None
Post initialisation hook.
- Parameters
See also
For construction arguments, please refer to
self.make
.- Return type
- __repr__()[source]¶
Returns representation of parsed protocol data.
Example
>>> protocol <Frame alias='...' frame=(..., packet=b'...', sethernet=..., protocols='Ethernet:IPv6:Raw')>
- Return type
- __str__()[source]¶
Returns formatted hex representation of source data stream.
Example
>>> protocol Frame(..., packet=b"...", sethernet=..., protocols='Ethernet:IPv6:Raw') >>> print(protocol) 00 00 00 00 00 00 00 a6 87 f9 27 93 16 ee fe 80 00 00 00 ..........'........ 00 00 00 1c cd 7c 77 ba c7 46 b7 87 00 0e aa 00 00 00 00 .....|w..F......... fe 80 00 00 00 00 00 00 1c cd 7c 77 ba c7 46 b7 01 01 a4 ..........|w..F.... 5e 60 d9 6b 97 ^`.k.
- Return type
- __iter__()[source]¶
Iterate through
self._data
.- Return type
- __getitem__(key)[source]¶
Subscription (
getitem
) support.If
key
is aProtocol
object, the method will fetch its indexes (id()
).Later, search the packet’s chain of protocols with the calculated
key
.If no matches, then raises
ProtocolNotFound
.
- Parameters
- Returns
The sub-packet from the current packet of indexed protocol.
- Raises
ProtocolNotFound – If
key
is not in the current packet.- Return type
See also
The method calls
self.expand_comp
to handle thekey
and expand it for robust searching.
- __contains__(name)[source]¶
Returns if certain protocol is in the instance.
See also
The method calls
self.expand_comp
to handle thename
and expand it for robust searching.
- abstract classmethod __index__()[source]¶
Numeral registry index of the protocol.
- Return type
StdlibEnum | AenumEnum
- __hash__()[source]¶
Return the hash value for
self._data
.- Return type
- property protochain: ProtoChain¶
Protocol chain of current instance.
- Return type
- classmethod id()[source]¶
Index ID of the protocol.
By default, it returns the name of the protocol. In certain cases, the method may return multiple values.
- static decode(byte, *, encoding=None, errors='strict')[source]¶
-
Should decoding failed using
encoding
, the method will try again decoding thebytes
as'unicode_escape'
with'replace'
for error handling.See also
The method is a wrapping function for
bytes.decode()
.- Parameters
byte (
bytes
) – Source bytestring.encoding (
Optional
[str
]) – The encoding with which to decode thebytes
. If not provided,pcapkit
will first try detecting its encoding usingchardet
. The fallback encoding would is UTF-8.errors (
Literal
[‘strict’, ‘ignore’, ‘replace’]) – The error handling scheme to use for the handling of decoding errors. The default is'strict'
meaning that decoding errors raise aUnicodeDecodeError
. Other possible values are'ignore'
and'replace'
as well as any other name registered withcodecs.register_error()
that can handleUnicodeDecodeError
.
- Return type
- static unquote(url, *, encoding='utf-8', errors='replace')[source]¶
Unquote URLs into readable format.
Should decoding failed , the method will try again replacing
'%'
with'\x'
then decoding theurl
as'unicode_escape'
with'replace'
for error handling.See also
This method is a wrapper function for
urllib.parse.unquote()
.- Parameters
url (
str
) – URL string.encoding (
str
) – The encoding with which to decode thebytes
.errors (
Literal
[‘strict’, ‘ignore’, ‘replace’]) – The error handling scheme to use for the handling of decoding errors. The default is'strict'
meaning that decoding errors raise aUnicodeDecodeError
. Other possible values are'ignore'
and'replace'
as well as any other name registered withcodecs.register_error()
that can handleUnicodeDecodeError
.
- Return type
- static expand_comp(value)[source]¶
Expand protocol class to protocol name.
The method is used to expand protocol class to protocol name, in the following manner:
If
value
is a protocol instance, the method will return the protocol class, and the protocol names in upper case obtained fromProtocol.id
.If
value
is a protocol class, the method will return the protocol class itself, and the protocols names in upper case obtained fromProtocol.id
.If
value
isstr
, the method will attempt to search for the existing registered protocol class frompcapkit.protocols.__proto__
and follow step 2; otherwise, return the value itself.
- _read_protos(size)[source]¶
Read next layer protocol type.
If succeed, returns the enum of next layer protocol.
If fail, returns
None
.
- Parameters
size (int) – buffer size
- Return type
Optional[StdlibEnum | AenumEnum]
- _read_fileng(*args, **kwargs)[source]¶
Read file buffer (
self._file
).This method wraps the
file.read
call.
- _read_unpack(size=1, *, signed=False, lilendian=False, quiet=False)[source]¶
Read bytes and unpack for integers.
- Parameters
- Return type
- Returns
Unpacked data upon success
- Raises
StructError – If unpack (
struct.pack()
) failed, andstruct.error
raised.
- _read_packet(length: Optional[int] = None, *, header: None = None) bytes [source]¶
- _read_packet(*, header: int, payload: Optional[int] = None, discard: Literal[True]) bytes
- _read_packet(*, header: int, payload: Optional[int] = None, discard: Literal[False] = False) DataType_Packet
Read raw packet data.
- Parameters
length – length of the packet
header – length of the packet header
payload – length of the packet payload
discard – flag if discard header data
- classmethod _make_pack(integer, *, size=1, signed=False, lilendian=False)[source]¶
Pack integers to bytes.
- classmethod _make_index(name: int | StdlibEnum | AenumEnum, *, pack: Literal[False] = False) int [source]¶
- classmethod _make_index(name: int | StdlibEnum | AenumEnum, *, pack: Literal[True], size: int = 4, signed: bool = False, lilendian: bool = False) bytes
- classmethod _make_index(name: str, default: Optional[int] = None, *, namespace: Type[StdlibEnum] | Type[AenumEnum], pack: Literal[False] = False) int
- classmethod _make_index(name: str, default: Optional[int] = None, *, namespace: Type[StdlibEnum] | Type[AenumEnum], pack: Literal[True], size: int = 4, signed: bool = False, lilendian: bool = False) bytes
- classmethod _make_index(name: str, default: Optional[int] = None, *, namespace: dict[int, str], reversed: Literal[False] = False, pack: Literal[False] = False) int
- classmethod _make_index(name: str, default: Optional[int] = None, *, namespace: dict[int, str], reversed: Literal[False] = False, pack: Literal[True], size: int = 4, signed: bool = False, lilendian: bool = False) bytes
- classmethod _make_index(name: str, default: Optional[int] = None, *, namespace: dict[str, int], reversed: Literal[True], pack: Literal[False] = False) int
- classmethod _make_index(name: str, default: Optional[int] = None, *, namespace: dict[str, int], reversed: Literal[True], pack: Literal[True], size: int = 4, signed: bool = False, lilendian: bool = False) bytes
Return first index of
name
from adict
or enumeration.- Parameters
name – item to be indexed
default – default value
namespace – namespace for item
reversed – if namespace is
str -> int
pairspack – if need
struct.pack()
to pack the resultsize – buffer size
signed – signed flag
lilendian – little-endian flag
- Returns
Index of
name
from a dict or enumeration. Ifpack
isTrue
, returnsbytes
; otherwise, returnsint
.- Raises
ProtocolNotImplemented – If
name
is NOT innamespace
anddefault
isNone
.
- __layer__: Optional[Literal['Link', 'Internet', 'Transport', 'Application']]¶
- __proto__: DefaultDict[int, tuple[str, str]]¶
&
self._import_next_layer
. The values should be a tuple representing the module name and class name.
- _info: PT¶
Parsed packet data.
- _file: BinaryIO¶
Source packet stream.
Data Structures¶
Auxiliary Protocols¶
pcapkit.protocols.misc
contains the auxiliary protocol implementations.
Such includes the Raw
class for not-supported
protocols, the NoPayload
class for
indication of empty payload, and PCAP header classes.
PCAP File Headers¶
pcapkit.protocols.misc.pcap
contains header descriptions for
PCAP files, including global header
(Header
) and frame header
(Frame
).
Global Header¶
pcapkit.protocols.misc.pcap.header
contains
Header
only,
which implements extractor for global headers *
of PCAP, whose structure is described as below:
typedef struct pcap_hdr_s {
guint32 magic_number; /* magic number */
guint16 version_major; /* major version number */
guint16 version_minor; /* minor version number */
gint32 thiszone; /* GMT to local correction */
guint32 sigfigs; /* accuracy of timestamps */
guint32 snaplen; /* max length of captured packets, in octets */
guint32 network; /* data link type */
} pcap_hdr_t;
- class pcapkit.protocols.misc.pcap.header.Header(file=None, length=None, **kwargs)[source]¶
-
PCAP file global header extractor.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- __post_init__(file: BinaryIO, length: Optional[int] = None, **kwargs: Any) None [source]¶
- __post_init__(**kwargs: Any) None
Post initialisation hook.
- Parameters
See also
For construction argument, please refer to
make()
.- Return type
- classmethod __index__()[source]¶
Numeral registry index of the protocol.
- Raises
UnsupportedCall – This protocol has no registry entry.
- Return type
- property name: Literal['Global Header']¶
Name of corresponding protocol.
- Return type
Literal
[‘Global Header’]
- property version: VersionInfo¶
Version infomation of input PCAP file.
- Return type
- property payload: NoReturn¶
Payload of current instance.
- Raises
UnsupportedCall – This protocol doesn’t support
payload
.- Return type
- property protochain: NoReturn¶
Protocol chain of current instance.
- Raises
UnsupportedCall – This protocol doesn’t support
protochain
.- Return type
- property byteorder: Literal['big', 'little']¶
Header byte order.
- Return type
Literal
[‘big’, ‘little’]
- read(length=None, **kwargs)[source]¶
Read global header of PCAP file.
Notes
PCAP file has four different valid magic numbers.
d4 c3 b2 a1
– Little-endian microsecond-timestamp PCAP file.a1 b2 c3 d4
– Big-endian microsecond-timestamp PCAP file.4d 3c b2 a1
– Little-endian nanosecond-timestamp PCAP file.a1 b2 3c 4d
– Big-endian nano-timestamp PCAP file.
- make(*, byteorder='little', lilendian=None, bigendian=None, nanosecond=False, version=(2, 4), version_major=None, version_minor=None, thiszone=0, sigfigs=0, snaplen=262144, network=LinkType.NULL, network_default=None, network_namespace=None, network_reversed=False, **kwargs)[source]¶
Make (construct) packet data.
- Parameters
byteorder (Literal["big", "little"]) – header byte order
lilendian (Optional[bool]) – little-endian flag
bigendian (Optional[bool]) – big-endian flag
nanosecond (bool) – nanosecond-resolution file flag
version (tuple[int, int] | VersionInfo) – version information
version_major (Optional[int]) – major version number
version_minor (Optional[int]) – minor version number
thiszone (int) – GMT to local correction
sigfigs (int) – accuracy of timestamps
snaplen (int) – max length of captured packets, in octets
network (RegType_LinkType | StdlibEnum | AenumEnum | str | int) – data link type
network_default (Optional[int]) – default value for unknown data link type
network_namespace (Optional[dict[str, int] | dict[int, str] | Type[StdlibEnum] | Type[AenumEnum]]) – data link type namespace
network_reversed (bool) – if namespace is
str -> int
pairs**kwargs (Any) – Arbitrary keyword arguments.
- Returns
Constructed packet data.
- Return type
- class pcapkit.protocols.data.misc.pcap.header.Header(magic_number, version_major, version_minor, thiszone, sigfigs, snaplen, network)[source]¶
Bases:
Info
Global header of PCAP file.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- magic_number: MagicNumber¶
Magic number.
- version: VersionInfo¶
Version number.
- class pcapkit.protocols.data.misc.pcap.header.MagicNumber(data, byteorder, nanosecond)[source]¶
Bases:
Info
Magic number of PCAP file.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- byteorder: Literal['big', 'little']¶
Byte order.
Frame Header¶
pcapkit.protocols.misc.pcap.frame
contains
Frame
only,
which implements extractor for frame headers * of PCAP,
whose structure is described as below:
typedef struct pcaprec_hdr_s {
guint32 ts_sec; /* timestamp seconds */
guint32 ts_usec; /* timestamp microseconds */
guint32 incl_len; /* number of octets of packet saved in file */
guint32 orig_len; /* actual length of packet */
} pcaprec_hdr_t;
- class pcapkit.protocols.misc.pcap.frame.Frame(file=None, length=None, **kwargs)[source]¶
-
Per packet frame header extractor.
This class currently supports parsing of the following protocols, which are registered in the
self.__proto__
attribute:Index
Protocol
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- __post_init__(file: BinaryIO, length: Optional[int] = None, *, num: int, header: DataType_Header, **kwargs: Any) None [source]¶
- __post_init__(*, num: int, header: DataType_Header, **kwargs: Any) None
Initialisation.
- Parameters
See also
For construction argument, please refer to
make()
.- Return type
- classmethod register(code, module, class_)[source]¶
Register a new protocol class.
Notes
The full qualified class name of the new protocol class should be as
{module}.{class_}
.
- index(name)[source]¶
Call
ProtoChain.index
.
- make(*, timestamp=None, ts_sec=None, ts_usec=None, incl_len=None, orig_len=None, packet, nanosecond=False, **kwargs)[source]¶
Make frame packet data.
- Parameters
timestamp (Optional[float | Decimal]) – UNIX-Epoch timestamp
ts_sec (Optional[int]) – timestamp seconds
ts_usec (Optional[int]) – timestamp microseconds
incl_len (Optional[int]) – number of octets of packet saved in file
orig_len (Optional[int]) – actual length of packet
packet (bytes) – raw packet data
nanosecond (bool) – nanosecond-resolution file flag
**kwargs (Any) – Arbitrary keyword arguments.
- Returns
Constructed packet data.
- Return type
- class pcapkit.protocols.data.misc.pcap.frame.Frame(frame_info, time, number, time_epoch, time_delta, len, cap_len)[source]¶
Bases:
Info
Frame header of PCAP file.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- time: datetime¶
Timestamp instance.
- time_epoch: Decimal¶
UNIX timestamp.
- class pcapkit.protocols.data.misc.pcap.frame.FrameInfo(ts_sec, ts_usec, incl_len, orig_len)[source]¶
Bases:
Info
Frame metadata information.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
Raw Packet Data¶
pcapkit.protocols.misc.raw
contains
Raw
only, which implements
extractor for unknown protocol, and constructs a
Protocol
like object.
- class pcapkit.protocols.misc.raw.Raw(file=None, length=None, **kwargs)[source]¶
-
This class implements universal unknown protocol.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- __post_init__(file: BinaryIO, length: Optional[int] = None, **kwargs: Any) None [source]¶
- __post_init__(**kwargs: Any) None
Post initialisation hook.
Would
pcapkit
encounter malformed packets, the original parsing error instance will be provided as inerror
.- Parameters
See also
For construction argument, please refer to
make()
.- Return type
- classmethod __index__()[source]¶
Numeral registry index of the protocol.
- Raises
UnsupportedCall – This protocol has no registry entry.
- Return type
- property protocol: NoReturn¶
Name of next layer protocol.
- Raises
UnsupportedCall – This protocol doesn’t support
protocol
.- Return type
Data Structures¶
No-Payload Packet¶
pcapkit.protocols.null
contains
NoPayload
only, which
implements a Protocol
like
object whose payload is recursively
NoPayload
itself.
- class pcapkit.protocols.misc.null.NoPayload(file=None, length=None, **kwargs)[source]¶
-
This class implements no-payload protocol.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- __post_init__(file: BinaryIO, length: Optional[int] = None, **kwargs: Any) None [source]¶
- __post_init__(**kwargs: Any) None
Post initialisation hook.
- classmethod __index__()[source]¶
Numeral registry index of the protocol.
- Raises
UnsupportedCall – This protocol has no registry entry.
- Return type
- property protocol: NoReturn¶
Name of next layer protocol.
- Raises
UnsupportedCall – This protocol doesn’t support
protocol
.- Return type
Data Structures¶
Link Layer Protocols¶
pcapkit.protocols.link
is collection of all protocols in
link layer, with detailed implementation and methods.
Base Protocol¶
pcapkit.protocols.link.link
contains Link
,
which is a base class for link layer protocols, e.g. ARP
/InARP,
Ethernet
, L2TP
,
OSPF
, RARP
/DRARP and etc.
- class pcapkit.protocols.link.link.Link(file=None, length=None, **kwargs)[source]¶
Bases:
Protocol
[PT
],Generic
[PT
]Abstract base class for link layer protocol family.
This class currently supports parsing of the following protocols, which are registered in the
self.__proto__
attribute:Index
Protocol
0x8137
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- classmethod register(code, module, class_)[source]¶
Register a new protocol class.
Notes
The full qualified class name of the new protocol class should be as
{module}.{class_}
.
- __layer__: Optional[Literal['Link', 'Internet', 'Transport', 'Application']] = 'Link'¶
Layer of protocol.
Ethernet Protocol¶
pcapkit.protocols.link.ethernet
contains
Ethernet
only, which implements extractor for Ethernet
Protocol *, whose structure is described as
below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Destination MAC Address |
1 |
8 |
|
Source MAC Address |
2 |
16 |
|
Protocol (Internet Layer) |
- class pcapkit.protocols.link.ethernet.Ethernet(file=None, length=None, **kwargs)[source]¶
-
This class implements Ethernet Protocol.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- property name: Literal['Ethernet Protocol']¶
Name of current protocol.
- Return type
Literal
[‘Ethernet Protocol’]
- read(length=None, **kwargs)[source]¶
Read Ethernet Protocol.
Structure of Ethernet header [RFC 7042]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Dst MAC Addr | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Src MAC Addr | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Ether Type | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Data Structures¶
- class pcapkit.protocols.data.link.ethernet.Ethernet(dst, src, type)[source]¶
Bases:
Info
Data model for ethernet packet.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
ARP/InARP - (Inverse) Address Resolution Protocol¶
pcapkit.protocols.link.arp
contains
ARP
only,
which implements extractor for (Inverse) Address Resolution
Protocol (ARP/InARP) *, whose structure is described as
below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Hardware Type |
2 |
16 |
|
Protocol Type |
4 |
32 |
|
Hardware Address Length |
5 |
40 |
|
Protocol Address Length |
6 |
48 |
|
Operation |
8 |
64 |
|
Sender Hardware Address |
14 |
112 |
|
Sender Protocol Address |
18 |
144 |
|
Target Hardware Address |
24 |
192 |
|
Target Protocol Address |
- class pcapkit.protocols.link.arp.ARP(file=None, length=None, **kwargs)[source]¶
-
This class implements all protocols in ARP family.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- property name: Literal['Dynamic Reverse Address Resolution Protocol', 'Inverse Address Resolution Protocol', 'Reverse Address Resolution Protocol', 'Address Resolution Protocol']¶
Name of current protocol.
- Return type
Literal
[‘Dynamic Reverse Address Resolution Protocol’, ‘Inverse Address Resolution Protocol’, ‘Reverse Address Resolution Protocol’, ‘Address Resolution Protocol’]
- property alias: Literal['ARP', 'InARP', 'RARP', 'DRARP']¶
Acronym of corresponding protocol.
- Return type
Literal
[‘ARP’, ‘InARP’, ‘RARP’, ‘DRARP’]
- classmethod id()[source]¶
Index ID of the protocol.
- Return type
tuple[Literal[“ARP”], Literal[“InARP”]]
- read(length=None, **kwargs)[source]¶
Read Address Resolution Protocol.
Data structure of ARP Request header [RFC 826]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Hdr Type | Proto Type | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Hdr Len | Proto Len | Operation | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \ Sender Hdr Addr \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \ Sender Proto Addr \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \ Target Hdr Addr \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \ Target Proto Addr \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- class pcapkit.protocols.link.InARP¶
Alias of
pcapkit.protocols.link.arp.ARP
.
Data Structures¶
- class pcapkit.protocols.data.link.arp.ARP(htype, ptype, hlen, plen, oper, sha, spa, tha, tpa, len)[source]¶
Bases:
Info
Data model for ARP packet.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.link.arp.Address(hardware, protocol)[source]¶
Bases:
Info
Data model for ARP addresses.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.link.arp.Type(hardware, protocol)[source]¶
Bases:
Info
Data model for ARP type.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
RARP/DRARP - (Dynamic) Reverse Address Resolution Protocol¶
pcapkit.protocols.link.rarp
contains
RARP
only,
which implements extractor for (Dynamic) Reverse
Address Resolution Protocol (RARP/DRARP) *,
whose structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Hardware Type |
2 |
16 |
|
Protocol Type |
4 |
32 |
|
Hardware Address Length |
5 |
40 |
|
Protocol Address Length |
6 |
48 |
|
Operation |
8 |
64 |
|
Sender Hardware Address |
14 |
112 |
|
Sender Protocol Address |
18 |
144 |
|
Target Hardware Address |
24 |
192 |
|
Target Protocol Address |
- class pcapkit.protocols.link.rarp.RARP(file=None, length=None, **kwargs)[source]¶
Bases:
ARP
This class implements Reverse Address Resolution Protocol.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- class pcapkit.protocols.link.DRARP¶
Alias of
pcapkit.protocols.link.rarp.RARP
.
L2TP - Layer Two Tunnelling Protocol¶
pcapkit.protocols.link.l2tp
contains
L2TP
only,
which implements extractor for Layer Two Tunnelling
Protocol (L2TP) *, whose structure is described
as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Flags and Version Info |
0 |
0 |
|
Type (control / data) |
0 |
1 |
|
Length |
0 |
2 |
Reserved (must be zero |
|
0 |
4 |
|
Sequence |
0 |
5 |
Reserved (must be zero |
|
0 |
6 |
|
Offset |
0 |
7 |
|
Priority |
1 |
8 |
Reserved (must be zero |
|
1 |
12 |
|
Version ( |
2 |
16 |
|
Length (optional by |
4 |
32 |
|
Tunnel ID |
6 |
48 |
|
Session ID |
8 |
64 |
|
Sequence Number (optional by |
10 |
80 |
|
Next Sequence Number (optional by |
12 |
96 |
|
Offset Size (optional by |
- class pcapkit.protocols.link.l2tp.L2TP(file=None, length=None, **kwargs)[source]¶
-
This class implements Layer Two Tunnelling Protocol.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- classmethod __index__()[source]¶
Numeral registry index of the protocol.
- Raises
UnsupportedCall – This protocol has no registry entry.
- Return type
- property name: Literal['Layer 2 Tunnelling Protocol']¶
Name of current protocol.
- Return type
Literal
[‘Layer 2 Tunnelling Protocol’]
- read(length=None, **kwargs)[source]¶
Read Layer Two Tunnelling Protocol.
Structure of L2TP header [RFC 2661]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |T|L|x|x|S|x|O|P|x|x|x|x| Ver | Length (opt) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Tunnel ID | Session ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Ns (opt) | Nr (opt) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Offset Size (opt) | Offset pad... (opt) +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Data Structures¶
- class pcapkit.protocols.data.link.l2tp.L2TP(flags, version, length, tunnelid, sessionid, ns, nr, offset)[source]¶
Bases:
Info
Data model for L2TP packet.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.link.l2tp.Flags(type, len, seq, offset, prio)[source]¶
Bases:
Info
Data model for L2TP flags and version info.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
OSPF - Open Shortest Path First¶
pcapkit.protocols.link.ospf
contains
OSPF
only,
which implements extractor for Open Shortest Path
First (OSPF) *, whose structure is described
as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Version Number |
0 |
0 |
|
Type |
0 |
1 |
|
Packet Length (header included) |
0 |
2 |
|
Router ID |
0 |
4 |
|
Area ID |
0 |
6 |
|
Checksum |
0 |
7 |
|
Authentication Type |
1 |
8 |
|
Authentication |
- class pcapkit.protocols.link.ospf.OSPF(file=None, length=None, **kwargs)[source]¶
-
This class implements Open Shortest Path First.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- classmethod __index__()[source]¶
Numeral registry index of the protocol.
- Raises
UnsupportedCall – This protocol has no registry entry.
- Return type
- read(length=None, **kwargs)[source]¶
Read Open Shortest Path First.
Structure of OSPF header [RFC 2328]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Version # | Type | Packet length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Router ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Area ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Checksum | AuType | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Authentication | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Authentication | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- _read_encrypt_auth()[source]¶
Read Authentication field when Cryptographic Authentication is employed, i.e.
autype
is2
.Structure of Cryptographic Authentication [RFC 2328]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 0 | Key ID | Auth Data Len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Cryptographic sequence number | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
length – packet length
- Return type
- Returns
Parsed packet data.
Data Structures¶
- class pcapkit.protocols.data.link.ospf.OSPF(version, type, length, router_id, area_id, chksum, autype)[source]¶
Bases:
Info
Data model for OSPF packet.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- router_id: IPv4Address¶
Router ID.
- area_id: IPv4Address¶
Area ID.
- autype: Authentication¶
Authentication type.
- auth: bytes | CrytographicAuthentication¶
Authentication.
- class pcapkit.protocols.data.link.ospf.CrytographicAuthentication(key_id, len, seq)[source]¶
Bases:
Info
Data model for OSPF crytographic authentication.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
VLAN - 802.1Q Customer VLAN Tag Type¶
pcapkit.protocols.link.vlan
contains
VLAN
only, which implements extractor for 802.1Q
Customer VLAN Tag Type *, whose structure is
described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
1 |
0 |
|
Tag Control Information |
1 |
0 |
|
Priority Code Point |
1 |
3 |
|
Drop Eligible Indicator |
1 |
4 |
|
VLAN Identifier |
3 |
24 |
|
Protocol (Internet Layer) |
- class pcapkit.protocols.link.vlan.VLAN(file=None, length=None, **kwargs)[source]¶
-
This class implements 802.1Q Customer VLAN Tag Type.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- classmethod __index__()[source]¶
Numeral registry index of the protocol.
- Raises
UnsupportedCall – This protocol has no registry entry.
- Return type
- property name: Literal['802.1Q Customer VLAN Tag Type']¶
Name of current protocol.
- Return type
Literal
[‘802.1Q Customer VLAN Tag Type’]
- read(length=None, **kwargs)[source]¶
Read 802.1Q Customer VLAN Tag Type.
Structure of 802.1Q Customer VLAN Tag Type [IEEE 802.1Q]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TCI | | |-------------------------------| | | P |D| | Type | | C |E| VID | | | P |I| | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Data Structures¶
- class pcapkit.protocols.data.link.vlan.VLAN(tci, type)[source]¶
Bases:
Info
Data model for 802.1Q customer VLAN tag type.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.link.vlan.TCI(pcp, dei, vid)[source]¶
Bases:
Info
Data model for tag control information.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- pcp: PriorityLevel¶
Priority code point.
Todo
Implements DSL, EAPOL, FDDI, ISDN, NDP, PPP.
Protocol Registry¶
- pcapkit.protocols.link.LINKTYPE¶
Alias of
pcapkit.const.reg.linktype.LinkType
.
Internet Layer Protocols¶
pcapkit.protocols.internet
is collection of all protocols in
internet layer, with detailed implementation and methods.
Base Protocol¶
pcapkit.protocols.internet.internet
contains Internet
,
which is a base class for internet layer protocols, eg. AH
,
IPsec
, IPv4
,
IPv6
, IPX
, and etc.
- class pcapkit.protocols.internet.internet.Internet(file=None, length=None, **kwargs)[source]¶
Bases:
Protocol
[PT
],Generic
[PT
]Abstract base class for internet layer protocol family.
This class currently supports parsing of the following protocols, which are registered in the
self.__proto__
attribute:Index
Protocol
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- classmethod register(code, module, class_)[source]¶
Register a new protocol class.
Notes
The full qualified class name of the new protocol class should be as
{module}.{class_}
.
- _decode_next_layer(dict_, proto=None, length=None, *, version=4, ipv6_exthdr=None)[source]¶
Decode next layer extractor.
- Parameters
- Return type
TypeVar
(PT
, bound= Info)- Returns
Current protocol with next layer extracted.
- _import_next_layer(proto, length=None, *, version=4, extension=False)[source]¶
Import next layer extractor.
- __layer__: Optional[Literal['Link', 'Internet', 'Transport', 'Application']] = 'Internet'¶
Layer of protocol.
- __proto__: DefaultDict[int, tuple[str, str]]¶
Protocol index mapping for decoding next layer, c.f.
self._decode_next_layer
&self._import_next_layer
.
IP - Internet Protocol¶
pcapkit.protocols.internet.ip
contains
IP
only,
which is a base class for Internet Protocol (IP)
protocol family *, eg.
IPv4
,
IPv6
, and
IPsec
.
- class pcapkit.protocols.internet.ip.IP(file=None, length=None, **kwargs)[source]¶
Bases:
Internet
[PT
],Generic
[PT
]This class implements all protocols in IP family.
Authentication Header (
pcapkit.~protocols.internet.ah.AH
) [RFC 4302]Encapsulating Security Payload (
ESP
) [RFC 4303]
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
IPv4 - Internet Protocol version 4¶
pcapkit.protocols.internet.ipv4
contains
IPv4
only,
which implements extractor for Internet Protocol
version 4 (IPv4) *, whose structure is described
as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Version ( |
0 |
4 |
|
Internal Header Length (IHL) |
1 |
8 |
|
Differentiated Services Code Point (DSCP) |
1 |
14 |
|
Explicit Congestion Notification (ECN) |
2 |
16 |
|
Total Length |
4 |
32 |
|
Identification |
6 |
48 |
Reserved Bit (must be |
|
6 |
49 |
|
Don’t Fragment (DF) |
6 |
50 |
|
More Fragments (MF) |
6 |
51 |
|
Fragment Offset |
8 |
64 |
|
Time To Live (TTL) |
9 |
72 |
|
Protocol (Transport Layer) |
10 |
80 |
|
Header Checksum |
12 |
96 |
|
Source IP Address |
16 |
128 |
|
Destination IP Address |
20 |
160 |
|
IP Options (if IHL > |
- class pcapkit.protocols.internet.ipv4.IPv4(file=None, length=None, **kwargs)[source]¶
-
This class implements Internet Protocol version 4.
This class currently supports parsing of the following IPv4 options, which are directly mapped to the
pcapkit.const.ipv4.option_number.OptionNumber
enumeration:Option Code
Option Parser
ESEC
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- property name: Literal['Internet Protocol version 4']¶
Name of corresponding protocol.
- Return type
Literal[“Internet Protocol version 4”]
- property src: IPv4Address¶
Source IP address.
- Return type
- property dst: IPv4Address¶
Destination IP address.
- Return type
- read(length=None, **kwargs)[source]¶
Read Internet Protocol version 4 (IPv4).
Structure of IPv4 header [RFC 791]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Version| IHL |Type of Service| Total Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Identification |Flags| Fragment Offset | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Time to Live | Protocol | Header Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Source Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Destination Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Options | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- classmethod id()[source]¶
Index ID of the protocol.
- Return type
tuple[Literal[“IPv4”]]
- Returns
Index ID of the protocol.
- _read_ipv4_opt_type(code)[source]¶
Read option type field.
- Parameters
code (
int
) – option kind value- Return type
- Returns
Extracted IPv4 option type, as an object of the option flag (copied flag), option class, and option number.
- _read_ipv4_options(length)[source]¶
Read IPv4 option list.
- Parameters
length (int) – length of options
- Return type
- Returns
Extracted IPv4 options.
- Raises
ProtocolError – If the threshold is NOT matching.
- _read_opt_unassigned(kind, *, options)[source]¶
Read IPv4 unassigned options.
Structure of IPv4 unassigned options [RFC 791]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | type | length | option data ... +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
kind (RegType_OptionNumber) – option type code
options (Option) – extracted IPv4 options
- Return type
DataType_UnassignedOption
- Returns
Parsed option data.
- Raises
ProtocolError – If
size
is LESS THAN3
.
- _read_opt_eool(kind, *, options)[source]¶
Read IPv4 End of Option List (
EOOL
) option.Structure of IPv4 End of Option List (
EOOL
) option [RFC 719]:+--------+ |00000000| +--------+ Type=0
- Parameters
kind (RegType_OptionNumber) – option type code
options (Option) – extracted IPv4 options
- Return type
DataType_EOOLOption
- Returns
Parsed option data.
- _read_opt_nop(kind, *, options)[source]¶
Read IPv4 No Operation (
NOP
) option.Structure of IPv4 No Operation (
NOP
) option [RFC 719]:+--------+ |00000001| +--------+ Type=1
- Parameters
kind (RegType_OptionNumber) – option type code
options (Option) – extracted IPv4 options
- Return type
DataType_NOPOption
- Returns
Parsed option data.
- _read_opt_sec(kind, *, options)[source]¶
Read IPv4 Security (
SEC
) option.Structure of IPv4 Security (
SEC
) option [RFC 1108]:+------------+------------+------------+-------------//----------+ | 10000010 | XXXXXXXX | SSSSSSSS | AAAAAAA[1] AAAAAAA0 | | | | | [0] | +------------+------------+------------+-------------//----------+ TYPE = 130 LENGTH CLASSIFICATION PROTECTION LEVEL AUTHORITY FLAGS
- Parameters
kind (RegType_OptionNumber) – option type code
options (Option) – extracted IPv4 options
- Return type
DataType_SECOption
- Returns
Parsed option data.
- Raises
ProtocolError – If
size
is LESS THAN3
.
- _read_opt_lsr(kind, *, options)[source]¶
Read IPv4 Loose Source Route (
LSR
) option.Structure of IPv4 Loose Source Route (
LSR
) option [RFC 791]:+--------+--------+--------+---------//--------+ |10000011| length | pointer| route data | +--------+--------+--------+---------//--------+
- Parameters
kind (RegType_OptionNumber) – option type code
options (Option) – extracted IPv4 options
- Return type
DataType_LSROption
- Returns
Parsed option data.
- Raises
ProtocolError – If option is malformed.
- _read_opt_ts(kind, *, options)[source]¶
Read IPv4 Time Stamp (
TS
) option.Structure of IPv4 Time Stamp (
TS
) option [RFC 791]:+--------+--------+--------+--------+ |01000100| length | pointer|oflw|flg| +--------+--------+--------+--------+ | internet address | +--------+--------+--------+--------+ | timestamp | +--------+--------+--------+--------+ | . | . .
- Parameters
kind (RegType_OptionNumber) – option type code
options (Option) – extracted IPv4 options
- Return type
DataType_TSOption
- Returns
Parsed option data.
- Raises
ProtocolError – If the option is malformed.
- _read_opt_esec(kind, *, options)[source]¶
Read IPv4 Extended Security (
ESEC
) option.Structure of IPv4 Extended Security (
ESEC
) option [RFC 1108]:+------------+------------+------------+-------//-------+ | 10000101 | 000LLLLL | AAAAAAAA | add sec info | +------------+------------+------------+-------//-------+ TYPE = 133 LENGTH ADDITIONAL ADDITIONAL SECURITY INFO SECURITY FORMAT CODE INFO
- Parameters
kind (RegType_OptionNumber) – option type code
options (Option) – extracted IPv4 options
- Return type
DataType_ESECOption
- Returns
Parsed option data.
- Raises
ProtocolError – If
size
is LESS THAN3
.
- _read_opt_rr(kind, *, options)[source]¶
Read IPv4 Record Route (
RR
) option.Structure of IPv4 Record Route (
RR
) option [RFC 791]:+--------+--------+--------+---------//--------+ |00000111| length | pointer| route data | +--------+--------+--------+---------//--------+ Type=7
- Parameters
kind (RegType_OptionNumber) – option type code
options (Option) – extracted IPv4 options
- Return type
DataType_RROption
- Returns
Parsed option data.
- Raises
ProtocolError – If option is malformed.
- _read_opt_sid(kind, *, options)[source]¶
Read IPv4 Stream ID (
SID
) option.Structure of IPv4 Stream ID (
SID
) option [RFC 791][RFC 6814]:+--------+--------+--------+--------+ |10001000|00000010| Stream ID | +--------+--------+--------+--------+ Type=136 Length=4
- Parameters
kind (RegType_OptionNumber) – option type code
options (Option) – extracted IPv4 options
- Return type
DataType_SIDOption
- Returns
Parsed option data.
- Raises
ProtocolError – If
size
is NOT4
.
- _read_opt_ssr(kind, *, options)[source]¶
Read IPv4 Strict Source Route (
SSR
) option.Structure of IPv4 Strict Source Route (
SSR
) option [RFC 791]:+--------+--------+--------+---------//--------+ |10001001| length | pointer| route data | +--------+--------+--------+---------//--------+ Type=137
- Parameters
kind (RegType_OptionNumber) – option type code
options (Option) – extracted IPv4 options
- Return type
DataType_SSROption
- Returns
Parsed option data.
- Raises
ProtocolError – If option is malformed.
- _read_opt_mtup(kind, *, options)[source]¶
Read IPv4 MTU Probe (
MTUP
) option.Structure of IPv4 MTU Probe (
MTUP
) option [RFC 1063][RFC 1191]:+--------+--------+--------+--------+ |00001011|00000100| 2 octet value | +--------+--------+--------+--------+
- Parameters
kind (RegType_OptionNumber) – option type code
options (Option) – extracted IPv4 options
- Return type
DataType_MTUPOption
- Returns
Parsed option data.
- Raises
ProtocolError – If
size
is NOT4
.
- _read_opt_mtur(kind, *, options)[source]¶
Read IPv4 MTU Reply (
MTUR
) option.Structure of IPv4 MTU Reply (
MTUR
) option [RFC 1063][RFC 1191]:+--------+--------+--------+--------+ |00001100|00000100| 2 octet value | +--------+--------+--------+--------+
- Parameters
kind (RegType_OptionNumber) – option type code
options (Option) – extracted IPv4 options
- Return type
DataType_MTUROption
- Returns
Parsed option data.
- Raises
ProtocolError – If
size
is NOT4
.
- _read_opt_tr(kind, *, options)[source]¶
Read IPv4 Traceroute (
TR
) option.Structure of IPv4 Traceroute (
TR
) option [RFC 1393][RFC 6814]:0 8 16 24 +-+-+-+-+-+-+-+-+---------------+---------------+---------------+ |F| C | Number | Length | ID Number | +-+-+-+-+-+-+-+-+---------------+---------------+---------------+ | Outbound Hop Count | Return Hop Count | +---------------+---------------+---------------+---------------+ | Originator IP Address | +---------------+---------------+---------------+---------------+
- Parameters
kind (RegType_OptionNumber) – option type code
options (Option) – extracted IPv4 options
- Return type
DataType_TROption
- Returns
Parsed option data.
- Raises
ProtocolError – If
size
is NOT12
.
- _read_opt_rtralt(kind, *, options)[source]¶
Read IPv4 Router Alert (
RTRALT
) option.Structure of IPv4 Router Alert (
RTRALT
) option [RFC 2113]:+--------+--------+--------+--------+ |10010100|00000100| 2 octet value | +--------+--------+--------+--------+
- Parameters
kind (RegType_OptionNumber) – option type code
options (Option) – extracted IPv4 options
- Return type
DataType_RTRALTOption
- Returns
Parsed option data.
- Raises
ProtocolError – If
size
is NOT4
.
- _read_opt_qs(kind, *, options)[source]¶
Read IPv4 Quick Start (
QS
) option.Structure of IPv4 Quick Start (
QS
) option [RFC 4782]:A Quick-Start Request
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option | Length=8 | Func. | Rate | QS TTL | | | | 0000 |Request| | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | QS Nonce | R | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Report of Approved Rate
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option | Length=8 | Func. | Rate | Not Used | | | | 1000 | Report| | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | QS Nonce | R | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
kind (RegType_OptionNumber) – option type code
options (Option) – extracted IPv4 options
- Return type
DataType_QSOption
- Returns
Parsed option data.
- Raises
ProtocolError – If the option is malformed.
Data Structures¶
- class pcapkit.protocols.data.internet.ipv4.IPv4(version, hdr_len, tos, len, id, flags, offset, ttl, protocol, checksum, src, dst)[source]¶
Bases:
Info
Data model for IPv4 packet.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- version: Literal[4]¶
Version.
- ttl: timedelta¶
Time to live.
- src: IPv4Address¶
Source address.
- dst: IPv4Address¶
Destination address.
- options: OrderedMultiDict[OptionNumber, Option]¶
- class pcapkit.protocols.data.internet.ipv4.ToSField(pre, del, thr, rel, ecn)[source]¶
Bases:
Info
Data model for IPv4 ToS fields.
Important
Due to the preserved keyword conflict, please use
from_dict()
to create an instance of this data model.- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
- pre: ToSPrecedence¶
Precedence.
- thr: ToSThroughput¶
Throughput.
- rel: ToSReliability¶
Reliability.
- class pcapkit.protocols.data.internet.ipv4.Flags(df, mf)[source]¶
Bases:
Info
Data model for IPv4 Flags.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv4.Option(code, length, type)[source]¶
Bases:
Info
Data model for IPv4 options.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- code: OptionNumber¶
Option code.
- type: OptionType¶
Option type.
- class pcapkit.protocols.data.internet.ipv4.OptionType(change, class, number)[source]¶
Bases:
Info
Data model for IPv4 option type data.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
- class: OptionClass¶
Option class.
- class pcapkit.protocols.data.internet.ipv4.UnassignedOption(code, length, type, data)[source]¶
Bases:
Option
Data model for IPv4 unassigned option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv4.EOOLOption(code, length, type)[source]¶
Bases:
Option
Data model for IPv4 End of Option List (
EOOL
) option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv4.NOPOption(code, length, type)[source]¶
Bases:
Option
Data model for IPv4 No Operation (
NOP
) option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv4.SECOption(code, length, type, level, flags)[source]¶
Bases:
Option
Data model for IPv4 Security (
SEC
) option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- level: ClassificationLevel¶
Classification level.
- flags: Optional[OrderedMultiDict[ProtectionAuthority, bool]]¶
Protection authority flags.
- class pcapkit.protocols.data.internet.ipv4.LSROption(code, length, type, pointer, route)[source]¶
Bases:
Option
Data model for IPv4 Loose Source Route (
LSR
) option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv4.TSOption(code, length, type, pointer, overflow, flag, timestamp)[source]¶
Bases:
Option
Data model for IPv4 Time Stamp (
TS
) option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- timestamp: Optional[bytes | tuple[dt_type, ...] | OrderedMultiDict[IPv4Address, dt_type]]¶
Timestamp data.
- class pcapkit.protocols.data.internet.ipv4.ESECOption(code, length, type, level, flags)[source]¶
Bases:
Option
Data model for IPv4 Extended Security (
ESEC
) option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- level: ClassificationLevel¶
Classification level.
- flags: Optional[OrderedMultiDict[ProtectionAuthority, bool]]¶
Protection authority flags.
- class pcapkit.protocols.data.internet.ipv4.RROption(code, length, type, pointer, route)[source]¶
Bases:
Option
Data model for IPv4 Record Route (
RR
) option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv4.SIDOption(code, length, type, sid)[source]¶
Bases:
Option
Data model for IPv4 Stream ID (
SID
) option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv4.SSROption(code, length, type, pointer, route)[source]¶
Bases:
Option
Data model for IPv4 Strict Source Route (
SSR
) option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv4.MTUPOption(code, length, type, mtu)[source]¶
Bases:
Option
Data model for IPv4 MTU Probe (
MTUP
) option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv4.MTUROption(code, length, type, mtu)[source]¶
Bases:
Option
Data model for IPv4 MTU Reply (
MTUR
) option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv4.TROption(code, length, type, id, outbound, return, originator)[source]¶
Bases:
Option
Data model for IPv4 Traceroute (
TR
) option.Important
Due to the preserved keyword conflict, please use
from_dict()
to create an instance of this data model.- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
- originator: IPv4Address¶
- class pcapkit.protocols.data.internet.ipv4.RTRALTOption(code, length, type, alert)[source]¶
Bases:
Option
Data model for IPv4 Router Alert (
RTRALT
) option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- alert: RouterAlert¶
Router alert.
- class pcapkit.protocols.data.internet.ipv4.QSOption(code, length, type, func, rate, ttl, nounce)[source]¶
Bases:
Option
Data model for IPv4 Quick Start (
QS
) option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- func: QSFunction¶
QS function.
- ttl: Optional[timedelta]¶
TTL.
IPv6 - Internet Protocol version 6¶
pcapkit.protocols.internet.ipv6
contains
IPv6
only,
which implements extractor for Internet Protocol
version 6 (IPv6) *, whose structure is described
as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Version ( |
0 |
4 |
|
Traffic Class |
1 |
12 |
|
Flow Label |
4 |
32 |
|
Payload Length (header excludes) |
6 |
48 |
|
Next Header |
7 |
56 |
|
Hop Limit |
8 |
64 |
|
Source Address |
24 |
192 |
|
Destination Address |
- class pcapkit.protocols.internet.ipv6.IPv6(file=None, length=None, **kwargs)[source]¶
-
This class implements Internet Protocol version 6.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- property name: Literal['Internet Protocol version 6']¶
Name of corresponding protocol.
- Return type
Literal
[‘Internet Protocol version 6’]
- property src: IPv6Address¶
Source IP address.
- Return type
- property dst: IPv6Address¶
Destination IP address.
- Return type
- property extension_headers: OrderedMultiDict[ExtensionHeader, Protocol]¶
IPv6 extension header records.
- Return type
- read(length=None, **kwargs)[source]¶
Read Internet Protocol version 6 (IPv6).
Structure of IPv6 header [RFC 2460]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Version| Traffic Class | Flow Label | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Payload Length | Next Header | Hop Limit | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + + | | + Source Address + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + + | | + Destination Address + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- classmethod id()[source]¶
Index ID of the protocol.
- Returns
Index ID of the protocol.
- Return type
tuple[Literal[“IPv6”]]
Data Structures¶
- class pcapkit.protocols.data.internet.ipv6.IPv6(version, class, label, payload, next, limit, src, dst)[source]¶
Bases:
Info
Data model for Internet Protocol version 6.
Important
Due to the preserved keyword conflict, please use
from_dict()
to create an instance of this data model.- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
- version: Literal[6]¶
Version.
- src: IPv6Address¶
Source address.
- dst: IPv6Address¶
Destination address.
IPv6-Frag - Fragment Header for IPv6¶
pcapkit.protocols.internet.ipv6_frag
contains
IPv6_Frag
only, which implements extractor for Fragment Header for
IPv6 (IPv6-Frag) *, whose structure is described as
below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Next Header |
1 |
8 |
Reserved |
|
2 |
16 |
|
Fragment Offset |
3 |
29 |
Reserved |
|
3 |
31 |
|
More Flag |
4 |
32 |
|
Identification |
- class pcapkit.protocols.internet.ipv6_frag.IPv6_Frag(file=None, length=None, **kwargs)[source]¶
-
This class implements Fragment Header for IPv6.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- __post_init__(file: BinaryIO, length: Optional[int] = None, *, extension: bool = False, **kwargs: Any) None [source]¶
- __post_init__(**kwargs: Any) None
Post initialisation hook.
- Parameters
- Keyword Arguments
extension – If the protocol is used as an IPv6 extension header.
**kwargs – Arbitrary keyword arguments.
See also
For construction argument, please refer to
make()
.- Return type
- property name: Literal['Fragment Header for IPv6']¶
Name of current protocol.
- Return type
Literal
[‘Fragment Header for IPv6’]
- property alias: Literal['IPv6-Frag']¶
Acronym of corresponding protocol.
- Return type
Literal
[‘IPv6-Frag’]
- property payload: Protocol | NoReturn¶
Payload of current instance.
- Raises
UnsupportedCall – if the protocol is used as an IPv6 extension header
- property protocol: Optional[str] | NoReturn¶
Name of next layer protocol (if any).
- Raises
UnsupportedCall – if the protocol is used as an IPv6 extension header
- property protochain: ProtoChain | NoReturn¶
Protocol chain of current instance.
- Raises
UnsupportedCall – if the protocol is used as an IPv6 extension header
- read(length=None, *, extension=False, **kwargs)[source]¶
Read Fragment Header for IPv6.
Structure of IPv6-Frag header [RFC 8200]:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Reserved | Fragment Offset |Res|M| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Identification | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Data Structures¶
- class pcapkit.protocols.data.internet.ipv6_frag.IPv6_Frag(next, offset, mf, id)[source]¶
Bases:
Info
Data model for IPv6 fragment header.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
IPv6-Opts - Destination Options for IPv6¶
pcapkit.protocols.internet.ipv6_opts
contains
IPv6_Opts
only, which implements extractor for Destination Options
for IPv6 (IPv6-Opts) *, whose structure is described
as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Next Header |
1 |
8 |
|
Header Extensive Length |
2 |
16 |
|
Options |
- class pcapkit.protocols.internet.ipv6_opts.IPv6_Opts(file=None, length=None, **kwargs)[source]¶
-
This class implements Destination Options for IPv6.
This class currently supports parsing of the following IPv6 Hop-by-Hop options, which are registered in the
self.__option__
attribute:Option Code
Option Parser
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- __post_init__(file: BinaryIO, length: Optional[int] = None, *, extension: bool = False, **kwargs: Any) None [source]¶
- __post_init__(**kwargs: Any) None
Post initialisation hook.
- Parameters
See also
For construction argument, please refer to
make()
.- Return type
- property name: Literal['Destination Options for IPv6']¶
Name of current protocol.
- Return type
Literal[“Destination Options for IPv6”]
- property payload: Protocol | NoReturn¶
Payload of current instance.
- Raises
UnsupportedCall – if the protocol is used as an IPv6 extension header
- Return type
- property protocol: Optional[str] | NoReturn¶
Name of next layer protocol (if any).
- Raises
UnsupportedCall – if the protocol is used as an IPv6 extension header
- property protochain: ProtoChain | NoReturn¶
Protocol chain of current instance.
- Raises
UnsupportedCall – if the protocol is used as an IPv6 extension header
- Return type
ProtoChain | NoReturn
- read(length=None, *, extension=False, **kwargs)[source]¶
Read Destination Options for IPv6.
Structure of IPv6-Opts header [RFC 8200]:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Hdr Ext Len | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | . . . Options . . . | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- classmethod register_option(code, meth)[source]¶
Register an option parser.
- Parameters
code (RegType_Option) – IPv6-Opts option code.
meth (str | OptionParser) – Method name or callable to parse the option.
- Return type
None
- _read_opt_type(kind)[source]¶
Read option type field.
- Parameters
kind (int) – option kind value
- Returns
Extracted IPv6-Opts option type field information (unknown option action and change flag), c.f. [RFC 8200#section-4.2].
- Return type
- _read_ipv6_opts(length)[source]¶
Read IPv6-Opts options.
- Positional arguments:
length: length of options
- Return type
- Returns
Extracted IPv6-Opts options
- Raises
ProtocolError – If the threshold is NOT matching.
- Parameters
length (int) –
- _read_opt_none(code, acts, cflg, *, options)[source]¶
Read IPv6-Opts unassigned options.
Structure of IPv6-Opts unassigned options [RFC 8200]:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - - | Option Type | Opt Data Len | Option Data +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - -
- _read_opt_pad(code, acts, cflg, *, options)[source]¶
Read IPv6-Opts padding options.
Structure of IPv6-Opts padding options [RFC 8200]:
Pad1
option:+-+-+-+-+-+-+-+-+ | 0 | +-+-+-+-+-+-+-+-+
PadN
option:+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - - | 1 | Opt Data Len | Option Data +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - -
- Parameters
- Returns
parsed option data
- Return type
Union[DataType_Opt_Pad1, DataType_Opt_PadN]
- Raises
ProtocolError – If
code
is NOT0
or1
.
- _read_opt_tun(code, acts, cflg, *, options)[source]¶
Read IPv6-Opts Tunnel Encapsulation Limit option.
Structure of IPv6-Opts Tunnel Encapsulation Limit option [RFC 2473]:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header |Hdr Ext Len = 0| Opt Type = 4 |Opt Data Len=1 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Tun Encap Lim |PadN Opt Type=1|Opt Data Len=1 | 0 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_TunnelEncapsulationLimitOption
- Returns
Parsed option data.
- Raises
ProtocolError – If
ipv6_opts.tun.length
is NOT1
.
- _read_opt_ra(code, acts, cflg, *, options)[source]¶
Read IPv6-Opts Router Alert option.
Structure of IPv6-Opts Router Alert option [RFC 2711]:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0 0 0|0 0 1 0 1|0 0 0 0 0 0 1 0| Value (2 octets) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_RouterAlertOption
- Returns
Parsed option data.
- Raises
ProtocolError – If
ipv6_opts.tun.length
is NOT2
.
- _read_opt_calipso(code, acts, cflg, *, options)[source]¶
Read IPv6-Opts Common Architecture Label IPv6 Security Option (CALIPSO) option.
Structure of IPv6-Opts CALIPSO option [RFC 5570]:
------------------------------------------------------------ | Next Header | Hdr Ext Len | Option Type | Option Length| +-------------+---------------+-------------+--------------+ | CALIPSO Domain of Interpretation | +-------------+---------------+-------------+--------------+ | Cmpt Length | Sens Level | Checksum (CRC-16) | +-------------+---------------+-------------+--------------+ | Compartment Bitmap (Optional; variable length) | +-------------+---------------+-------------+--------------+
- Parameters
- Return type
DataType_CALIPSOOption
- Returns
Parsed option data.
- Raises
ProtocolError – If the option is malformed.
- _read_opt_smf_dpd(code, acts, cflg, *, options)[source]¶
Read IPv6-Opts Simplified Multicast Forwarding Duplicate Packet Detection (
SMF_DPD
) option.Structure of IPv6-Opts
SMF_DPD
option [RFC 6621]:IPv6
SMF_DPD
option header in I-DPD (Identification-Based DPD) mode0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ... |0|0|0| 01000 | Opt. Data Len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0|TidTy| TidLen| TaggerID (optional) ... | +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | Identifier ... +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
IPv6
SMF_DPD
option header in H-DPD (Hash-Based) mode0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ... |0|0|0| OptType | Opt. Data Len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |1| Hash Assist Value (HAV) ... +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_SMFIdentificationBasedDPDOption | DataType_SMFHashBasedDPDOption
- Returns
Parsed option data.
- Raises
ProtocolError – If the option is malformed.
- _read_opt_pdm(code, acts, cflg, *, options)[source]¶
Read IPv6-Opts Performance and Diagnostic Metrics (PDM) option.
Structure of IPv6-Opts PDM option [RFC 8250]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option Type | Option Length | ScaleDTLR | ScaleDTLS | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | PSN This Packet | PSN Last Received | |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Delta Time Last Received | Delta Time Last Sent | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_PDMOption
- Returns
Parsed option data.
- Raises
ProtocolError – If
ipv6_opts.pdm.length
is NOT10
.
- _read_opt_qs(code, acts, cflg, *, options)[source]¶
Read IPv6-Opts Quick Start option.
Structure of IPv6-Opts Quick-Start option [RFC 4782]:
A Quick-Start Request:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option | Length=6 | Func. | Rate | QS TTL | | | | 0000 |Request| | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | QS Nonce | R | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Report of Approved Rate:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option | Length=6 | Func. | Rate | Not Used | | | | 1000 | Report| | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | QS Nonce | R | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_QuickStartOption
- Returns
Parsed option data.
- Raises
ProtocolError – If the option is malformed.
- _read_opt_rpl(code, acts, cflg, *, options)[source]¶
Read IPv6-Opts Routing Protocol for Low-Power and Lossy Networks (RPL) option.
Structure of IPv6-Opts RPL option [RFC 6553]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option Type | Opt Data Len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |O|R|F|0|0|0|0|0| RPLInstanceID | SenderRank | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | (sub-TLVs) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_RPLOption
- Returns
Parsed option data.
- Raises
ProtocolError – If
ipv6_opts.rpl.length
is NOT4
.
- _read_opt_mpl(code, acts, cflg, *, options)[source]¶
Read IPv6-Opts Multicast Protocol for Low-Power and Lossy Networks (MPL) option.
Structure of IPv6-Opts MPL option [RFC 7731]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option Type | Opt Data Len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | S |M|V| rsv | sequence | seed-id (optional) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_MPLOption
- Returns
Parsed option data.
- Raises
ProtocolError – If the option is malformed.
- _read_opt_ilnp(code, acts, cflg, *, options)[source]¶
Read IPv6-Opts Identifier-Locator Network Protocol (ILNP) Nonce option.
Structure of IPv6-Opts ILNP Nonce option [RFC 6744]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Hdr Ext Len | Option Type | Option Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / Nonce Value / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- _read_opt_lio(code, acts, cflg, *, options)[source]¶
Read IPv6-Opts Line-Identification option.
Structure of IPv6-Opts Line-Identification option [RFC 6788]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option Type | Option Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | LineIDLen | Line ID... +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- _read_opt_jumbo(code, acts, cflg, *, options)[source]¶
Read IPv6-Opts Jumbo Payload option.
Structure of IPv6-Opts Jumbo Payload option [RFC 2675]:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option Type | Opt Data Len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Jumbo Payload Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_JumboPayloadOption
- Returns
Parsed option data.
- Raises
ProtocolError – If
ipv6_opts.jumbo.length
is NOT4
.
- _read_opt_home(code, acts, cflg, *, options)[source]¶
Read IPv6-Opts Home Address option.
Structure of IPv6-Opts Home Address option [RFC 6275]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option Type | Option Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + + | | + Home Address + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_HomeAddressOption
- Returns
Parsed option data.
- Raises
ProtocolError – If
ipv6_opts.jumbo.length
is NOT16
.
- _read_opt_ip_dff(code, acts, cflg, *, options)[source]¶
Read IPv6-Opts Depth-First Forwarding (
IP_DFF
) option.Structure of IPv6-Opts
IP_DFF
option [RFC 6971]:1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Hdr Ext Len | OptTypeDFF | OptDataLenDFF | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |VER|D|R|0|0|0|0| Sequence Number | Pad1 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_IPDFFOption
- Returns
Parsed option data.
- Raises
ProtocolError – If
ipv6_opts.ip_dff.length
is NOT2
.
Data Structures¶
- class pcapkit.protocols.data.internet.ipv6_opts.IPv6_Opts(next, length, options)[source]¶
Bases:
Info
Data model for IPv6-Opts protocol.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- options: OrderedMultiDict[RegType_Option, Option]¶
IPv6-Opts options.
- class pcapkit.protocols.data.internet.ipv6_opts.Option(type, action, change, length)[source]¶
Bases:
Info
Data model for IPv6-Opts option data.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- type: RegType_Option¶
Option type.
- class pcapkit.protocols.data.internet.ipv6_opts.UnassignedOption(type, action, change, length, data)[source]¶
Bases:
Option
Data model for IPv6-Opts unassigned option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv6_opts.PadOption(type, action, change, length)[source]¶
Bases:
Option
Data model for IPv6-Opts padding options.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv6_opts.TunnelEncapsulationLimitOption(type, action, change, length, limit)[source]¶
Bases:
Option
Data model for IPv6-Opts tunnel encapsulation limit option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv6_opts.RouterAlertOption(type, action, change, length, value)[source]¶
Bases:
Option
Data model for IPv6-Opts router alter option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- value: RouterAlert¶
Router alter value.
- class pcapkit.protocols.data.internet.ipv6_opts.CALIPSOOption(type, action, change, length, domain, cmpt_len, level, checksum)[source]¶
Bases:
Option
Data model for IPv6-Opts Common Architecture Label IPv6 Security Option (CALIPSO) option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv6_opts.SMFDPDOption(type, action, change, length, dpd_type, tid_type)[source]¶
Bases:
Option
Data model for IPv6-Opts Simplified Multicast Forwarding Duplicate Packet Detection (
SMF_DPD
) option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- dpd_type: SMFDPDMode¶
DPD type.
- class pcapkit.protocols.data.internet.ipv6_opts.SMFIdentificationBasedDPDOption(type, action, change, length, pdm_type, tid_type, tid_len, tid, id)[source]¶
Bases:
Option
Data model for IPv6-Opts I-DPD (Identification-Based DPD) option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv6_opts.SMFHashBasedDPDOption(type, action, change, length, pdm_type, tid_type, hav)[source]¶
Bases:
Option
Data model for IPv6-Opts H-DPD (Hash-Based DPD) option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv6_opts.PDMOption(type, action, change, length, scaledtlr, scaledtls, psntp, psnlr, deltatlr, deltatls)[source]¶
Bases:
Option
Data model for IPv6-Opts Performance Diagnostic Metrics (PDM) option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- scaledtlr: timedelta¶
Scale delta time last received.
- scaledtls: timedelta¶
Scale delta time last sent.
- deltatlr: timedelta¶
Delta time last received.
- deltatls: timedelta¶
Delta time last sent.
- class pcapkit.protocols.data.internet.ipv6_opts.QuickStartOption(type, action, change, length, func, rate, ttl, nounce)[source]¶
Bases:
Option
Data model for IPv6-Opts Quick Start option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- func: QSFunction¶
QS function.
- ttl: Optional[timedelta]¶
TTL.
- class pcapkit.protocols.data.internet.ipv6_opts.RPLOption(type, action, change, length, flags, id, rank)[source]¶
Bases:
Option
Data model for IPv6-Opts Routing Protocol for Low-Power and Lossy Networks (RPL) option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv6_opts.RPLFlags(down, rank_err, fwd_err)[source]¶
Bases:
Info
Data model for IPv6-Opts RPL option flags fields.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv6_opts.MPLOption(type, action, change, length, seed_type, flags, seq, seed_id)[source]¶
Bases:
Option
Data model for IPv6-Opts Multicast Protocol for Low-Power and Lossy Networks (MPL) option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv6_opts.MPLFlags(max, verification)[source]¶
Bases:
Info
Data model for IPv6-Opts MPL option flags fields.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv6_opts.ILNPOption(type, action, change, length, nounce)[source]¶
Bases:
Option
Data model for IPv6-Opts Identifier-Locator Network Protocol (ILNP) Nonce option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv6_opts.LineIdentificationOption(type, action, change, length, line_id_len, line_id)[source]¶
Bases:
Option
Data model for IPv6-Opts Line-Identification option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv6_opts.JumboPayloadOption(type, action, change, length, payload_len)[source]¶
Bases:
Option
Data model for Jumbo Payload option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv6_opts.HomeAddressOption(type, action, change, length, address)[source]¶
Bases:
Option
Data model for IPv6-Opts Home Address option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- address: IPv6Address¶
Home address.
- class pcapkit.protocols.data.internet.ipv6_opts.IPDFFOption(type, action, change, length, version, flags, seq)[source]¶
Bases:
Option
Data model for IPv6-Opts Depth-First Forwarding (
IP_DFF
) option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv6_opts.DFFFlags(dup, ret)[source]¶
Bases:
Info
Data model for IPv6-Opts
IP_DFF
option flags.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
IPv6-Route - Routing Header for IPv6¶
pcapkit.protocols.internet.ipv6_route
contains
IPv6_Route
only, which implements extractor for Routing Header for IPv6
(IPv6-Route) *, whose structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Next Header |
1 |
8 |
|
Header Extensive Length |
2 |
16 |
|
Routing Type |
3 |
24 |
|
Segments Left |
4 |
32 |
|
Type-Specific Data |
- class pcapkit.protocols.internet.ipv6_route.IPv6_Route(file=None, length=None, **kwargs)[source]¶
Bases:
Internet
[IPv6_Route
]This class implements Routing Header for IPv6.
This class currently supports parsing of the following Routing Header for IPv6 routing data types, which are registered in the
self.__routing__
attribute:Routing Code
Data Parser
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- __post_init__(file: BinaryIO, length: Optional[int] = None, *, extension: bool = False, **kwargs: Any) None [source]¶
- __post_init__(**kwargs: Any) None
Post initialisation hook.
- Parameters
- Keyword Arguments
extension – If the protocol is used as an IPv6 extension header.
**kwargs – Arbitrary keyword arguments.
See also
For construction argument, please refer to
make()
.- Return type
- property name: Literal['Routing Header for IPv6']¶
Name of current protocol.
- Return type
Literal
[‘Routing Header for IPv6’]
- property alias: Literal['IPv6-Route']¶
Acronym of corresponding protocol.
- Return type
Literal
[‘IPv6-Route’]
- property payload: Protocol | NoReturn¶
Payload of current instance.
- Raises
UnsupportedCall – if the protocol is used as an IPv6 extension header
- Return type
- property protocol: Optional[str] | NoReturn¶
Name of next layer protocol (if any).
- Raises
UnsupportedCall – if the protocol is used as an IPv6 extension header
- property protochain: ProtoChain | NoReturn¶
Protocol chain of current instance.
- Raises
UnsupportedCall – if the protocol is used as an IPv6 extension header
- read(length=None, *, extension=False, **kwargs)[source]¶
Read Routing Header for IPv6.
Structure of IPv6-Route header [RFC 8200][RFC 5095]:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Hdr Ext Len | Routing Type | Segments Left | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | . . . type-specific data . . . | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
- Returns
Parsed packet data.
- classmethod register_routing(code, meth)[source]¶
Register an routing data parser.
- Parameters
code (RegType_Routing) – IPv6-Route data type code.
meth (str | TypeParser) – Method name or callable to parse the data.
- Return type
None
- _read_data_type_none(length)[source]¶
Read IPv6-Route unknown type data.
Structure of IPv6-Route unknown type data [RFC 8200][RFC 5095]:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Hdr Ext Len | Routing Type | Segments Left | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | . . . type-specific data . . . | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
length (
int
) – route data length- Return type
- Returns
Parsed route data.
- _read_data_type_src(length)[source]¶
Read IPv6-Route Source Route data.
Structure of IPv6-Route Source Route data [RFC 5095]:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Hdr Ext Len | Routing Type=0| Segments Left | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + + | | + Address[1] + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + + | | + Address[2] + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ . . . . . . . . . +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + + | | + Address[n] + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
length (
int
) – route data length- Return type
- Returns
Parsed route data.
- _read_data_type_2(length)[source]¶
Read IPv6-Route Type 2 data.
Structure of IPv6-Route Type 2 data [RFC 6275]:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Hdr Ext Len=2 | Routing Type=2|Segments Left=1| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + + | | + Home Address + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
length (
int
) – route data length- Return type
- Returns
Parsed route data.
- Raises
ProtocolError – If
length
is NOT20
.
- _read_data_type_rpl(length)[source]¶
Read IPv6-Route RPL Source data.
Structure of IPv6-Route RPL Source data [RFC 6554]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Hdr Ext Len | Routing Type | Segments Left | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | CmprI | CmprE | Pad | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | . . . Addresses[1..n] . . . | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
length (
int
) – route data length- Return type
- Returns
Parsed route data.
- Raises
ProtocolError – If
length
is NOT20
.
Data Structures¶
- class pcapkit.protocols.data.internet.ipv6_route.IPv6_Route(next, length, type, seg_left)[source]¶
Bases:
Info
Data model for IPv6-Route protocol.
See also
The type-specific routing data is stored directly in the top-level
IPv6_Route
object. Please refer to theRoutingType
subclasses for the details.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv6_route.RoutingType[source]¶
Bases:
Info
Data model for Routing Type.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv6_route.UnknownType(data)[source]¶
Bases:
RoutingType
Data model for IPv6-Route unknown type.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv6_route.SourceRoute(ip)[source]¶
Bases:
RoutingType
Data model for IPv6-Route Source Route data type.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv6_route.Type2(ip)[source]¶
Bases:
RoutingType
Data model for IPv6-Route Type 2 data type.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- ip: IPv6Address¶
Address.
- class pcapkit.protocols.data.internet.ipv6_route.RPL(cmpr_i, cmpr_e, pad, ip)[source]¶
Bases:
RoutingType
Data model for RPL Source data type.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
HOPOPT - IPv6 Hop-by-Hop Options¶
pcapkit.protocols.internet.hopopt
contains
HOPOPT
only, which implements extractor for IPv6 Hop-by-Hop
Options header (HOPOPT) *, whose structure is
described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Next Header |
1 |
8 |
|
Header Extensive Length |
2 |
16 |
|
Options |
- class pcapkit.protocols.internet.hopopt.HOPOPT(file=None, length=None, **kwargs)[source]¶
-
This class implements IPv6 Hop-by-Hop Options.
This class currently supports parsing of the following IPv6 Hop-by-Hop options, which are registered in the
self.__option__
attribute:Option Code
Option Parser
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- __post_init__(file: BinaryIO, length: Optional[int] = None, *, extension: bool = False, **kwargs: Any) None [source]¶
- __post_init__(**kwargs: Any) None
Post initialisation hook.
- Parameters
See also
For construction argument, please refer to
make()
.- Return type
- property name: Literal['IPv6 Hop-by-Hop Options']¶
Name of current protocol.
- Return type
Literal[“IPv6 Hop-by-Hop Options”]
- property payload: Protocol | NoReturn¶
Payload of current instance.
- Raises
UnsupportedCall – if the protocol is used as an IPv6 extension header
- Return type
- property protocol: Optional[str] | NoReturn¶
Name of next layer protocol (if any).
- Raises
UnsupportedCall – if the protocol is used as an IPv6 extension header
- property protochain: ProtoChain | NoReturn¶
Protocol chain of current instance.
- Raises
UnsupportedCall – if the protocol is used as an IPv6 extension header
- Return type
ProtoChain | NoReturn
- read(length=None, *, extension=False, **kwargs)[source]¶
Read IPv6 Hop-by-Hop Options.
Structure of HOPOPT header [RFC 8200]:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Hdr Ext Len | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | . . . Options . . . | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- classmethod register_option(code, meth)[source]¶
Register an option parser.
- Parameters
code (RegType_Option) – HOPOPT option code.
meth (str | OptionParser) – Method name or callable to parse the option.
- Return type
None
- _read_opt_type(kind)[source]¶
Read option type field.
- Parameters
kind (int) – option kind value
- Returns
Extracted HOPOPT option type field information (unknown option action and change flag), c.f. [RFC 8200#section-4.2].
- Return type
- _read_hopopt_options(length)[source]¶
Read HOPOPT options.
- Positional arguments:
length: length of options
- Return type
- Returns
Extracted HOPOPT options
- Raises
ProtocolError – If the threshold is NOT matching.
- Parameters
length (int) –
- _read_opt_none(code, acts, cflg, *, options)[source]¶
Read HOPOPT unassigned options.
Structure of HOPOPT unassigned options [RFC 8200]:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - - | Option Type | Opt Data Len | Option Data +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - -
- _read_opt_pad(code, acts, cflg, *, options)[source]¶
Read HOPOPT padding options.
Structure of HOPOPT padding options [RFC 8200]:
Pad1
option:+-+-+-+-+-+-+-+-+ | 0 | +-+-+-+-+-+-+-+-+
PadN
option:+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - - | 1 | Opt Data Len | Option Data +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - -
- Parameters
- Return type
DataType_PadOption
- Returns
Parsed option data.
- Raises
ProtocolError – If
code
is NOT0
or1
.
- _read_opt_tun(code, acts, cflg, *, options)[source]¶
Read HOPOPT Tunnel Encapsulation Limit option.
Structure of HOPOPT Tunnel Encapsulation Limit option [RFC 2473]:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header |Hdr Ext Len = 0| Opt Type = 4 |Opt Data Len=1 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Tun Encap Lim |PadN Opt Type=1|Opt Data Len=1 | 0 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_TunnelEncapsulationLimitOption
- Returns
Parsed option data.
- Raises
ProtocolError – If
hopopt.tun.length
is NOT1
.
- _read_opt_ra(code, acts, cflg, *, options)[source]¶
Read HOPOPT Router Alert option.
Structure of HOPOPT Router Alert option [RFC 2711]:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0 0 0|0 0 1 0 1|0 0 0 0 0 0 1 0| Value (2 octets) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_RouterAlertOption
- Returns
Parsed option data.
- Raises
ProtocolError – If
hopopt.tun.length
is NOT2
.
- _read_opt_calipso(code, acts, cflg, *, options)[source]¶
Read HOPOPT Common Architecture Label IPv6 Security Option (CALIPSO) option.
Structure of HOPOPT CALIPSO option [RFC 5570]:
------------------------------------------------------------ | Next Header | Hdr Ext Len | Option Type | Option Length| +-------------+---------------+-------------+--------------+ | CALIPSO Domain of Interpretation | +-------------+---------------+-------------+--------------+ | Cmpt Length | Sens Level | Checksum (CRC-16) | +-------------+---------------+-------------+--------------+ | Compartment Bitmap (Optional; variable length) | +-------------+---------------+-------------+--------------+
- Parameters
- Return type
DataType_CALIPSOOption
- Returns
Parsed option data.
- Raises
ProtocolError – If the option is malformed.
- _read_opt_smf_dpd(code, acts, cflg, *, options)[source]¶
Read HOPOPT Simplified Multicast Forwarding Duplicate Packet Detection (
SMF_DPD
) option.Structure of HOPOPT
SMF_DPD
option [RFC 6621]:IPv6
SMF_DPD
option header in I-DPD (Identification-Based DPD) mode0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ... |0|0|0| 01000 | Opt. Data Len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0|TidTy| TidLen| TaggerID (optional) ... | +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | Identifier ... +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
IPv6
SMF_DPD
option header in H-DPD (Hash-Based) mode0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ... |0|0|0| OptType | Opt. Data Len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |1| Hash Assist Value (HAV) ... +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_SMFIdentificationBasedDPDOption | DataType_SMFHashBasedDPDOption
- Returns
Parsed option data.
- Raises
ProtocolError – If the option is malformed.
- _read_opt_pdm(code, acts, cflg, *, options)[source]¶
Read HOPOPT Performance and Diagnostic Metrics (PDM) option.
Structure of HOPOPT PDM option [RFC 8250]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option Type | Option Length | ScaleDTLR | ScaleDTLS | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | PSN This Packet | PSN Last Received | |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Delta Time Last Received | Delta Time Last Sent | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_PDMOption
- Returns
Parsed option data.
- Raises
ProtocolError – If
hopopt.pdm.length
is NOT10
.
- _read_opt_qs(code, acts, cflg, *, options)[source]¶
Read HOPOPT Quick Start option.
Structure of HOPOPT Quick-Start option [RFC 4782]:
A Quick-Start Request:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option | Length=6 | Func. | Rate | QS TTL | | | | 0000 |Request| | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | QS Nonce | R | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Report of Approved Rate:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option | Length=6 | Func. | Rate | Not Used | | | | 1000 | Report| | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | QS Nonce | R | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_QuickStartOption
- Returns
Parsed option data.
- Raises
ProtocolError – If the option is malformed.
- _read_opt_rpl(code, acts, cflg, *, options)[source]¶
Read HOPOPT Routing Protocol for Low-Power and Lossy Networks (RPL) option.
Structure of HOPOPT RPL option [RFC 6553]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option Type | Opt Data Len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |O|R|F|0|0|0|0|0| RPLInstanceID | SenderRank | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | (sub-TLVs) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_RPLOption
- Returns
Parsed option data.
- Raises
ProtocolError – If
hopopt.rpl.length
is NOT4
.
- _read_opt_mpl(code, acts, cflg, *, options)[source]¶
Read HOPOPT Multicast Protocol for Low-Power and Lossy Networks (MPL) option.
Structure of HOPOPT MPL option [RFC 7731]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option Type | Opt Data Len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | S |M|V| rsv | sequence | seed-id (optional) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_MPLOption
- Returns
Parsed option data.
- Raises
ProtocolError – If the option is malformed.
- _read_opt_ilnp(code, acts, cflg, *, options)[source]¶
Read HOPOPT Identifier-Locator Network Protocol (ILNP) Nonce option.
Structure of HOPOPT ILNP Nonce option [RFC 6744]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Hdr Ext Len | Option Type | Option Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / Nonce Value / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- _read_opt_lio(code, acts, cflg, *, options)[source]¶
Read HOPOPT Line-Identification option.
Structure of HOPOPT Line-Identification option [RFC 6788]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option Type | Option Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | LineIDLen | Line ID... +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- _read_opt_jumbo(code, acts, cflg, *, options)[source]¶
Read HOPOPT Jumbo Payload option.
Structure of HOPOPT Jumbo Payload option [RFC 2675]:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option Type | Opt Data Len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Jumbo Payload Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_JumboPayloadOption
- Returns
Parsed option data.
- Raises
ProtocolError – If
hopopt.jumbo.length
is NOT4
.
- _read_opt_home(code, acts, cflg, *, options)[source]¶
Read HOPOPT Home Address option.
Structure of HOPOPT Home Address option [RFC 6275]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option Type | Option Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + + | | + Home Address + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_HomeAddressOption
- Returns
Parsed option data.
- Raises
ProtocolError – If
hopopt.jumbo.length
is NOT16
.
- _read_opt_ip_dff(code, acts, cflg, *, options)[source]¶
Read HOPOPT Depth-First Forwarding (
IP_DFF
) option.Structure of HOPOPT
IP_DFF
option [RFC 6971]:1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Hdr Ext Len | OptTypeDFF | OptDataLenDFF | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |VER|D|R|0|0|0|0| Sequence Number | Pad1 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_IPDFFOption
- Returns
Parsed option data.
- Raises
ProtocolError – If
hopopt.ip_dff.length
is NOT2
.
- __option__: DefaultDict[int, str | OptionParser]¶
Option code to method mapping, c.f.
_read_hopopt_options()
. Method names are expected to be referred to the class by_read_opt_${name}
, and if such name not found, the value should then be a method that can parse the option by itself.- Type
DefaultDict[RegType_Option, str | OptionParser]
Data Structures¶
- class pcapkit.protocols.data.internet.hopopt.HOPOPT(next, length, options)[source]¶
Bases:
Info
Data model for HOPOPT protocol.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- options: OrderedMultiDict[RegType_Option, Option]¶
HOPOPT options.
- class pcapkit.protocols.data.internet.hopopt.Option(type, action, change, length)[source]¶
Bases:
Info
Data model for HOPOPT option data.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- type: RegType_Option¶
Option type.
- class pcapkit.protocols.data.internet.hopopt.UnassignedOption(type, action, change, length, data)[source]¶
Bases:
Option
Data model for HOPOPT unassigned option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hopopt.PadOption(type, action, change, length)[source]¶
Bases:
Option
Data model for HOPOPT padding options.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hopopt.TunnelEncapsulationLimitOption(type, action, change, length, limit)[source]¶
Bases:
Option
Data model for HOPOPT tunnel encapsulation limit option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hopopt.RouterAlertOption(type, action, change, length, value)[source]¶
Bases:
Option
Data model for HOPOPT router alter option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- value: RouterAlert¶
Router alter value.
- class pcapkit.protocols.data.internet.hopopt.CALIPSOOption(type, action, change, length, domain, cmpt_len, level, checksum)[source]¶
Bases:
Option
Data model for HOPOPT Common Architecture Label IPv6 Security Option (CALIPSO) option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hopopt.SMFDPDOption(type, action, change, length, dpd_type, tid_type)[source]¶
Bases:
Option
Data model for HOPOPT Simplified Multicast Forwarding Duplicate Packet Detection (
SMF_DPD
) option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- dpd_type: SMFDPDMode¶
DPD type.
- class pcapkit.protocols.data.internet.hopopt.SMFIdentificationBasedDPDOption(type, action, change, length, pdm_type, tid_type, tid_len, tid, id)[source]¶
Bases:
SMFDPDOption
Data model for HOPOPT I-DPD (Identification-Based DPD) option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hopopt.SMFHashBasedDPDOption(type, action, change, length, pdm_type, tid_type, hav)[source]¶
Bases:
SMFDPDOption
Data model for HOPOPT H-DPD (Hash-Based DPD) option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hopopt.PDMOption(type, action, change, length, scaledtlr, scaledtls, psntp, psnlr, deltatlr, deltatls)[source]¶
Bases:
Option
Data model for HOPOPT Performance Diagnostic Metrics (PDM) option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- scaledtlr: timedelta¶
Scale delta time last received.
- scaledtls: timedelta¶
Scale delta time last sent.
- deltatlr: timedelta¶
Delta time last received.
- deltatls: timedelta¶
Delta time last sent.
- class pcapkit.protocols.data.internet.hopopt.QuickStartOption(type, action, change, length, func, rate, ttl, nounce)[source]¶
Bases:
Option
Data model for HOPOPT Quick Start option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- func: QSFunction¶
QS function.
- ttl: Optional[timedelta]¶
TTL.
- class pcapkit.protocols.data.internet.hopopt.RPLOption(type, action, change, length, flags, id, rank)[source]¶
Bases:
Option
Data model for HOPOPT Routing Protocol for Low-Power and Lossy Networks (RPL) option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hopopt.RPLFlags(down, rank_err, fwd_err)[source]¶
Bases:
Info
Data model for HOPOPT RPL option flags fields.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hopopt.MPLOption(type, action, change, length, seed_type, flags, seq, seed_id)[source]¶
Bases:
Option
Data model for HOPOPT Multicast Protocol for Low-Power and Lossy Networks (MPL) option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hopopt.MPLFlags(max, verification)[source]¶
Bases:
Info
Data model for HOPOPT MPL option flags fields.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hopopt.ILNPOption(type, action, change, length, nounce)[source]¶
Bases:
Option
Data model for HOPOPT Identifier-Locator Network Protocol (ILNP) Nonce option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hopopt.LineIdentificationOption(type, action, change, length, line_id_len, line_id)[source]¶
Bases:
Option
Data model for HOPOPT Line-Identification option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hopopt.JumboPayloadOption(type, action, change, length, payload_len)[source]¶
Bases:
Option
Data model for Jumbo Payload option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hopopt.HomeAddressOption(type, action, change, length, address)[source]¶
Bases:
Option
Data model for HOPOPT Home Address option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- address: IPv6Address¶
Home address.
- class pcapkit.protocols.data.internet.hopopt.IPDFFOption(type, action, change, length, version, flags, seq)[source]¶
Bases:
Option
Data model for HOPOPT Depth-First Forwarding (
IP_DFF
) option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hopopt.DFFFlags(dup, ret)[source]¶
Bases:
Info
Data model for HOPOPT
IP_DFF
option flags.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
IPsec - Internet Protocol Security¶
pcapkit.protocols.internet.ipsec
contains
IPsec
only, which is a base class for Internet Protocol
Security (IPsec) protocol family *, eg.
AH
and
ESP
†.
- class pcapkit.protocols.internet.ipsec.IPsec(file=None, length=None, **kwargs)[source]¶
Bases:
Internet
[PT
],Generic
[PT
]Abstract base class for IPsec protocol family.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
AH - Authentication Header¶
pcapkit.protocols.internet.ah
contains
AH
only,
which implements extractor for Authentication
Header (AH) *, whose structure is described
as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Next Header |
1 |
8 |
|
Payload Length |
2 |
16 |
Reserved (must be zero) |
|
4 |
32 |
|
Security Parameters Index (SPI) |
8 |
64 |
|
Sequence Number Field |
12 |
96 |
|
Integrity Check Value (ICV) |
- class pcapkit.protocols.internet.ah.AH(file=None, length=None, **kwargs)[source]¶
-
This class implements Authentication Header.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- __post_init__(file: BinaryIO, length: Optional[int] = None, *, version: Literal[4, 6] = 4, extension: bool = False, **kwargs: Any) None [source]¶
- __post_init__(**kwargs: Any) None
Post initialisation hook.
- Parameters
See also
For construction argument, please refer to
make()
.- Return type
- property name: Literal['Authentication Header']¶
Name of corresponding protocol.
- Return type
Literal
[‘Authentication Header’]
- property payload: Protocol | NoReturn¶
Payload of current instance.
- Raises
UnsupportedCall – if the protocol is used as an IPv6 extension header
- property protocol: Optional[str] | NoReturn¶
Name of next layer protocol (if any).
- Raises
UnsupportedCall – if the protocol is used as an IPv6 extension header
- property protochain: ProtoChain | NoReturn¶
Protocol chain of current instance.
- Raises
UnsupportedCall – if the protocol is used as an IPv6 extension header
- read(length=None, *, version=4, extension=False, **kwargs)[source]¶
Read Authentication Header.
Structure of AH header [RFC 4302]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Payload Len | RESERVED | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Security Parameters Index (SPI) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Sequence Number Field | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + Integrity Check Value-ICV (variable) | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Data Structures¶
- class pcapkit.protocols.data.internet.ah.AH(next, length, spi, seq, icv)[source]¶
Bases:
Info
Data model for AH protocol.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
HIP - Host Identity Protocol¶
pcapkit.protocols.internet.hip
contains
HIP
only,
which implements extractor for Host Identity
Protocol (HIP) *, whose structure is described
as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Next Header |
1 |
8 |
|
Header Length |
2 |
16 |
Reserved ( |
|
2 |
17 |
|
Packet Type |
3 |
24 |
|
Version |
3 |
28 |
Reserved |
|
3 |
31 |
Reserved ( |
|
4 |
32 |
|
Checksum |
6 |
48 |
|
Controls |
8 |
64 |
|
Sender’s Host Identity Tag |
24 |
192 |
|
Receiver’s Host Identity Tag |
40 |
320 |
|
HIP Parameters |
- class pcapkit.protocols.internet.hip.HIP(file=None, length=None, **kwargs)[source]¶
-
This class implements Host Identity Protocol.
This class currently supports parsing of the following HIP parameters, which are directly mapped to the
pcapkit.const.hip.parameter.Parameter
enumeration:Parameter Code
Parameter Parser
ECHO_RESPONSE_SIGNEED
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- __post_init__(file: BinaryIO, length: Optional[int] = None, *, extension: bool = False, **kwargs: Any) None [source]¶
- __post_init__(**kwargs: Any) None
Post initialisation hook.
- Parameters
See also
For construction argument, please refer to
make()
.- Return type
- property name: Literal['Host Identity Protocol']¶
Name of current protocol.
- Return type
Literal[“Host Identity Protocol”]
- property payload: Protocol | NoReturn¶
Payload of current instance.
- Raises
UnsupportedCall – if the protocol is used as an IPv6 extension header
- Return type
- property protocol: Optional[str] | NoReturn¶
Name of next layer protocol (if any).
- Raises
UnsupportedCall – if the protocol is used as an IPv6 extension header
- property protochain: ProtoChain | NoReturn¶
Protocol chain of current instance.
- Raises
UnsupportedCall – if the protocol is used as an IPv6 extension header
- Return type
ProtoChain | NoReturn
- read(length=None, *, extension=False, **kwargs)[source]¶
Read Host Identity Protocol.
Structure of HIP header [RFC 5201][RFC 7401]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Header Length |0| Packet Type |Version| RES.|1| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Checksum | Controls | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Sender's Host Identity Tag (HIT) | | | | | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Receiver's Host Identity Tag (HIT) | | | | | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | / HIP Parameters / / / | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- _read_hip_param(length, *, version)[source]¶
Read HIP parameters.
- Parameters
- Return type
- Returns
Extracted HIP parameters.
- Raises
ProtocolError – if packet length threshold check failed
- _read_param_unassigned(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP unassigned parameters.
Structure of HIP unassigned parameters [RFC 5201][RFC 7401]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type |C| Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | / Contents / / +-+-+-+-+-+-+-+-+ | | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_UnassignedParameter
- Returns
Parsed parameter data.
- _read_param_esp_info(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
ESP_INFO
parameter.Structure of HIP
ESP_INFO
parameter [RFC 7402]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Reserved | KEYMAT Index | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | OLD SPI | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | NEW SPI | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_ESPInfoParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – If
clen
is NOT12
.
- _read_param_r1_counter(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
R1_COUNTER
parameter.Structure of HIP
R1_COUNTER
parameter [RFC 5201][RFC 7401]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Reserved, 4 bytes | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | R1 generation counter, 8 bytes | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_R1CounterParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – If
clen
is NOT12
or the parameter is NOT used in HIPv1.
- _read_param_locator_set(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
LOCATOR_SET
parameter.Structure of HIP
LOCATOR_SET
parameter [RFC 8046]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Traffic Type | Locator Type | Locator Length | Reserved |P| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Locator Lifetime | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Locator | | | | | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ . . . . +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Traffic Type | Locator Type | Locator Length | Reserved |P| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Locator Lifetime | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Locator | | | | | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_LocatorSetParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – If locator data is malformed.
- _read_param_puzzle(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
PUZZLE
parameter.Structure of HIP
PUZZLE
parameter [RFC 5201][RFC 7401]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | #K, 1 byte | Lifetime | Opaque, 2 bytes | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Random #I, RHASH_len / 8 bytes | / / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_PuzzleParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – The parameter is ONLY supported in HIPv1.
- _read_param_solution(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
SOLUTION
parameter.Structure of HIP
SOLUTION
parameter [RFC 5201][RFC 7401]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | #K, 1 byte | Lifetime | Opaque, 2 bytes | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Random #I, n bytes | / / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Puzzle solution #J, RHASH_len / 8 bytes | / / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_SolutionParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – The parameter is ONLY supported in HIPv1.
- _read_param_seq(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
SEQ
parameter.Structure of HIP
SEQ
parameter [RFC 7401]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Update ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_SEQParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – If
clen
is NOT4
.
- _read_param_ack(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
ACK
parameter.Structure of HIP
ACK
parameter [RFC 7401]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | peer Update ID 1 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / peer Update ID n | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_ACKParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – If
clen
is NOT4
modulo.
- _read_param_dh_group_list(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
DH_GROUP_LIST
parameter.Structure of HIP
DH_GROUP_LIST
parameter [RFC 7401]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | DH GROUP ID #1| DH GROUP ID #2| DH GROUP ID #3| DH GROUP ID #4| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | DH GROUP ID #n| Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_DHGroupListParameter
- Returns
Parsed parameter data.
- _read_param_diffie_hellman(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
DIFFIE_HELLMAN
parameter.Structure of HIP
DIFFIE_HELLMAN
parameter [RFC 7401]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Group ID | Public Value Length | Public Value / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_DeffieHellmanParameter
- Returns
Parsed parameter data.
- _read_param_hip_transform(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
HIP_TRANSFORM
parameter.Structure of HIP
HIP_TRANSFORM
parameter [RFC 5201]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Suite ID #1 | Suite ID #2 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Suite ID #n | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_HIPTransformParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – The parameter is ONLY supported in HIPv1.
- _read_param_hip_cipher(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
HIP_CIPHER
parameter.Structure of HIP
HIP_CIPHER
parameter [RFC 7401]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Cipher ID #1 | Cipher ID #2 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Cipher ID #n | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_HIPCipherParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – If
clen
is NOT a2
modulo.
- _read_param_nat_traversal_mode(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
NAT_TRAVERSAL_MODE
parameter.Structure of HIP
NAT_TRAVERSAL_MODE
parameter [RFC 5770]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Reserved | Mode ID #1 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Mode ID #2 | Mode ID #3 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Mode ID #n | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_NATTraversalModeParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – If
clen
is NOT a2
modulo.
- _read_param_transaction_pacing(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
TRANSACTION_PACING
parameter.Structure of HIP
TRANSACTION_PACING
parameter [RFC 5770]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Min Ta | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_TransactionPacingParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – If
clen
is NOT4
.
- _read_param_encrypted(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
ENCRYPTED
parameter.Structure of HIP
ENCRYPTED
parameter [RFC 7401]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | IV / / / / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / / Encrypted data / / / / +-------------------------------+ / | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_EncryptedParameter
- Returns
Parsed parameter data.
- _read_param_host_id(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
HOST_ID
parameter.Structure of HIP
HOST_ID
parameter [RFC 7401]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | HI Length |DI-Type| DI Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Algorithm | Host Identity / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / | Domain Identifier / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_HostIDParameter
- Returns
Parsed parameter data.
- _read_param_hit_suite_list(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
HIT_SUITE_LIST
parameter.Structure of HIP
HIT_SUITE_LIST
parameter [RFC 7401]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ID #1 | ID #2 | ID #3 | ID #4 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ID #n | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_HITSuiteParameter
- Returns
Parsed parameter data.
- _read_param_cert(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
CERT
parameter.Structure of HIP
CERT
parameter [RFC 7401]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | CERT group | CERT count | CERT ID | CERT type | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Certificate / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / | Padding (variable length) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_CertParameter
- Returns
Parsed parameter data.
- _read_param_notification(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
NOTIFICATION
parameter.Structure of HIP
NOTIFICATION
parameter [RFC 7401]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Reserved | Notify Message Type | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | / / Notification Data / / +---------------+ / | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_NotificationParameter
- Returns
Parsed parameter data.
- _read_param_echo_request_signed(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
ECHO_REQUEST_SIGNED
parameter.Structure of HIP
ECHO_REQUEST_SIGNED
parameter [RFC 7401]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Opaque data (variable length) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_EchoRequestSignedParameter
- Returns
Parsed parameter data.
- _read_param_reg_info(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
REG_INFO
parameter.Structure of HIP
REG_INFO
parameter [RFC 8003]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Min Lifetime | Max Lifetime | Reg Type #1 | Reg Type #2 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ... | ... | Reg Type #n | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Padding + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_RegInfoParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – If the registration type is invalid.
- _read_param_reg_request(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
REG_REQUEST
parameter.Structure of HIP
REG_REQUEST
parameter [RFC 8003]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Lifetime | Reg Type #1 | Reg Type #2 | Reg Type #3 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ... | ... | Reg Type #n | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Padding + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_RegRequestParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – If the registration type is invalid.
- _read_param_reg_response(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
REG_RESPONSE
parameter.Structure of HIP
REG_RESPONSE
parameter [RFC 8003]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Lifetime | Reg Type #1 | Reg Type #2 | Reg Type #3 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ... | ... | Reg Type #n | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Padding + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_RegResponseParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – If the registration type is invalid.
- _read_param_reg_failed(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
REG_FAILED
parameter.Structure of HIP
REG_FAILED
parameter [RFC 8003]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Lifetime | Reg Type #1 | Reg Type #2 | Reg Type #3 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ... | ... | Reg Type #n | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Padding + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_RegFailedParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – If the registration type is invalid.
- _read_param_reg_from(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
REG_FROM
parameter.Structure of HIP
REG_FROM
parameter [RFC 5770]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Port | Protocol | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | Address | | | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_RegFromParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – If
clen
is NOT20
.
- _read_param_echo_response_signed(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
ECHO_RESPONSE_SIGNED
parameter.Structure of HIP
ECHO_RESPONSE_SIGNED
parameter [RFC 7401]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Opaque data (variable length) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_EchoResponseSignedParameter
- Returns
Parsed parameter data.
- _read_param_transport_format_list(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
TRANSPORT_FORMAT_LIST
parameter.Structure of HIP
TRANSPORT_FORMAT_LIST
parameter [RFC 7401]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TF type #1 | TF type #2 / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / TF type #n | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_TransportFormatListParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – If
clen
is NOT2
modulo.
- _read_param_esp_transform(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
ESP_TRANSFORM
parameter.Structure of HIP
ESP_TRANSFORM
parameter [RFC 7402]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Reserved | Suite ID #1 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Suite ID #2 | Suite ID #3 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Suite ID #n | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_ESPTransformParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – If
clen
is NOT2
modulo.
- _read_param_seq_data(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
SEQ_DATA
parameter.Structure of HIP
SEQ_DATA
parameter [RFC 6078]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Sequence number | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_SeqDataParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – If
clen
is NOT4
.
- _read_param_ack_data(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
ACK_DATA
parameter.Structure of HIP
ACK_DATA
parameter [RFC 6078]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Acked Sequence number / / / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_AckDataParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – If
clen
is NOT4
modulo.
- _read_param_payload_mic(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
PAYLOAD_MIC
parameter.Structure of HIP
PAYLOAD_MIC
parameter [RFC 6078]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Payload Data | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | / MIC Value / / +-+-+-+-+-+-+-+-+ | | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_PayloadMICParameter
- Returns
Parsed parameter data.
- _read_param_transaction_id(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
TRANSACTION_ID
parameter.Structure of HIP
TRANSACTION_ID
parameter [RFC 6078]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Identifier / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_TransactionIDParameter
- Returns
Parsed parameter data.
- _read_param_overlay_id(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
OVERLAY_ID
parameter.Structure of HIP
OVERLAY_ID
parameter [RFC 6079]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Identifier / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_OverlayIDParameter
- Returns
Parsed parameter data.
- _read_param_route_dst(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
ROUTE_DST
parameter.Structure of HIP
ROUTE_DST
parameter [RFC 6028]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Flags | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | HIT #1 | | | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ . . . . . . +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | HIT #n | | | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_RouteDstParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – If the parameter is malformed.
- _read_param_hip_transport_mode(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
HIP_TRANSPORT_MODE
parameter.Structure of HIP
HIP_TRANSPORT_MODE
parameter [RFC 6261]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Port | Mode ID #1 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Mode ID #2 | Mode ID #3 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Mode ID #n | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_HIPTransportModeParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – If
clen
is NOT2
modulo.
- _read_param_hip_mac(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
HIP_MAC
parameter.Structure of HIP
HIP_MAC
parameter [RFC 7401]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | HMAC | / / / +-------------------------------+ | | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_HIPMACParameter
- Returns
Parsed parameter data.
- _read_param_hip_mac_2(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
HIP_MAC_2
parameter.Structure of HIP
HIP_MAC_2
parameter [RFC 7401]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | HMAC | / / / +-------------------------------+ | | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_HIPMAC2Parameter
- Returns
Parsed parameter data.
- _read_param_hip_signature_2(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
HIP_SIGNATURE_2
parameter.Structure of HIP
HIP_SIGNATURE_2
parameter [RFC 7401]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SIG alg | Signature / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_HIPSignature2Parameter
- Returns
Parsed parameter data.
- _read_param_hip_signature(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
HIP_SIGNATURE
parameter.Structure of HIP
HIP_SIGNATURE
parameter [RFC 7401]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SIG alg | Signature / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_HIPSignatureParameter
- Returns
Parsed parameter data.
- _read_param_echo_request_unsigned(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
ECHO_REQUEST_UNSIGNED
parameter.Structure of HIP
ECHO_REQUEST_UNSIGNED
parameter [RFC 7401]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Opaque data (variable length) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_EchoRequestUnsignedParameter
- Returns
Parsed parameter data.
- _read_param_echo_response_unsigned(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
ECHO_RESPONSE_UNSIGNED
parameter.Structure of HIP
ECHO_RESPONSE_UNSIGNED
parameter [RFC 7401]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Opaque data (variable length) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_EchoResponseUnsignedParameter
- Returns
Parsed parameter data.
- _read_param_relay_from(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
RELAY_FROM
parameter.Structure of HIP
RELAY_FROM
parameter [RFC 5770]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Port | Protocol | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | Address | | | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_RelayFromParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – If
clen
is NOT20
.
- _read_param_relay_to(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
RELAY_TO
parameter.Structure of HIP
RELAY_TO
parameter [RFC 5770]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Port | Protocol | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | Address | | | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_RelayToParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – If
clen
is NOT20
.
- _read_param_overlay_ttl(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
OVERLAY_TTL
parameter.Structure of HIP
OVERLAY_TTL
parameter [RFC 6078]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TTL | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_OverlayTTLParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – If
clen
is NOT4
.
- _read_param_route_via(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
ROUTE_VIA
parameter.Structure of HIP
ROUTE_VIA
parameter [RFC 6028]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Flags | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | HIT #1 | | | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ . . . . . . +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | HIT #n | | | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_RouteViaParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – If the parameter is malformed.
- _read_param_from(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
FROM
parameter.Structure of HIP
FROM
parameter [RFC 8004]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | Address | | | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_FromParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – If
clen
is NOT16
.
- _read_param_rvs_hmac(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
RVS_HMAC
parameter.Structure of HIP
RVS_HMAC
parameter [RFC 8004]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | HMAC | / / / +-------------------------------+ | | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_RVSHMACParameter
- Returns
Parsed parameter data.
- _read_param_via_rvs(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
VIA_RVS
parameter.Structure of HIP
VIA_RVS
parameter [RFC 6028]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | Address | | | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ . . . . . . +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | Address | | | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_ViaRVSParameter
- Returns
Parsed parameter data.
- Raises
ProtocolError – If
clen
is NOT16
modulo.
- _read_param_relay_hmac(code, cbit, clen, *, desc, length, version, options)[source]¶
Read HIP
RELAY_HMAC
parameter.Structure of HIP
RELAY_HMAC
parameter [RFC 5770]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | HMAC | / / / +-------------------------------+ | | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
- Return type
DataType_RelayHMACParameter
- Returns
Parsed parameter data.
Data Structures¶
- class pcapkit.protocols.data.internet.hip.HIP(next, length, type, version, chksum, control, shit, rhit)[source]¶
Bases:
Info
Data model for HIP header.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- parameters: OrderedMultiDict[RegType_Parameter, Parameter]¶
HIP parameters.
- class pcapkit.protocols.data.internet.hip.Control(anonymous)[source]¶
Bases:
Info
Data model for HIP controls.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.Parameter(type, critical, length)[source]¶
Bases:
Info
Data model for HIP parameter data.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- type: RegType_Parameter¶
Parameter type.
- class pcapkit.protocols.data.internet.hip.UnassignedParameter(type, critical, length, contents)[source]¶
Bases:
Parameter
Data model for unassigned parameter.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.ESPInfoParameter(type, critical, length, index, old_spi, new_spi)[source]¶
Bases:
Parameter
Data model for HIP
ESP_INFO
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.R1CounterParameter(type, critical, length, counter)[source]¶
Bases:
Parameter
Data model for HIP
R1_COUNTER
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.LocatorSetParameter(type, critical, length, locator_set)[source]¶
Bases:
Parameter
Data model for HIP
LOCATOR_SET
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.Locator(traffic, type, length, preferred, lifetime, locator)[source]¶
Bases:
Info
Data model for HIP locator.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- lifetime: timedelta¶
Locator lifetime.
- locator: LocatorData | IPv4Address¶
Locator data.
- class pcapkit.protocols.data.internet.hip.LocatorData(spi, ip)[source]¶
Bases:
Info
Data model for HIP locator data.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- ip: IPv4Address¶
IP address.
- class pcapkit.protocols.data.internet.hip.PuzzleParameter(type, critical, length, index, lifetime, opaque, random)[source]¶
Bases:
Parameter
Data model for HIP
PUZZLE
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- lifetime: timedelta¶
Lifetime.
- class pcapkit.protocols.data.internet.hip.SolutionParameter(type, critical, length, index, lifetime, opaque, random, solution)[source]¶
Bases:
Parameter
Data model for HIP
SOLUTION
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- lifetime: timedelta¶
Lifetime.
- class pcapkit.protocols.data.internet.hip.SEQParameter(type, critical, length, id)[source]¶
Bases:
Parameter
Data model for HIP
SEQ
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.ACKParameter(type, critical, length, update_id)[source]¶
Bases:
Parameter
Data model for HIP
ACK
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.DHGroupListParameter(type, critical, length, group_id)[source]¶
Bases:
Parameter
Data model for HIP
DH_GROUP_LIST
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.DeffieHellmanParameter(type, critical, length, group_id, pub_len, pub_val)[source]¶
Bases:
Parameter
Data model for HIP
DEFFIE_HELLMAN
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.HIPTransformParameter(type, critical, length, suite_id)[source]¶
Bases:
Parameter
Data model for HIP
HIP_TRANSFORM
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.HIPCipherParameter(type, critical, length, cipher_id)[source]¶
Bases:
Parameter
Data model for HIP
HIP_CIPHER
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.NATTraversalModeParameter(type, critical, length, mode_id)[source]¶
Bases:
Parameter
Data model for HIP
NAT_TRAVERSAL_MODE
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- mode_id: tuple[NATTraversal, ...]¶
Mode IDs
- class pcapkit.protocols.data.internet.hip.TransactionPacingParameter(type, critical, length, min_ta)[source]¶
Bases:
Parameter
Data model for HIP
TRANSACTION_PACING
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.EncryptedParameter(type, critical, length, raw)[source]¶
Bases:
Parameter
Data model for HIP
ENCRYPTED
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.HostIDParameter(type, critical, length, hi_len, di_type, di_len, algorithm, hi, di)[source]¶
Bases:
Parameter
Data model for HIP
HOST_ID
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- algorithm: HIAlgorithm¶
Algorithm type.
- hi: HostIdentity | bytes¶
Host identity.
- class pcapkit.protocols.data.internet.hip.HostIdentity(curve, pubkey)[source]¶
Bases:
Info
Data model for host identity.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- curve: ECDSACurve | ECDSALowCurve¶
Curve type.
- class pcapkit.protocols.data.internet.hip.HITSuiteListParameter(type, critical, length, suite_id)[source]¶
Bases:
Parameter
Data model for HIP
HIST_SUITE_LIST
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.CertParameter(type, critical, length, cert_group, cert_count, cert_id, cert_type, cert)[source]¶
Bases:
Parameter
Data model for HIP
CERT
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- cert_type: Certificate¶
Certificate type.
- class pcapkit.protocols.data.internet.hip.NotificationParameter(type, critical, length, msg_type, msg)[source]¶
Bases:
Parameter
Data model for HIP
NOTIFICATION
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- msg_type: NotifyMessage¶
Notify message type.
- class pcapkit.protocols.data.internet.hip.EchoRequestSignedParameter(type, critical, length, opaque)[source]¶
Bases:
Parameter
Data model for HIP
ECHO_REQUEST_SIGNED
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.RegInfoParameter(type, critical, length, lifetime, reg_type)[source]¶
Bases:
Parameter
Data model for HIP
REG_INFO
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- reg_type: tuple[Registration, ...]¶
Registration type.
- class pcapkit.protocols.data.internet.hip.Lifetime(min, max)[source]¶
Bases:
Info
Data model for registration lifetime.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- min: timedelta¶
Minimum lifetime.
- max: timedelta¶
Maximum lifetime.
- class pcapkit.protocols.data.internet.hip.RegRequestParameter(type, critical, length, lifetime, reg_type)[source]¶
Bases:
Parameter
Data model for HIP
REG_REQUEST
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- reg_type: tuple[Registration, ...]¶
Registration type.
- class pcapkit.protocols.data.internet.hip.RegResponseParameter(type, critical, length, lifetime, reg_type)[source]¶
Bases:
Parameter
Data model for HIP
REG_RESPONSE
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- reg_type: tuple[Registration, ...]¶
Registration type.
- class pcapkit.protocols.data.internet.hip.RegFailedParameter(type, critical, length, lifetime, reg_type)[source]¶
Bases:
Parameter
Data model for HIP
REG_FAILED
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- reg_type: tuple[RegistrationFailure, ...]¶
Registration failure type.
- class pcapkit.protocols.data.internet.hip.RegFromParameter(type, critical, length, port, protocol, address)[source]¶
Bases:
Parameter
Data model for HIP
REG_FROM
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- address: IPv6Address¶
Address.
- class pcapkit.protocols.data.internet.hip.EchoResponseSignedParameter(type, critical, length, opaque)[source]¶
Bases:
Parameter
Data model for HIP
ECHO_RESPONSE_SIGNED
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.TransportFormatListParameter(type, critical, length, tf_type)[source]¶
Bases:
Parameter
Data model for HIP
TRANSPORT_FORMAT_LIST
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.ESPTransformParameter(type, critical, length, suite_id)[source]¶
Bases:
Parameter
Data model for HIP
ESP_TRANSFORM
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- suite_id: tuple[ESPTransformSuite, ...]¶
ESP transform.
- class pcapkit.protocols.data.internet.hip.SeqDataParameter(type, critical, length, seq)[source]¶
Bases:
Parameter
Data model for HIP
SEQ_DATA
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.AckDataParameter(type, critical, length, ack)[source]¶
Bases:
Parameter
Data model for HIP
ACK_DATA
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.PayloadMICParameter(type, critical, length, next, payload, mic)[source]¶
Bases:
Parameter
Data model for HIP
PAYLOAD_MIC
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.TransactionIDParameter(type, critical, length, id)[source]¶
Bases:
Parameter
Data model for HIP
TRANSACTION_ID
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.OverlayIDParameter(type, critical, length, id)[source]¶
Bases:
Parameter
Data mode HIP
OVERLAY_ID
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.RouteDstParameter(type, critical, length, flags, hit)[source]¶
Bases:
Parameter
Data model for HIP
ROUTE_DST
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.Flags(symmetric, must_follow)[source]¶
Bases:
Info
Data model for flags in HIP
HIP_PARAMETER_FLAGS
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.HIPTransportModeParameter(type, critical, length, port, mode_id)[source]¶
Bases:
Parameter
Data model for HIP
HIP_TRANSPORT_MODE
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.HIPMACParameter(type, critical, length, hmac)[source]¶
Bases:
Parameter
Data model for HIP
HIP_MAC
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.HIPMAC2Parameter(type, critical, length, hmac)[source]¶
Bases:
Parameter
Data model for HIP
HIP_MAC_2
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.HIPSignature2Parameter(type, critical, length, algorithm, signature)[source]¶
Bases:
Parameter
Data model for HIP
HIP_SIGNATURE_2
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- algorithm: HIAlgorithm¶
Signature algorithm.
- class pcapkit.protocols.data.internet.hip.HIPSignatureParameter(type, critical, length, algorithm, signature)[source]¶
Bases:
Parameter
Data model for HIP
HIP_SIGNATURE
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- algorithm: HIAlgorithm¶
Signature algorithm.
- class pcapkit.protocols.data.internet.hip.EchoRequestUnsignedParameter(type, critical, length, opaque)[source]¶
Bases:
Parameter
Data model for HIP
ECHO_REQUEST_UNSIGNED
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.EchoResponseUnsignedParameter(type, critical, length, opaque)[source]¶
Bases:
Parameter
Data model for HIP
ECHO_RESPONSE_UNSIGNED
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.RelayFromParameter(type, critical, length, port, protocol, address)[source]¶
Bases:
Parameter
Data model for HIP
RELAY_FROM
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- address: IPv6Address¶
Address.
- class pcapkit.protocols.data.internet.hip.RelayToParameter(type, critical, length, port, protocol, address)[source]¶
Bases:
Parameter
Data model for HIP
RELAY_TO
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- address: IPv6Address¶
Address.
- class pcapkit.protocols.data.internet.hip.OverlayTTLParameter(type, critical, length, ttl)[source]¶
Bases:
Parameter
Data model for HIP
OVERLAY_TTL
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- ttl: timedelta¶
TTL value.
- class pcapkit.protocols.data.internet.hip.RouteViaParameter(type, critical, length, flags, hit)[source]¶
Bases:
Parameter
Data model for HIP
ROUTE_VIA
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.FromParameter(type, critical, length, address)[source]¶
Bases:
Parameter
Data model for HIP
FROM
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- address: IPv6Address¶
HIT address.
- class pcapkit.protocols.data.internet.hip.RVSHMACParameter(type, critical, length, hmac)[source]¶
Bases:
Parameter
Data model for HIP
RVS_HMAC
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.ViaRVSParameter(type, critical, length, address)[source]¶
Bases:
Parameter
Data model for HIP
VIA_RVS
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.hip.RelayHMACParameter(type, critical, length, hmac)[source]¶
Bases:
Parameter
Data model for HIP
RELAY_HMAC
parameter.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
MH - Mobility Header¶
pcapkit.protocols.internet.mh
contains
MH
only,
which implements extractor for Mobility Header
(MH) *, whose structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Next Header |
1 |
8 |
|
Header Length |
2 |
16 |
|
Mobility Header Type |
3 |
24 |
Reserved |
|
4 |
32 |
|
Checksum |
6 |
48 |
|
Message Data |
Todo
Implements extractor for message data of all MH types.
- class pcapkit.protocols.internet.mh.MH(file=None, length=None, **kwargs)[source]¶
-
This class implements Mobility Header.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- __post_init__(file: BinaryIO, length: Optional[int] = None, *, version: Literal[4, 6] = 4, extension: bool = False, **kwargs: Any) None [source]¶
- __post_init__(**kwargs: Any) None
Post initialisation hook.
- Parameters
See also
For construction argument, please refer to
make()
.- Return type
- property name: Literal['Mobility Header']¶
Name of current protocol.
- Return type
Literal
[‘Mobility Header’]
- property payload: Protocol | NoReturn¶
Payload of current instance.
- Raises
UnsupportedCall – if the protocol is used as an IPv6 extension header
- property protocol: Optional[str] | NoReturn¶
Name of next layer protocol (if any).
- Raises
UnsupportedCall – if the protocol is used as an IPv6 extension header
- property protochain: ProtoChain | NoReturn¶
Protocol chain of current instance.
- Raises
UnsupportedCall – if the protocol is used as an IPv6 extension header
- read(length=None, *, version=4, extension=False, **kwargs)[source]¶
Read Mobility Header.
Structure of MH header [RFC 6275]:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Payload Proto | Header Len | MH Type | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Checksum | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | . . . Message Data . . . | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Data Structures¶
- class pcapkit.protocols.data.internet.mh.MH(next, length, type, chksum, data)[source]¶
Bases:
Info
Data model for MH protocol.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
IPX - Internetwork Packet Exchange¶
pcapkit.protocols.internet.ipx
contains
IPX
only,
which implements extractor for Internetwork Packet
Exchange (IPX) *, whose structure is described
as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Checksum |
2 |
16 |
|
Packet Length (header includes) |
4 |
32 |
|
Transport Control (hop count) |
5 |
40 |
|
Packet Type |
6 |
48 |
|
Destination Address |
18 |
144 |
|
Source Address |
- class pcapkit.protocols.internet.ipx.IPX(file=None, length=None, **kwargs)[source]¶
-
This class implements Internetwork Packet Exchange.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- property name: Literal['Internetwork Packet Exchange']¶
Name of corresponding protocol.
- Return type
Literal
[‘Internetwork Packet Exchange’]
- read(length=None, **kwargs)[source]¶
Read Internetwork Packet Exchange.
- Args:
length: Length of packet data. **kwargs: Arbitrary keyword arguments.
Data Structures¶
- class pcapkit.protocols.data.internet.ipx.IPX(chksum, len, count, type, dst, src)[source]¶
Bases:
Info
Data model for Internetwork Packet Exchange.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipx.Address(network, node, socket, addr)[source]¶
Bases:
Info
Data model for IPX address.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
Todo
Implements ECN, ESP, ICMP, ICMPv6, IGMP, Shim6.
Protocol Registry¶
- pcapkit.protocols.internet.ETHERTYPE¶
Alias of
pcapkit.const.reg.ethertype.EtherType
.
Transport Layer Protocols¶
pcapkit.protocols.transport
is collection of all protocols in
transport layer, with detailed implementation and methods.
Base Protocol¶
pcapkit.protocols.transport.transport
contains
Transport
,
which is a base class for transport layer protocols, eg.
TCP
and
UDP
.
- class pcapkit.protocols.transport.transport.Transport(file=None, length=None, **kwargs)[source]¶
Bases:
Protocol
[PT
],Generic
[PT
]Abstract base class for transport layer protocol family.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- classmethod register(code, module, class_)[source]¶
Register a new protocol class.
Important
This method must be called from a non-abstract class, as the protocol map should be associated directly with specific transport layer protocol type.
- Parameters
- Return type
None
Notes
The full qualified class name of the new protocol class should be as
{module}.{class_}
.
- _decode_next_layer(dict_, ports, length=None)[source]¶
Decode next layer protocol.
The method will check if the next layer protocol is supported based on the source and destination port numbers. We will use the lower port number from both ports as the primary key to lookup the next layer.
- __layer__: Optional[Literal['Link', 'Internet', 'Transport', 'Application']] = 'Transport'¶
Layer of protocol.
- __proto__: DefaultDict[int, tuple[str, str]]¶
Protocol index mapping for decoding next layer, c.f.
self._decode_next_layer
&self._import_next_layer
.Important
The attribute must be defined and maintained in subclass.
TCP - Transmission Control Protocol¶
pcapkit.protocols.transport.tcp
contains
TCP
only,
which implements extractor for Transmission Control
Protocol (TCP) *, whose structure is described as
below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Source Port |
2 |
16 |
|
Destination Port |
4 |
32 |
|
Sequence Number |
8 |
64 |
|
Acknowledgement Number (if ACK set) |
12 |
96 |
|
Data Offset |
12 |
100 |
Reserved (must be |
|
12 |
103 |
|
ECN Concealment Protection (NS) |
13 |
104 |
|
Congestion Window Reduced (CWR) |
13 |
105 |
|
ECN-Echo (ECE) |
13 |
106 |
|
Urgent (URG) |
13 |
107 |
|
Acknowledgement (ACK) |
13 |
108 |
|
Push Function (PSH) |
13 |
109 |
|
Reset Connection (RST) |
13 |
110 |
|
Synchronize Sequence Numbers (SYN) |
13 |
111 |
|
Last Packet from Sender (FIN) |
14 |
112 |
|
Size of Receive Window |
16 |
128 |
|
Checksum |
18 |
144 |
|
Urgent Pointer (if URG set) |
20 |
160 |
|
TCP Options (if data offset > 5) |
- class pcapkit.protocols.transport.tcp.TCP(file=None, length=None, **kwargs)[source]¶
-
This class implements Transmission Control Protocol.
This class currently supports parsing of the following protocols, which are registered in the
self.__proto__
attribute:Port Number
Protocol
21
80
This class currently supports parsing of the following TCP options, which are directly mapped to the
pcapkit.const.tcp.option.Option
enumeration:Option Code
Option Parser
This class currently supports parsing of the following Multipath TCP options, which are directly mapped to the
pcapkit.const.tcp.mp_tcp_option.MPTCPOption
enumeration:Option Code
Option Parser
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- property name: Literal['Transmission Control Protocol']¶
Name of current protocol.
- Return type
Literal[“Transmission Control Protocol”]
- read(length=None, **kwargs)[source]¶
Read Transmission Control Protocol (TCP).
Structure of TCP header [RFC 793]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Source Port | Destination Port | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Sequence Number | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Acknowledgement Number | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Data | |U|A|P|R|S|F| | | Offset| Reserved |R|C|S|S|Y|I| Window | | | |G|K|H|T|N|N| | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Checksum | Urgent Pointer | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Options | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | data | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- classmethod register_option(code, meth)[source]¶
Register an option parser.
- Parameters
code (RegType_Option) – TCP option code.
meth (str | OptionParser) – Method name or callable to parse the option.
- Return type
None
- classmethod register_mp_option(code, meth)[source]¶
Register an MPTCP option parser.
- Parameters
code (RegType_MPTCPOption) – MPTCP option code.
meth (str | MPOptionParser) – Method name or callable to parse the option.
- Return type
None
- _read_tcp_options(size)[source]¶
Read TCP option list.
- Parameters
size (int) – length of option list
- Return type
- Returns
Extracted TCP options.
- Raises
ProtocolError – If the threshold is NOT matching.
- _read_mode_donone(kind, *, options)[source]¶
Read options request no process.
- Parameters
kind (RegType_Option) – option kind value
options (Option) – extracted TCP options
- Return type
DataType_UnassignedOption
- Returns
Parsed option data.
- _read_mode_eool(kind, *, options)[source]¶
Read TCP End of Option List option.
Structure of TCP end of option list option [RFC 793]:
+--------+ |00000000| +--------+ Kind=0
- Parameters
kind (RegType_Option) – option kind value
options (Option) – extracted TCP options
- Return type
DataType_EndOfOptionList
- Returns
Parsed option data.
- _read_mode_nop(kind, *, options)[source]¶
Read TCP No Operation option.
Structure of TCP maximum segment size option [RFC 793]:
+--------+ |00000001| +--------+ Kind=1
- Parameters
kind (RegType_Option) – option kind value
options (Option) – extracted TCP options
- Return type
DataType_NoOperation
- Returns
Parsed option data.
- _read_mode_mss(kind, *, options)[source]¶
Read TCP max segment size option.
Structure of TCP maximum segment size option [RFC 793]:
+--------+--------+---------+--------+ |00000010|00000100| max seg size | +--------+--------+---------+--------+ Kind=2 Length=4
- Parameters
kind (RegType_Option) – option kind value
options (Option) – extracted TCP options
- Return type
DataType_MaximumSegmentSize
- Returns
Parsed option data.
- Raises
ProtocolError – If length is NOT
4
.
- _read_mode_ws(kind, *, options)[source]¶
Read TCP windows scale option.
Structure of TCP window scale option [RFC 7323]:
+---------+---------+---------+ | Kind=3 |Length=3 |shift.cnt| +---------+---------+---------+ 1 1 1
- Parameters
kind (RegType_Option) – option kind value
options (Option) – extracted TCP options
- Return type
DataType_WindowScale
- Returns
Parsed option data.
- Raises
ProtocolError – If length is NOT
3
.
- _read_mode_sackpmt(kind, *, options)[source]¶
Read TCP SACK permitted option.
Structure of TCP SACK permitted option [RFC 2018]:
+---------+---------+ | Kind=4 | Length=2| +---------+---------+
- Parameters
kind (RegType_Option) – option kind value
options (Option) – extracted TCP options
- Return type
DataType_SACKPermitted
- Returns
Parsed option data.
- Raises
ProtocolError – If length is NOT
2
.
- _read_mode_sack(kind, *, options)[source]¶
Read TCP SACK option.
Structure of TCP SACK option [RFC 2018]:
+--------+--------+ | Kind=5 | Length | +--------+--------+--------+--------+ | Left Edge of 1st Block | +--------+--------+--------+--------+ | Right Edge of 1st Block | +--------+--------+--------+--------+ | | / . . . / | | +--------+--------+--------+--------+ | Left Edge of nth Block | +--------+--------+--------+--------+ | Right Edge of nth Block | +--------+--------+--------+--------+
- Parameters
kind (RegType_Option) – option kind value
options (Option) – extracted TCP options
- Return type
DataType_SACK
- Returns
Parsed option data.
- Raises
ProtocolError – If length is NOT
8
.
- _read_mode_echo(kind, *, options)[source]¶
Read TCP echo option.
Structure of TCP echo option [RFC 1072]:
+--------+--------+--------+--------+--------+--------+ | Kind=6 | Length | 4 bytes of info to be echoed | +--------+--------+--------+--------+--------+--------+
- Parameters
kind (RegType_Option) – option kind value
options (Option) – extracted TCP options
- Return type
DataType_Echo
- Returns
Parsed option data.
- Raises
ProtocolError – If length is NOT
6
.
- _read_mode_echore(kind, *, options)[source]¶
Read TCP echo reply option.
Structure of TCP echo reply option [RFC 1072]:
+--------+--------+--------+--------+--------+--------+ | Kind=7 | Length | 4 bytes of echoed info | +--------+--------+--------+--------+--------+--------+
- Parameters
kind (RegType_Option) – option kind value
options (Option) – extracted TCP options
- Return type
DataType_EchoReply
- Returns
Parsed option data.
- Raises
ProtocolError – If length is NOT
6
.
- _read_mode_ts(kind, *, options)[source]¶
Read TCP timestamps option.
Structure of TCP timestamp option [RFC 7323]:
+-------+-------+---------------------+---------------------+ |Kind=8 | 10 | TS Value (TSval) |TS Echo Reply (TSecr)| +-------+-------+---------------------+---------------------+ 1 1 4 4
- Parameters
kind (RegType_Option) – option kind value
options (Option) – extracted TCP options
- Return type
DataType_Timestamp
- Returns
Parsed option data.
- Raises
ProtocolError – If length is NOT
10
.
- _read_mode_poc(kind, *, options)[source]¶
Read TCP partial order connection service profile option.
Structure of TCP
POC-Permitted
option [RFC 1693][RFC 6247]:+-----------+-------------+ | Kind=9 | Length=2 | +-----------+-------------+
- Parameters
kind (RegType_Option) – option kind value
options (Option) – extracted TCP options
- Return type
DataType_PartialOrderConnectionPermitted
- Returns
Parsed option data.
- Raises
ProtocolError – If length is NOT
2
.
- _read_mode_pocsp(kind, *, options)[source]¶
Read TCP partial order connection service profile option.
Structure of TCP
POC-SP
option [RFC 1693][RFC 6247]:1 bit 1 bit 6 bits +----------+----------+------------+----------+--------+ | Kind=10 | Length=3 | Start_flag | End_flag | Filler | +----------+----------+------------+----------+--------+
- Parameters
kind (RegType_Option) – option kind value
options (Option) – extracted TCP options
- Return type
DataType_PartialOrderConnectionProfile
- Returns
Parsed option data.
- Raises
ProtocolError – If length is NOT
3
.
- _read_mode_cc(kind, *, options)[source]¶
Read TCP connection count option.
Structure of TCP
CC
option [RFC 1644]:+--------+--------+--------+--------+--------+--------+ |00001011|00000110| Connection Count: SEG.CC | +--------+--------+--------+--------+--------+--------+ Kind=11 Length=6
- Parameters
kind (RegType_Option) – option kind value
options (Option) – extracted TCP options
- Return type
DataType_CC
- Returns
Parsed option data.
- Raises
ProtocolError – If length is NOT
6
.
- _read_mode_ccnew(kind, *, options)[source]¶
Read TCP connection count (new) option.
Structure of TCP
CC.NEW
option [RFC 1644]:+--------+--------+--------+--------+--------+--------+ |00001100|00000110| Connection Count: SEG.CC | +--------+--------+--------+--------+--------+--------+ Kind=12 Length=6
- Parameters
kind (RegType_Option) – option kind value
options (Option) – extracted TCP options
- Return type
DataType_CCNew
- Returns
Parsed option data.
- Raises
ProtocolError – If length is NOT
6
.
- _read_mode_ccecho(kind, *, options)[source]¶
Read TCP connection count (echo) option.
Structure of TCP
CC.ECHO
option [RFC 1644]:+--------+--------+--------+--------+--------+--------+ |00001101|00000110| Connection Count: SEG.CC | +--------+--------+--------+--------+--------+--------+ Kind=13 Length=6
- Parameters
kind (RegType_Option) – option kind value
options (Option) – extracted TCP options
- Return type
DataType_CCEcho
- Returns
Parsed option data.
- Raises
ProtocolError – If length is NOT
6
.
- _read_mode_chkreq(kind, *, options)[source]¶
Read Alternate Checksum Request option.
Structure of TCP
CHKSUM-REQ
[RFC 1146][RFC 6247]:+----------+----------+----------+ | Kind=14 | Length=3 | chksum | +----------+----------+----------+
- Parameters
kind (RegType_Option) – option kind value
options (Option) – extracted TCP options
- Return type
DataType_AlternateChecksumRequest
- Returns
Parsed option data.
- Raises
ProtocolError – If length is NOT
3
.
- _read_mode_chksum(kind, *, options)[source]¶
Read Alternate Checksum Data option.
Structure of TCP
CHKSUM
[RFC 1146][RFC 6247]:+---------+---------+---------+ +---------+ | Kind=15 |Length=N | data | ... | data | +---------+---------+---------+ +---------+
- Parameters
kind (RegType_Option) – option kind value
options (Option) – extracted TCP options
- Return type
DataType_AlternateChecksumData
- Returns
Parsed option data.
- _read_mode_sig(kind, *, options)[source]¶
Read MD5 Signature option.
Structure of TCP
SIG
option [RFC 2385]:+---------+---------+-------------------+ | Kind=19 |Length=18| MD5 digest... | +---------+---------+-------------------+ | | +---------------------------------------+ | | +---------------------------------------+ | | +-------------------+-------------------+ | | +-------------------+
- Parameters
kind (RegType_Option) – option kind value
options (Option) – extracted TCP options
- Return type
DataType_MD5Signature
- Returns
Parsed option data.
- Raises
ProtocolError – If length is NOT
18
.
- _read_mode_qs(kind, *, options)[source]¶
Read Quick-Start Response option.
Structure of TCP
QSopt
[RFC 4782]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Kind | Length=8 | Resv. | Rate | TTL Diff | | | | |Request| | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | QS Nonce | R | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
kind (RegType_Option) – option kind value
options (Option) – extracted TCP options
- Return type
DataType_QuickStartResponse
- Returns
Parsed option data.
- Raises
ProtocolError – If length is NOT
8
.
- _read_mode_timeout(kind, *, options)[source]¶
Read User Timeout option.
Structure of TCP
TIMEOUT
[RFC 5482]:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Kind = 28 | Length = 4 |G| User Timeout | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
kind (RegType_Option) – option kind value
options (Option) – extracted TCP options
- Return type
DataType_UserTimeout
- Returns
Parsed option data.
- Raises
ProtocolError – If length is NOT
4
.
- _read_mode_ao(kind, *, options)[source]¶
Read Authentication option.
Structure of TCP
AOopt
[RFC 5925]:+------------+------------+------------+------------+ | Kind=29 | Length | KeyID | RNextKeyID | +------------+------------+------------+------------+ | MAC ... +-----------------------------------... ...-----------------+ ... MAC (con't) | ...-----------------+
- Parameters
kind (RegType_Option) – option kind value
options (Option) – extracted TCP options
- Return type
DataType_Authentication
- Returns
Parsed option data.
- Raises
ProtocolError – If length is NOT larger than or equal to
4
.
- _read_mode_mp(kind, *, options)[source]¶
Read Multipath TCP option.
Structure of
MP-TCP
[RFC 6824]:1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +---------------+---------------+-------+-----------------------+ | Kind | Length |Subtype| | +---------------+---------------+-------+ | | Subtype-specific data | | (variable length) | +---------------------------------------------------------------+
- Parameters
kind (RegType_Option) – option kind value
options (Option) – extracted TCP options
- Return type
DataType_MPTCP
- Returns
Parsed option data.
- _read_mode_fastopen(kind, *, options)[source]¶
Read Fast Open option.
Structure of TCP
FASTOPEN
[RFC 7413]:+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Kind | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | ~ Cookie ~ | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
kind (RegType_Option) – option kind value
options (Option) – extracted TCP options
- Return type
DataType_FastOpenCookie
- Returns
Parsed option data.
- Raises
ProtocolError – If length is NOT valid.
- _read_mptcp_capable(kind, dlen, bits, *, options)[source]¶
Read Multipath Capable option.
Structure of
MP_CAPABLE
[RFC 6824]:1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +---------------+---------------+-------+-------+---------------+ | Kind | Length |Subtype|Version|A|B|C|D|E|F|G|H| +---------------+---------------+-------+-------+---------------+ | Option Sender's Key (64 bits) | | | | | +---------------------------------------------------------------+ | Option Receiver's Key (64 bits) | | (if option Length == 20) | | | +---------------------------------------------------------------+
- Parameters
- Return type
DataType_MPTCPCapable
- Returns
Parsed option data.
- Raises
ProtocolError – If length is NOT
20
or32
.
- _read_mptcp_join(kind, dlen, bits, *, options)[source]¶
Read Join Connection option.
- Parameters
- Return type
DataType_MPTCPJoin
- Returns
Parsed option data.
- Raises
ProtocolError – If the option is not given on a valid SYN/ACK packet.
- _read_mptcp_dss(kind, dlen, bits, *, options)[source]¶
Read Data Sequence Signal (Data ACK and Data Sequence Mapping) option.
Structure of
DSS
[RFC 6824]:1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +---------------+---------------+-------+----------------------+ | Kind | Length |Subtype| (reserved) |F|m|M|a|A| +---------------+---------------+-------+----------------------+ | | | Data ACK (4 or 8 octets, depending on flags) | | | +--------------------------------------------------------------+ | | | Data sequence number (4 or 8 octets, depending on flags) | | | +--------------------------------------------------------------+ | Subflow Sequence Number (4 octets) | +-------------------------------+------------------------------+ | Data-Level Length (2 octets) | Checksum (2 octets) | +-------------------------------+------------------------------+
- _read_mptcp_addaddr(kind, dlen, bits, *, options)[source]¶
Read Add Address option.
Structure of
ADD_ADDR
[RFC 6824]:1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +---------------+---------------+-------+-------+---------------+ | Kind | Length |Subtype| IPVer | Address ID | +---------------+---------------+-------+-------+---------------+ | Address (IPv4 - 4 octets / IPv6 - 16 octets) | +-------------------------------+-------------------------------+ | Port (2 octets, optional) | +-------------------------------+
- Parameters
- Return type
DataType_MPTCPAddAddress
- Returns
Parsed option data.
- Raises
ProtocolError – Invalid IP version and/or addresses.
- _read_mptcp_remove(kind, dlen, bits, *, options)[source]¶
Read Remove Address option.
Structure of
REMOVE_ADDR
[RFC 6824]:1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +---------------+---------------+-------+-------+---------------+ | Kind | Length = 3+n |Subtype|(resvd)| Address ID | ... +---------------+---------------+-------+-------+---------------+ (followed by n-1 Address IDs, if required)
- Parameters
- Return type
DataType_MPTCPRemoveAddress
- Returns
Parsed option data.
- Raises
ProtocolError – If the length is smaller than 3.
- _read_mptcp_prio(kind, dlen, bits, *, options)[source]¶
Read Change Subflow Priority option.
Structure of
MP_PRIO
[RFC 6824]:1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +---------------+---------------+-------+-----+-+--------------+ | Kind | Length |Subtype| |B| AddrID (opt) | +---------------+---------------+-------+-----+-+--------------+
- Parameters
- Return type
DataType_MPTCPPriority
- Returns
Parsed option data.
- Raises
ProtocolError – If the length is smaller than 3.
- _read_mptcp_fail(kind, dlen, bits, *, options)[source]¶
Read Fallback option.
Structure of
MP_FAIL
[RFC 6824]:1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +---------------+---------------+-------+----------------------+ | Kind | Length=12 |Subtype| (reserved) | +---------------+---------------+-------+----------------------+ | | | Data Sequence Number (8 octets) | | | +--------------------------------------------------------------+
- Parameters
- Return type
DataType_MPTCPFallback
- Returns
Parsed option data.
- Raises
ProtocolError – If the length is NOT 12.
- _read_mptcp_fastclose(kind, dlen, bits, *, options)[source]¶
Read Fast Close option.
Structure of
MP_FASTCLOSE
[RFC 6824]:1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +---------------+---------------+-------+-----------------------+ | Kind | Length |Subtype| (reserved) | +---------------+---------------+-------+-----------------------+ | Option Receiver's Key | | (64 bits) | | | +---------------------------------------------------------------+
- Parameters
- Return type
DataType_MPTCPFastclose
- Returns
Parsed option data.
- Raises
ProtocolError – If the length is NOT 16.
- _read_join_syn(kind, dlen, bits, *, options)[source]¶
Read Join Connection option for Initial SYN.
Structure of
MP_JOIN-SYN
[RFC 6824]:1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +---------------+---------------+-------+-----+-+---------------+ | Kind | Length = 12 |Subtype| |B| Address ID | +---------------+---------------+-------+-----+-+---------------+ | Receiver's Token (32 bits) | +---------------------------------------------------------------+ | Sender's Random Number (32 bits) | +---------------------------------------------------------------+
- Parameters
- Return type
DataType_MPTCPJoinSYN
- Returns
Parsed option data.
- Raises
ProtocolError – If length is NOT
12
.
- _read_join_synack(kind, dlen, bits, *, options)[source]¶
Read Join Connection option for Responding SYN/ACK.
Structure of
MP_JOIN-SYN/ACK
[RFC 6824]:1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +---------------+---------------+-------+-----+-+---------------+ | Kind | Length = 16 |Subtype| |B| Address ID | +---------------+---------------+-------+-----+-+---------------+ | | | Sender's Truncated HMAC (64 bits) | | | +---------------------------------------------------------------+ | Sender's Random Number (32 bits) | +---------------------------------------------------------------+
- Parameters
- Return type
DataType_MPTCPJoinSYNACK
- Returns
Parsed option data.
- Raises
ProtocolError – If length is NOT
20
.
- _read_join_ack(kind, dlen, bits, *, options)[source]¶
Read Join Connection option for Third ACK.
Structure of
MP_JOIN-ACK
[RFC 6824]:1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +---------------+---------------+-------+-----------------------+ | Kind | Length = 24 |Subtype| (reserved) | +---------------+---------------+-------+-----------------------+ | | | | | Sender's HMAC (160 bits) | | | | | +---------------------------------------------------------------+
- Parameters
- Return type
DataType_MPTCPJoinACK
- Returns
Parsed option data.
- Raises
ProtocolError – If length is NOT
24
.
- __proto__: DefaultDict[int, tuple[str, str]]¶
Protocol index mapping for decoding next layer, c.f.
self._decode_next_layer
&self._import_next_layer
.
- __option__: DefaultDict[int, str | OptionParser]¶
Option code to method mapping, c.f.
_read_tcp_options()
. Method names are expected to be referred to the class by_read_mode_${name}
, and if such name not found, the value should then be a method that can parse the option by itself.- Type
DefaultDict[RegType_Option, str | OptionParser]
Data Structures¶
- class pcapkit.protocols.data.transport.tcp.TCP(srcport, dstport, seq, ack, hdr_len, flags, window_size, checksum, urgent_pointer)[source]¶
Bases:
Info
Data model for TCP packet.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- options: OrderedMultiDict[OptionNumber, Option]¶
- class pcapkit.protocols.data.transport.tcp.Flags(ns, cwr, ece, urg, ack, psh, rst, syn, fin)[source]¶
Bases:
Info
Data model for TCP flags.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.Option(kind, length)[source]¶
Bases:
Info
Data model for TCP options.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- kind: OptionNumber¶
Option kind.
- class pcapkit.protocols.data.transport.tcp.UnassignedOption(kind, length, data)[source]¶
Bases:
Option
Data model for unassigned TCP option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.EndOfOptionList(kind, length)[source]¶
Bases:
Option
Data model for TCP end of option list option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.NoOperation(kind, length)[source]¶
Bases:
Option
Data model for TCP no operation option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.MaximumSegmentSize(kind, length, mss)[source]¶
Bases:
Option
Data model for TCP maximum segment size option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.WindowScale(kind, length, shift)[source]¶
Bases:
Option
Data model for TCP window scale option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.SACKPermitted(kind, length)[source]¶
Bases:
Option
Data model for TCP SACK permitted option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.SACK(kind, length, sack)[source]¶
Bases:
Option
Data model for TCP SACK option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.Echo(kind, length, data)[source]¶
Bases:
Option
Data model for TCP echo option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.EchoReply(kind, length, data)[source]¶
Bases:
Option
Data model for TCP echo reply option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.Timestamp(kind, length, timestamp, echo)[source]¶
Bases:
Option
Data model for TCP timestamp option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.PartialOrderConnectionPermitted(kind, length)[source]¶
Bases:
Option
Data model for TCP partial order connection permitted option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.PartialOrderConnectionProfile(kind, length, start, end)[source]¶
Bases:
Option
Data model for TCP partial order connection profile option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.CC(kind, length, cc)[source]¶
Bases:
Option
Data model for TCP CC option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.CCNew(kind, length, cc)[source]¶
Bases:
Option
Data model for TCP CC.NEW option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.CCEcho(kind, length, cc)[source]¶
Bases:
Option
Data model for TCP CC.ECHO option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.AlternateChecksumRequest(kind, length, chksum)[source]¶
Bases:
Option
Data model for TCP alternate checksum request option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.AlternateChecksumData(kind, length, data)[source]¶
Bases:
Option
Data model for TCP alternate checksum data option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.MD5Signature(kind, length, digest)[source]¶
Bases:
Option
Data model for TCP MD5 signature option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.QuickStartResponse(kind, length, req_rate, ttl_diff, nounce)[source]¶
Bases:
Option
Data model for TCP quick start response option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.UserTimeout(kind, length, timeout)[source]¶
Bases:
Option
Data model for TCP user timeout option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- timeout: timedelta¶
User timeout.
- class pcapkit.protocols.data.transport.tcp.Authentication(kind, length, key_id, next_key_id, mac)[source]¶
Bases:
Option
Data model for TCP authentication option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.FastOpenCookie(kind, length, cookie)[source]¶
Bases:
Option
Data model for TCP fast open cookie option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.MPTCP(kind, length, subtype)[source]¶
Bases:
Option
Data model for TCP MPTCP option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- subtype: MPTCPOption¶
Subtype.
- class pcapkit.protocols.data.transport.tcp.MPTCPUnknown(kind, length, subtype, data)[source]¶
Bases:
MPTCP
Data model for TCP unknown MPTCP option.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.MPTCPCapable(kind, length, subtype, version, flags, skey, rkey)[source]¶
Bases:
MPTCP
Data model for TCP
MP_CAPABLE
option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- flags: MPTCPCapableFlag¶
Flags.
- class pcapkit.protocols.data.transport.tcp.MPTCPCapableFlag(req, ext, hsa)[source]¶
Bases:
Info
Data model for TCP MPTCP capable option flags.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.MPTCPJoin(kind, length, subtype)[source]¶
Bases:
MPTCP
Data model for TCP
MP_JOIN
option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.MPTCPJoinSYN(kind, length, subtype, connection, backup, addr_id, token, nounce)[source]¶
Bases:
MPTCPJoin
Data model for TCP
MP_JOIN-SYN
option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- connection: Literal['SYN']¶
Connection type.
- class pcapkit.protocols.data.transport.tcp.MPTCPJoinSYNACK(kind, length, subtype, connection, backup, addr_id, hmac, nounce)[source]¶
Bases:
MPTCPJoin
Data model for TCP
MP_JOIN-SYNACK
option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- connection: Literal['SYN/ACK']¶
Connection type.
- class pcapkit.protocols.data.transport.tcp.MPTCPJoinACK(kind, length, subtype, connection, hmac)[source]¶
Bases:
MPTCPJoin
Data model for TCP
MP_JOIN-ACK
option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- connection: Literal['ACK']¶
Connection type.
- class pcapkit.protocols.data.transport.tcp.MPTCPDSS(kind, length, subtype, flags, ack, dsn, ssn, dl_len, checksum)[source]¶
Bases:
MPTCP
Data model for TCP
DSS
option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- flags: MPTCPDSSFlag¶
Flags.
- class pcapkit.protocols.data.transport.tcp.MPTCPDSSFlag(data_fin, dsn_oct, data_pre, ack_oct, ack_pre)[source]¶
Bases:
Info
Data model for TCP
DSS
option flags.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.MPTCPAddAddress(kind, length, subtype, version, addr_id, addr, port)[source]¶
Bases:
MPTCP
Data model for TCP
ADD_ADDR
option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- addr: IPAddress¶
Address.
- class pcapkit.protocols.data.transport.tcp.MPTCPRemoveAddress(kind, length, subtype, addr_id)[source]¶
Bases:
MPTCP
Data model for TCP
REMOVE_ADDR
option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.MPTCPPriority(kind, length, subtype, backup, addr_id)[source]¶
Bases:
MPTCP
Data model for TCP
MP_PRIO
option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.MPTCPFallback(kind, length, subtype, dsn)[source]¶
Bases:
MPTCP
Data model for TCP
MP_FAIL
option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.transport.tcp.MPTCPFastclose(kind, length, subtype, rkey)[source]¶
Bases:
MPTCP
Data model for TCP
MP_FASTCLOSE
option.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
UDP - User Datagram Protocol¶
pcapkit.protocols.transport.udp
contains
UDP
only,
which implements extractor for User Datagram Protocol
(UDP) *, whose structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Source Port |
2 |
16 |
|
Destination Port |
4 |
32 |
|
Length (header includes) |
6 |
48 |
|
Checksum |
- class pcapkit.protocols.transport.udp.UDP(file=None, length=None, **kwargs)[source]¶
-
This class implements User Datagram Protocol.
This class currently supports parsing of the following protocols, which are registered in the
self.__proto__
attribute:Port Number
Protocol
80
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- property name: Literal['User Datagram Protocol']¶
Name of current protocol.
- Return type
Literal
[‘User Datagram Protocol’]
- read(length=None, **kwargs)[source]¶
Read User Datagram Protocol (UDP).
Structure of UDP header [RFC 768]:
0 7 8 15 16 23 24 31 +--------+--------+--------+--------+ | Source | Destination | | Port | Port | +--------+--------+--------+--------+ | | | | Length | Checksum | +--------+--------+--------+--------+ | | data octets ... +---------------- ...
Data Structures¶
- class pcapkit.protocols.data.transport.udp.UDP(srcport, dstport, len, checksum)[source]¶
Bases:
Info
Data model for UDP protocol.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
Todo
Implements DCCP, RSVP, SCTP.
Protocol Registry¶
- pcapkit.protocols.transport.TRANSTYPE¶
Alias of
pcapkit.const.reg.transtype.TransType
.
Application Layer Protocols¶
pcapkit.protocols.application
is collection of all protocols in
application layer, with detailed implementation and methods.
Base Protocol¶
pcapkit.protocols.application.application
contains only
Application
,
which is a base class for application layer protocols, eg.
HTTP/1.*
,
HTTP/2
and etc.
- class pcapkit.protocols.application.application.Application(file=None, length=None, **kwargs)[source]¶
Bases:
Protocol
[PT
],Generic
[PT
]Abstract base class for transport layer protocol family.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- __post_init__(file: BinaryIO, length: Optional[int] = None, **kwargs: Any) None [source]¶
- __post_init__(**kwargs: Any) None
Post initialisation hook.
- Parameters
See also
For construction arguments, please refer to
self.make
.- Return type
- classmethod __index__()[source]¶
Numeral registry index of the protocol.
- Raises
IntError – This protocol doesn’t support
__index__()
.- Return type
- _decode_next_layer(dict_, proto=None, length=None)[source]¶
Decode next layer protocol.
- Raises
UnsupportedCall – This protocol doesn’t support
_decode_next_layer()
.- Return type
- Parameters
- _import_next_layer(proto, length=None)[source]¶
Import next layer extractor.
- Raises
UnsupportedCall – This protocol doesn’t support
_import_next_layer()
.- Return type
- Parameters
- __layer__: Optional[Literal['Link', 'Internet', 'Transport', 'Application']] = 'Application'¶
Layer of protocol.
HTTP - Hypertext Transfer Protocol¶
pcapkit.protocols.application.http
contains
HTTP
only, which is a base class for Hypertext Transfer
Protocol (HTTP) * family, eg.
HTTP/1.*
and HTTP/2
.
- class pcapkit.protocols.application.http.HTTP(file=None, length=None, **kwargs)[source]¶
Bases:
Application
[HTTP
],Generic
[PT
]This class implements all protocols in HTTP family.
Hypertext Transfer Protocol (HTTP/1.1) [RFC 7230]
Hypertext Transfer Protocol version 2 (HTTP/2) [RFC 7540]
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- property name: Literal['Hypertext Transfer Protocol']¶
Name of current protocol.
- Return type
Literal
[‘Hypertext Transfer Protocol’]
- property alias: Literal['HTTP/0.9', 'HTTP/1.0', 'HTTP/1.1', 'HTTP/2']¶
Acronym of current protocol.
- Return type
Literal
[‘HTTP/0.9’, ‘HTTP/1.0’, ‘HTTP/1.1’, ‘HTTP/2’]
- property version: Literal['0.9', '1.0', '1.1', '2']¶
Version of current protocol.
- Return type
Literal
[‘0.9’, ‘1.0’, ‘1.1’, ‘2’]
- classmethod id()[source]¶
Index ID of the protocol.
- Return type
tuple[Literal[“HTTPv1”], Literal[“HTTPv2”]]
Data Structures¶
- class pcapkit.protocols.data.application.http.HTTP[source]¶
Bases:
Info
Data model for HTTP protocol.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
HTTP/1.* - Hypertext Transfer Protocol¶
pcapkit.protocols.application.httpv1
contains
HTTP
only, which implements extractor for Hypertext Transfer
Protocol (HTTP/1.*) *, whose structure is described
as below:
METHOD URL HTTP/VERSION\r\n :==: REQUEST LINE
<key> : <value>\r\n :==: REQUEST HEADER
............ (Ellipsis) :==: REQUEST HEADER
\r\n :==: REQUEST SEPARATOR
<body> :==: REQUEST BODY (optional)
HTTP/VERSION CODE DESP \r\n :==: RESPONSE LINE
<key> : <value>\r\n :==: RESPONSE HEADER
............ (Ellipsis) :==: RESPONSE HEADER
\r\n :==: RESPONSE SEPARATOR
<body> :==: RESPONSE BODY (optional)
- class pcapkit.protocols.application.httpv1.HTTP(file=None, length=None, **kwargs)[source]¶
-
This class implements Hypertext Transfer Protocol (HTTP/1.*).
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- property alias: Literal['HTTP/0.9', 'HTTP/1.0', 'HTTP/1.1']¶
Acronym of current protocol.
- Return type
Literal
[‘HTTP/0.9’, ‘HTTP/1.0’, ‘HTTP/1.1’]
- property version: Literal['0.9', '1.0', '1.1']¶
Version of current protocol.
- Return type
Literal
[‘0.9’, ‘1.0’, ‘1.1’]
- read(length=None, **kwargs)[source]¶
Read Hypertext Transfer Protocol (HTTP/1.*).
Structure of HTTP/1.* packet [RFC 7230]:
HTTP-message :==: start-line *( header-field CRLF ) CRLF [ message-body ]
- Parameters
- Return type
- Returns
Parsed packet data.
- Raises
ProtocolError – If the packet is malformed.
- classmethod id()[source]¶
Index ID of the protocol.
- Returns
Index ID of the protocol.
- Return type
tuple[Literal[“HTTP”]]
- _read_http_header(header)[source]¶
Read HTTP/1.* header.
Structure of HTTP/1.* header [RFC 7230]:
start-line :==: request-line / status-line request-line :==: method SP request-target SP HTTP-version CRLF status-line :==: HTTP-version SP status-code SP reason-phrase CRLF header-field :==: field-name ":" OWS field-value OWS
- Parameters
header (bytes) – HTTP header data.
- Returns
Parsed packet data.
- Raises
ProtocolError – If the packet is malformed.
- Return type
tuple[DataType_Header, OrderedMultiDict[str, str]]
- pcapkit.protocols.application.httpv1.HTTP_METHODS = ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'TRACE', 'OPTIONS', 'CONNECT', 'PATCH']¶
Supported HTTP method.
Data Structures¶
- class pcapkit.protocols.data.application.httpv1.HTTP(receipt, header, body)[source]¶
Bases:
HTTP
Data model for HTTP/1.* protocol.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- header: OrderedMultiDict[str, str]¶
HTTP header.
- class pcapkit.protocols.data.application.httpv1.Header(type)[source]¶
Bases:
Info
Data model for HTTP/1.* header line.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- type: Literal['request', 'response']¶
Receipt type.
- class pcapkit.protocols.data.application.httpv1.RequestHeader(type, method, uri, version)[source]¶
Bases:
Header
Data model for HTTP/1.* request header line.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- type: Literal['request']¶
HTTP request header line.
- class pcapkit.protocols.data.application.httpv1.ResponseHeader(type, version, status, message)[source]¶
Bases:
Header
Data model for HTTP/1.* response header line.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- type: Literal['response']¶
HTTP response header line.
HTTP/2 - Hypertext Transfer Protocol¶
pcapkit.protocols.application.httpv2
contains
HTTP
only, which implements extractor for Hypertext Transfer
Protocol (HTTP/2) *, whose structure is described as
below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Length |
3 |
24 |
|
Type |
4 |
32 |
|
Flags |
5 |
40 |
Reserved |
|
5 |
41 |
|
Stream Identifier |
9 |
72 |
|
Frame Payload |
- class pcapkit.protocols.application.httpv2.HTTP(file=None, length=None, **kwargs)[source]¶
-
This class implements Hypertext Transfer Protocol (HTTP/2).
This class currently supports parsing of the following HTTP/2 frames, which are directly mapped to the
pcapkit.const.http.frame.Frame
enumeration:Frame Code
Frame Parser
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- read(length=None, **kwargs)[source]¶
Read Hypertext Transfer Protocol (HTTP/2).
Structure of HTTP/2 packet [RFC 7540]:
+-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | +-+-------------+---------------+-------------------------------+ |R| Stream Identifier (31) | +=+=============================================================+ | Frame Payload (0...) ... +---------------------------------------------------------------+
- Parameters
- Return type
- Returns
Parsed packet data.
- Raises
ProtocolError – If the packet is malformed.
- classmethod id()[source]¶
Index ID of the protocol.
- Returns
Index ID of the protocol.
- Return type
tuple[Literal[“HTTP”]]
- classmethod register_frame(code, meth)[source]¶
Register a frame parser.
- Parameters
code (RegType_Frame) – HTTP frame type code.
meth (str | FrameParser) – Method name or callable to parse the frame.
- Return type
None
- _read_http_none(frame, length, flags, sid)[source]¶
Read HTTP packet with unassigned type.
- Parameters
- Return type
- Returns
Parsed packet data.
- Raises
ProtocolError – If the packet is malformed.
- _read_http_data(frame, length, flags, sid)[source]¶
Read HTTP/2
DATA
frames.Structure of HTTP/2
DATA
frame [RFC 7540]:+-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | +-+-------------+---------------+-------------------------------+ |R| Stream Identifier (31) | +---------------+-----------------------------------------------+ |Pad Length? (8)| +---------------+-----------------------------------------------+ | Data (*) ... +---------------------------------------------------------------+ | Padding (*) ... +---------------------------------------------------------------+
- _read_http_headers(frame, length, flags, sid)[source]¶
Read HTTP/2
HEADERS
frames.Structure of HTTP/2
HEADERS
frame [RFC 7540]:+-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | +-+-------------+---------------+-------------------------------+ |R| Stream Identifier (31) | +---------------+-----------------------------------------------+ |Pad Length? (8)| +-+-------------+-----------------------------------------------+ |E| Stream Dependency? (31) | +-+-------------+-----------------------------------------------+ | Weight? (8) | +-+-------------+-----------------------------------------------+ | Header Block Fragment (*) ... +---------------------------------------------------------------+ | Padding (*) ... +---------------------------------------------------------------+
- Parameters
- Return type
- Returns
Parsed packet data.
- Raises
ProtocolError – If the packet is malformed.
- _read_http_priority(frame, length, flags, sid)[source]¶
Read HTTP/2
PRIORITY
frames.Structure of HTTP/2
PRIORITY
frame [RFC 7540]:+-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | +-+-------------+---------------+-------------------------------+ |R| Stream Identifier (31) | +-+-------------------------------------------------------------+ |E| Stream Dependency (31) | +-+-------------+-----------------------------------------------+ | Weight (8) | +-+-------------+
- Parameters
- Return type
- Returns
Parsed packet data.
- Raises
ProtocolError – If the packet is malformed.
- _read_http_rst_stream(frame, length, flags, sid)[source]¶
Read HTTP/2
RST_STREAM
frames.Structure of HTTP/2
RST_STREAM
frame [RFC 7540]:+-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | +-+-------------+---------------+-------------------------------+ |R| Stream Identifier (31) | +---------------------------------------------------------------+ | Error Code (32) | +---------------------------------------------------------------+
- Parameters
- Return type
- Returns
Parsed packet data.
- Raises
ProtocolError – If the packet is malformed.
- _read_http_settings(frame, length, flags, sid)[source]¶
Read HTTP/2
SETTINGS
frames.Structure of HTTP/2
SETTINGS
frame [RFC 7540]:+-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | +-+-------------+---------------+-------------------------------+ |R| Stream Identifier (31) | +---------------------------------------------------------------+ | Identifier (16) | +-------------------------------+-------------------------------+ | Value (32) | +---------------------------------------------------------------+ | ...... |
- Parameters
- Return type
- Returns
Parsed packet data.
- Raises
ProtocolError – If the packet is malformed.
- _read_http_push_promise(frame, length, flags, sid)[source]¶
Read HTTP/2
PUSH_PROMISE
frames.Structure of HTTP/2
PUSH_PROMISE
frame [RFC 7540]:+-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | +-+-------------+---------------+-------------------------------+ |R| Stream Identifier (31) | +---------------+-----------------------------------------------+ |Pad Length? (8)| +-+-------------+-----------------------------------------------+ |R| Promised Stream ID (31) | +-+-----------------------------+-------------------------------+ | Header Block Fragment (*) ... +---------------------------------------------------------------+ | Padding (*) ... +---------------------------------------------------------------+
- Parameters
- Return type
- Returns
Parsed packet data.
- Raises
ProtocolError – If the packet is malformed.
- _read_http_ping(frame, length, flags, sid)[source]¶
Read HTTP/2
PING
frames.Structure of HTTP/2
PING
frame [RFC 7540]:+-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | +-+-------------+---------------+-------------------------------+ |R| Stream Identifier (31) | +---------------------------------------------------------------+ | | | Opaque Data (64) | | | +---------------------------------------------------------------+
- _read_http_goaway(frame, length, flags, sid)[source]¶
Read HTTP/2
GOAWAY
frames.Structure of HTTP/2
GOAWAY
frame [RFC 7540]:+-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | +-+-------------+---------------+-------------------------------+ |R| Stream Identifier (31) | +-+-------------+---------------+-------------------------------+ |R| Last-Stream-ID (31) | +-+-------------------------------------------------------------+ | Error Code (32) | +---------------------------------------------------------------+ | Additional Debug Data (*) | +---------------------------------------------------------------+
- Parameters
- Return type
- Returns
Parsed packet data.
- Raises
ProtocolError – If the packet is malformed.
- _read_http_window_update(frame, length, flags, sid)[source]¶
Read HTTP/2
WINDOW_UPDATE
frames.Structure of HTTP/2
WINDOW_UPDATE
frame [RFC 7540]:+-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | +-+-------------+---------------+-------------------------------+ |R| Stream Identifier (31) | +-+-------------+---------------+-------------------------------+ |R| Window Size Increment (31) | +-+-------------------------------------------------------------+
- Parameters
- Return type
- Returns
Parsed packet data.
- Raises
ProtocolError – If the packet is malformed.
- _read_http_continuation(frame, length, flags, sid)[source]¶
Read HTTP/2
CONTINUATION
frames.Structure of HTTP/2
CONTINUATION
frame [RFC 7540]:+-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | +-+-------------+---------------+-------------------------------+ |R| Stream Identifier (31) | +---------------------------------------------------------------+ | Header Block Fragment (*) ... +---------------------------------------------------------------+
- Parameters
- Return type
- Returns
Parsed packet data.
- Raises
ProtocolError – If the packet is malformed.
- __frame__: DefaultDict[int, str | FrameParser]¶
Frame code to method mapping, c.f.
read()
. Method names are expected to be referred to the class by_read_http_${name}
, and if such name not found, the value should then be a method that can parse the frame by itself.- Type
DefaultDict[RegType_Frame, str | FrameParser]
Data Structures¶
- class pcapkit.protocols.data.application.httpv2.HTTP(length, type, flags, sid)[source]¶
Bases:
HTTP
Data model for HTTP/2 protocol.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.application.httpv2.Flags[source]¶
Bases:
Info
Data model for HTTP/2 flags.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.application.httpv2.UnassignedFrame(length, type, flags, sid, data)[source]¶
Bases:
HTTP
Data model for HTTP/2 unassigned frame.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.application.httpv2.DataFrame(length, type, flags, sid, pad_len, data)[source]¶
Bases:
HTTP
Data model for HTTP/2
DATA
frame.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- flags: DataFrameFlags¶
Flags.
- class pcapkit.protocols.data.application.httpv2.DataFrameFlags(END_STREAM, PADDED)[source]¶
Bases:
Flags
Data model for HTTP/2
DATA
frame flags.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.application.httpv2.HeadersFrame(length, type, flags, sid, pad_len, excl_dependency, stream_dependency, weight, fragment)[source]¶
Bases:
HTTP
Data model for HTTP/2
HEADERS
frame.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- flags: HeadersFrameFlags¶
Flags.
- class pcapkit.protocols.data.application.httpv2.HeadersFrameFlags(END_STREAM, END_HEADERS, PADDED, PRIORITY)[source]¶
Bases:
Flags
Data model for HTTP/2
HEADERS
frame flags.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.application.httpv2.PriorityFrame(length, type, flags, sid, excl_dependency, stream_dependency, weight)[source]¶
Bases:
HTTP
Data model for HTTP/2
PRIORITY
frame.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- flags: Literal[None]¶
Flags.
- class pcapkit.protocols.data.application.httpv2.RstStreamFrame(length, type, flags, sid, error)[source]¶
Bases:
HTTP
Data model for HTTP/2
RST_STREAM
frame.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- flags: Literal[None]¶
Flags.
- class pcapkit.protocols.data.application.httpv2.SettingsFrame(length, type, flags, sid, settings)[source]¶
Bases:
HTTP
Data model for HTTP/2
SETTINGS
frame.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- flags: SettingsFrameFlags¶
Flags.
- settings: OrderedMultiDict[Setting, int]¶
Settings.
- class pcapkit.protocols.data.application.httpv2.SettingsFrameFlags(ACK)[source]¶
Bases:
Flags
Data model for HTTP/2
SETTINGS
frame flags.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.application.httpv2.PushPromiseFrame(length, type, flags, sid, pad_len, promised_sid, fragment)[source]¶
Bases:
HTTP
Data model for HTTP/2
PUSH_PROMISE
frame.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- flags: PushPromiseFrameFlags¶
Flags.
- class pcapkit.protocols.data.application.httpv2.PushPromiseFrameFlags(END_HEADERS, PADDED)[source]¶
Bases:
Flags
Data model for HTTP/2
PUSH_PROMISE
frame flags.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.application.httpv2.PingFrame(length, type, flags, sid, data)[source]¶
Bases:
HTTP
Data model for HTTP/2
PING
frame.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- flags: PingFrameFlags¶
Flags.
- class pcapkit.protocols.data.application.httpv2.PingFrameFlags(ACK)[source]¶
Bases:
Flags
Data model for HTTP/2
PING
frame flags.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.application.httpv2.GoawayFrame(length, type, flags, sid, last_sid, error, debug_data)[source]¶
Bases:
HTTP
Data model for HTTP/2
GOAWAY
frame.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- flags: Literal[None]¶
Flags.
- class pcapkit.protocols.data.application.httpv2.WindowUpdateFrame(length, type, flags, sid, increment)[source]¶
Bases:
HTTP
Data moddel for HTTP/2
WINDOW_UPDATE
frame.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- flags: Literal[None]¶
Flags.
- class pcapkit.protocols.data.application.httpv2.ContinuationFrame(length, type, flags, sid, fragment)[source]¶
Bases:
HTTP
Data model for HTTP/2
CONTINUATION
frame.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- flags: ContinuationFrameFlags¶
Flags.
- class pcapkit.protocols.data.application.httpv2.ContinuationFrameFlags(END_HEADERS)[source]¶
Bases:
Flags
Data model for HTTP/2
CONTINUATION
frame flags.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
FTP - File Transfer Protocol¶
pcapkit.protocols.application.ftp
contains
FTP
only,
which implements extractor for File Transfer Protocol
(FTP) *.
- class pcapkit.protocols.application.ftp.FTP(file=None, length=None, **kwargs)[source]¶
Bases:
Application
[FTP
]This class implements File Transfer Protocol.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- property name: Literal['File Transfer Protocol']¶
Name of current protocol.
- Return type
Literal
[‘File Transfer Protocol’]
- property length: NoReturn¶
Header length of current protocol.
- Raises
UnsupportedCall – This protocol doesn’t support
length
.- Return type
- read(length=None, **kwargs)[source]¶
Read File Transfer Protocol (FTP).
- Parameters
- Return type
- Returns
Parsed packet data.
- Raises
ProtocolError – If the packet is malformed.
Data Structures¶
- class pcapkit.protocols.data.application.ftp.FTP(type)[source]¶
Bases:
Info
Data model for FTP protocol.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- type: Literal['response', 'request']¶
Type.
- class pcapkit.protocols.data.application.ftp.Request(type, command, arg, raw)[source]¶
Bases:
FTP
Data model for FTP request.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- type: Literal['request']¶
Type.
- command: CommandType¶
Command.
- class pcapkit.protocols.data.application.ftp.Response(type, code, arg, mf, raw)[source]¶
Bases:
FTP
Data model for FTP response.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- type: Literal['response']¶
Type.
- code: ReturnCode¶
Return code.
Todo
Implements BGP, DHCP, DHCPv6, DNS, IMAP, LDAP, MQTT, NNTP, NTP, ONC:RPC, POP, RIP, RTP, SIP, SMTP, SNMP, SSH, TELNET, TLS/SSL, XMPP.
Protocol Registry¶
Core Utilities¶
pcapkit.corekit
is the collection of core utilities
for pcapkit
implementation, including dict
like
class Info
,
tuple
like class VersionInfo
,
protocol collection class ProtoChain
,
and MultiDict
family inspired from
Werkzeug
for multientry dict
data mapping.
Info Class¶
pcapkit.corekit.infoclass
contains dict
like class
Info
only, which is originally
designed to work alike dataclasses.dataclass()
as introduced
in PEP 557.
- class pcapkit.corekit.infoclass.Info(dict_=None, **kwargs)[source]¶
Bases:
Mapping
[str
,VT
],Generic
[VT
]Turn dictionaries into
object
like instances.Info
objects are iterable, and support all functions asdict
typeInfo
objects are immutable, thus cannot set or delete attributes after initialisation
Important
Info
will attempt to rename keys with the same names as the class’s builtin methods, and store the mapping information in the__map__
and__map_reverse__
attributes. However, when accessing such renamed keys, the original key name should always be used, i.e., such renaming is totally transparent to the user.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- __map__: dict[str, str]¶
Mapping of name conflicts with builtin methods (original names to transformed names).
- __map_reverse__: dict[str, str]¶
Mapping of name conflicts with builtin methods (transformed names to original names).
- static __new__(cls, *args, **kwargs)[source]¶
Create a new instance.
The class will try to automatically generate
__init__
method with the same signature as specified in class variables’ type annotations, which is inspired by PEP 557 (dataclasses
).
- classmethod from_dict(dict_=None, **kwargs)[source]¶
Create a new instance.
If
dict_
is present and has a.keys()
method, then does:for k in dict_: self[k] = dict_[k]
.If
dict_
is present and has no.keys()
method, then does:for k, v in dict_: self[k] = v
.If
dict_
is not present, then does:for k, v in kwargs.items(): self[k] = v
.
Multi-Mapping Dictionary¶
pcapkit.corekit.multidict
contains multi-mapping dictionary classes,
which are used to store multiple mappings of the same key. The implementation
is inspired and based on the Werkzeug project.
- class pcapkit.corekit.multidict.MultiDict(mapping=None)[source]¶
Bases:
dict
,Generic
[_KT
,_VT
]A
MultiDict
is a dictionary subclass customized to deal with multiple values for the same key.MultiDict
implements all standard dictionary methods. Internally, it saves all values for a key as a list, but the standarddict
access methods will only return the first value for a key. If you want to gain access to the other values, too, you have to use thegetlist()
and similar methods.- Parameters
mapping (Optional[dict[_KT, _VT] | Iterable[tuple[_KT, _VT]]]) – The initial value for the
MultiDict
. Either a regulardict
, an iterable of(key, value)
tuples, orNone
.
It behaves like a normal
dict
thus alldict
functions will only return the first value when multiple values for one key are found.See also
The class is inspired from and based on the Werkzeug project (c.f.
werkzeug.datastructures.MultiDict
).- get(key: _KT) _VT | _T [source]¶
- get(key: _KT, default: _VT | _T = None) _VT | _T
Return the value for key if key is in the dictionary, else default.
- getlist(key)[source]¶
Return the list of items for a given key.
If that key is not in the
MultiDict
, the return value will be an empty list.
- setlist(key, new_list)[source]¶
Remove the old values for a key and add new ones.
Notes
The list you pass the values in will be shallow-copied before it is inserted in the dictionary.
- setdefault(key, default=None)[source]¶
If key is in the dictionary, returns its value.
If not, set it to default and return default.
- setlistdefault(key, default_list=None)[source]¶
Like
setdefault()
but sets multiple values.The list returned is not a copy, but the list that is actually used internally. This means that you can put new values into the
dict
by appending items to the list.
- lists()[source]¶
Return an iterator of
(key, values)
pairs, wherevalues
is thelist
of all values associated with the key.
- listvalues()[source]¶
Return an iterator of all values associated with a key. Zipping
keys()
and this is the same as callinglists()
.- Return type
Iterator[list[_VT]]
- to_dict(flat: Literal[True] = True) dict[_KT, _VT] [source]¶
- to_dict(flat: Literal[False]) dict[_KT, list[_VT]]
Return the contents as regular
dict
.If
flat
isTrue
the returneddict
will only have the first item present, ifflat
isFalse
all values will be returned as lists.
- update(mapping)[source]¶
update()
extends rather than replaces existing key lists.If the value
list
for a key inother_dict
is empty, no new values will be added to thedict
and the key will not be created.
- pop(key: _KT) _VT [source]¶
- pop(key: _KT, default: _VT | _T = no value) _VT | _T
Pop the first item for a
list
on thedict
.Afterwards the
key
is removed from thedict
, so additional values are discarded.- Parameters
key – The key to pop.
default – If provided the value to return if the key was not in the dictionary.
- class pcapkit.corekit.multidict.OrderedMultiDict(mapping=None)[source]¶
Bases:
MultiDict
[_KT
,_VT
]Works like a regular
MultiDict
but preserves the order of the fields.- Parameters
mapping (Optional[dict[_KT, _VT] | Iterable[tuple[_KT, _VT]]]) – The initial value for the
MultiDict
. Either a regulardict
, an iterable of(key, value)
tuples, orNone
.
To convert the ordered multi dict into a
list
you can us theitems()
method and pass itmulti=True
.In general an
OrderedMultiDict
is an order of magnitude slower than aMultiDict
.Notes
Due to a limitation in Python you cannot convert an ordered multi dict into a regular
dict
by usingdict(multidict)
. Instead you have to use theto_dict()
method, otherwise the internal bucket objects are exposed.
Protocol Chain¶
pcapkit.corekit.protochain
contains special protocol
collection class ProtoChain
.
- class pcapkit.corekit.protochain.ProtoChain(proto, alias=None, *, basis=None)[source]¶
Bases:
Sequence
Protocols chain.
- Parameters
proto (Protocol | Type[Protocol]) – New protocol class on the top stack.
alias (Optional[str]) – New protocol alias on the top stack.
basis (Optional[ProtoChain]) – Original protocol chain as base stacks.
- classmethod from_list(data)[source]¶
Create a protocol chain from a list.
- __init__(proto, alias=None, *, basis=None)[source]¶
Initialisation.
- Parameters
proto – New protocol class on the top stack.
alias – New protocol alias on the top stack.
basis – Original protocol chain as base stacks.
Version Info¶
pcapkit.corekit.version
contains tuple
like class VersionInfo
,
which is originally designed alike sys.version_info
.
Compatibility Tools¶
pcapkit.toolkit
provides several utility functions for
compatibility of multiple engine support.
PyPCAPKit
Tools¶
pcapkit.toolkit.default
contains all you need for
pcapkit
handy usage. All functions returns with a
flag to indicate if usable for its caller.
- pcapkit.toolkit.default.ipv4_reassembly(frame)[source]¶
Make data for IPv4 reassembly.
- Parameters
frame (Frame) – PCAP frame.
- Returns
Data for IPv4 reassembly.
If the
frame
can be used for IPv4 reassembly. A frame can be reassembled if it contains IPv4 layer (pcapkit.protocols.internet.ipv4.IPv4
) and the DF (IPv4.flags.df
) flag isFalse
.If the
frame
can be reassembled, then thedict
mapping of data for IPv4 reassembly (c.f. ipv4.packet) will be returned; otherwise, returnsNone
.
- Return type
IP_Packet[IPv4Address] | None
See also
pcapkit.foundation.reassembly.ipv4.IPv4Reassembly
- pcapkit.toolkit.default.ipv6_reassembly(frame)[source]¶
Make data for IPv6 reassembly.
- Parameters
frame (Frame) – PCAP frame.
- Returns
A tuple of data for IPv6 reassembly.
If the
frame
can be used for IPv6 reassembly. A frame can be reassembled if it contains IPv6 layer (pcapkit.protocols.internet.ipv6.IPv6
) and IPv6 Fragment header (RFC 2460#section-4.5,pcapkit.protocols.internet.ipv6_frag.IPv6_Frag
).If the
frame
can be reassembled, then thedict
mapping of data for IPv6 reassembly (ipv6.packet) will be returned; otherwise, returnsNone
.
- Return type
See also
pcapkit.foundation.reassembly.ipv6.IPv6Reassembly
- pcapkit.toolkit.default.tcp_reassembly(frame)[source]¶
Make data for TCP reassembly.
- Parameters
frame (Frame) – PCAP frame.
- Returns
A tuple of data for TCP reassembly.
If the
frame
can be used for TCP reassembly. A frame can be reassembled if it contains TCP layer (pcapkit.protocols.transport.tcp.TCP
).If the
frame
can be reassembled, then thedict
mapping of data for TCP reassembly (tcp.packet) will be returned; otherwise, returnsNone
.
- Return type
See also
pcapkit.foundation.reassembly.tcp.TCPReassembly
- pcapkit.toolkit.default.tcp_traceflow(frame, *, data_link)[source]¶
Trace packet flow for TCP.
- Parameters
- Returns
Data for TCP reassembly.
If the
packet
can be used for TCP flow tracing. A frame can be reassembled if it contains TCP layer (pcapkit.protocols.transport.tcp.TCP
).If the
frame
can be reassembled, then thedict
mapping of data for TCP flow tracing (trace.packet) will be returned; otherwise, returnsNone
.
- Return type
TF_Packet | None
DPKT
Tools¶
pcapkit.toolkit.dpkt
contains all you need for
pcapkit
handy usage with DPKT engine. All reforming
functions returns with a flag to indicate if usable for
its caller.
- pcapkit.toolkit.dpkt.ipv4_reassembly(packet, *, count=-1)[source]¶
Make data for IPv4 reassembly.
- Parameters
- Return type
IP_Packet[IPv4Address] | None
- Returns
Data for IPv4 reassembly.
If the
packet
can be used for IPv4 reassembly. A packet can be reassembled if it contains IPv4 layer (dpkt.ip.IP
) and the DF (dpkt.ip.IP.df
) flag isFalse
.If the
packet
can be reassembled, then thedict
mapping of data for IPv4 reassembly (ipv4.packet) will be returned; otherwise, returnsNone
.
See also
pcapkit.foundation.reassembly.ipv4.IPv4Reassembly
- pcapkit.toolkit.dpkt.ipv6_reassembly(packet, *, count=-1)[source]¶
Make data for IPv6 reassembly.
- Parameters
- Return type
IP_Packet[IPv6Address] | None
- Returns
Data for IPv6 reassembly.
If the
packet
can be used for IPv6 reassembly. A packet can be reassembled if it contains IPv6 layer (dpkt.ip6.IP6
) and IPv6 Fragment header (RFC 2460#section-4.5,dpkt.ip6.IP6FragmentHeader
).If the
packet
can be reassembled, then thedict
mapping of data for IPv6 reassembly (ipv6.packet) will be returned; otherwise, returnsNone
.
See also
pcapkit.foundation.reassembly.ipv6.IPv6Reassembly
- pcapkit.toolkit.dpkt.tcp_reassembly(packet, *, count=-1)[source]¶
Make data for TCP reassembly.
- Parameters
- Return type
TCP_Packet | None
- Returns
Data for TCP reassembly.
If the
packet
can be used for TCP reassembly. A packet can be reassembled if it contains TCP layer (dpkt.tcp.TCP
).If the
packet
can be reassembled, then thedict
mapping of data for TCP reassembly (tcp.packet) will be returned; otherwise, returnsNone
.
See also
pcapkit.foundation.reassembly.tcp.TCPReassembly
- pcapkit.toolkit.dpkt.tcp_traceflow(packet, timestamp, *, data_link, count=-1)[source]¶
Trace packet flow for TCP.
- Parameters
- Return type
TF_Packet | None
- Returns
Data for TCP reassembly.
If the
packet
can be used for TCP flow tracing. A packet can be reassembled if it contains TCP layer (dpkt.tcp.TCP
).If the
packet
can be reassembled, then thedict
mapping of data for TCP flow tracing (trace.packet) will be returned; otherwise, returnsNone
.
- pcapkit.toolkit.dpkt.ipv6_hdr_len(ipv6)[source]¶
Calculate length of headers before IPv6 Fragment header.
- Parameters
ipv6 (IP6) – DPKT IPv6 packet.
- Return type
- Returns
Length of headers before IPv6 Fragment header
dpkt.ip6.IP6FragmentHeader
(RFC 2460#section-4.5).
As specified in RFC 2460#section-4.1, such headers (before the IPv6 Fragment Header) includes Hop-by-Hop Options header
dpkt.ip6.IP6HopOptsHeader
(RFC 2460#section-4.3), Destination Options headerdpkt.ip6.IP6DstOptHeader
(RFC 2460#section-4.6) and Routing headerdpkt.ip6.IP6RoutingHeader
(RFC 2460#section-4.4).
PyShark
Tools¶
pcapkit.toolkit.pyshark
contains all you need for
pcapkit
handy usage with PyShark engine. All
reforming functions returns with a flag to indicate if
usable for its caller.
- pcapkit.toolkit.pyshark.tcp_traceflow(packet)[source]¶
Trace packet flow for TCP.
- Parameters
packet (Packet) – Scapy packet.
- Returns
A tuple of data for TCP reassembly.
If the
packet
can be used for TCP flow tracing. A packet can be reassembled if it contains TCP layer.If the
packet
can be reassembled, then thedict
mapping of data for TCP flow tracing (trace.packet) will be returned; otherwise, returnsNone
.
- Return type
See also
Scapy
Tools¶
pcapkit.toolkit.scapy
contains all you need for
pcapkit
handy usage with Scapy engine. All reforming
functions returns with a flag to indicate if usable for
its caller.
Warning
This module requires installed Scapy engine.
- pcapkit.toolkit.scapy.ipv4_reassembly(packet, *, count=-1)[source]¶
Make data for IPv4 reassembly.
- Parameters
- Return type
IP_Packet[IPv4Address] | None
- Returns
Data for IPv4 reassembly.
If the
packet
can be used for IPv4 reassembly. A packet can be reassembled if it contains IPv4 layer (scapy.layers.inet.IP
) and the DF (scapy.layers.inet.IP.flags.DF
) flag isFalse
.If the
packet
can be reassembled, then thedict
mapping of data for IPv4 reassembly (ipv4.packet) will be returned; otherwise, returnsNone
.
See also
pcapkit.foundation.reassembly.ipv4.IPv4Reassembly
- pcapkit.toolkit.scapy.ipv6_reassembly(packet, *, count=-1)[source]¶
Make data for IPv6 reassembly.
- Parameters
- Return type
IP_Packet[IPv6Address] | None
- Returns
Data for IPv6 reassembly.
If the
packet
can be used for IPv6 reassembly. A packet can be reassembled if it contains IPv6 layer (scapy.layers.inet6.IPv6
) and IPv6 Fragment header (RFC 2460#section-4.5,scapy.layers.inet6.IPv6ExtHdrFragment
).If the
packet
can be reassembled, then thedict
mapping of data for IPv6 reassembly (ipv6.packet) will be returned; otherwise, returnsNone
.
- Raises
ModuleNotFound – If Scapy is not installed.
See also
pcapkit.foundation.reassembly.ipv6.IPv6Reassembly
- pcapkit.toolkit.scapy.tcp_reassembly(packet, *, count=-1)[source]¶
Store data for TCP reassembly.
- Parameters
- Return type
TCP_Packet | None
- Returns
Data for TCP reassembly.
If the
packet
can be used for TCP reassembly. A packet can be reassembled if it contains TCP layer (scapy.layers.inet.TCP
).If the
packet
can be reassembled, then thedict
mapping of data for TCP reassembly (tcp.packet) will be returned; otherwise, returnsNone
.
See also
pcapkit.foundation.reassembly.tcp.TCPReassembly
- pcapkit.toolkit.scapy.tcp_traceflow(packet, *, count=-1)[source]¶
Trace packet flow for TCP.
- Parameters
- Return type
TF_Packet | None
- Returns
Data for TCP reassembly.
If the
packet
can be used for TCP flow tracing. A packet can be reassembled if it contains TCP layer (scapy.layers.inet.TCP
).If the
packet
can be reassembled, then thedict
mapping of data for TCP flow tracing (trace.packet) will be returned; otherwise, returnsNone
.
- pcapkit.toolkit.scapy.packet2chain(packet)[source]¶
Fetch Scapy packet protocol chain.
- Parameters
packet (Packet) – Scapy packet.
- Return type
- Returns
Colon (
:
) seperated list of protocol chain.- Raises
ModuleNotFound – If Scapy is not installed.
Dump Utilities¶
pcapkit.dumpkit
is the collection of dumpers for
pcapkit
implementation, which is alike those described
in dictdumper
.
Null Dumper¶
pcapkit.dumpkit.null
is the dumper for pcapkit
implementation,
specifically for NotImplemented format, which is alike those described in
dictdumper
.
Note
This dumper is used when the given format is not supported, as a fallback. It shall not produce any output.
PCAP Dumper¶
pcapkit.dumpkit.pcap
is the dumper for pcapkit
implementation,
specifically for PCAP format, which is alike those described in
dictdumper
.
- class pcapkit.dumpkit.pcap.PCAPIO(fname, *, protocol, byteorder='little', nanosecond=False, **kwargs)[source]¶
Bases:
Dumper
PCAP file dumper.
- Parameters
fname – output file name
protocol – data link type
byteorder – header byte order
nanosecond – nanosecond-resolution file flag
**kwargs – arbitrary keyword arguments
Utility Functions & Classes¶
pcapkit.utilities
contains several useful functions
and classes which are fundations of pcapkit
, including
decorater function seekset()
and beholder()
, and
several user-refined exceptions and warnings.
Logging System¶
pcapkit.utilities.logging
contains naïve integration
of the Python logging system, i.e. a logging.Logger
instance as logger
.
- pcapkit.utilities.logging.DEVMODE¶
Development mode flag.
Note
This variable can be configured through the environment variable
PCAPKIT_DEVMODE
.
Decorator Functions¶
pcapkit.utilities.decorators
contains several useful
decorators, including seekset()
and beholder()
.
- @pcapkit.utilities.decorators.seekset(func)[source]¶
Read file from start then set back to original.
Important
This decorator function is designed for decorating class methods.
The decorator will keep the current offset of
self._file
, then call the decorated function. Afterwards, it will rewind the offset ofself._file
to the original and returns the return value from the decorated function.Note
The decorated function should have following signature:
func(self, *args, **kw)
- @pcapkit.utilities.decorators.beholder(func)[source]¶
Behold extraction procedure.
Important
This decorator function is designed for decorating class methods.
This decorate first keep the current offset of
self._file
, then try to call the decorated function. Should any exception raised, it will re-parse theself._file
asRaw
protocol.Note
The decorated function should have following signature:
func(self, proto, length, *args, **kwargs)
Important
pcapkit.utilities.decorators.seekset()
and
pcapkit.utilities.decorators.beholder()
are designed
for decorating class methods.
User Defined Exceptions¶
pcapkit.exceptions
refined built-in exceptions.
Make it possible to show only user error stack infomation *,
when exception raised on user’s operation.
- exception pcapkit.utilities.exceptions.BaseError(*args, quiet=False, **kwargs)[source]¶
Bases:
Exception
Base error class of all kinds.
Important
Turn off system-default traceback function by set
sys.tracebacklimit
to0
.But bugs appear in Python 3.6, so we have to set
sys.tracebacklimit
toNone
.Note
This note is deprecated since Python fixed the problem above.
In Python 2.7,
trace.print_stack(limit)()
dose not support negative limit.
- exception pcapkit.utilities.exceptions.DigitError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be (a) number(s).
- exception pcapkit.utilities.exceptions.IntError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be integral.
- exception pcapkit.utilities.exceptions.RealError(*args, quiet=False, **kwargs)[source]¶
-
The function is not defined for real number.
- exception pcapkit.utilities.exceptions.ComplexError(*args, quiet=False, **kwargs)[source]¶
-
The function is not defined for complex instance.
- exception pcapkit.utilities.exceptions.BoolError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be
bool
type.
- exception pcapkit.utilities.exceptions.BytesError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be
bytes
type.
- exception pcapkit.utilities.exceptions.StringError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be
str
type.
- exception pcapkit.utilities.exceptions.BytearrayError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be
bytearray
type.
- exception pcapkit.utilities.exceptions.DictError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be
dict
type.
- exception pcapkit.utilities.exceptions.ListError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be
list
type.
- exception pcapkit.utilities.exceptions.TupleError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be
tuple
type.
- exception pcapkit.utilities.exceptions.IterableError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be iterable.
- exception pcapkit.utilities.exceptions.IOObjError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be file-like object.
- exception pcapkit.utilities.exceptions.ProtocolUnbound(*args, quiet=False, **kwargs)[source]¶
-
Protocol slice unbound.
- exception pcapkit.utilities.exceptions.CallableError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be callable.
- exception pcapkit.utilities.exceptions.InfoError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be
Info
instance.
- exception pcapkit.utilities.exceptions.IPError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be IP address.
- exception pcapkit.utilities.exceptions.EnumError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be enumeration protocol type.
- exception pcapkit.utilities.exceptions.ComparisonError(*args, quiet=False, **kwargs)[source]¶
-
Rich comparison not supported between instances.
- exception pcapkit.utilities.exceptions.RegistryError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be registry type.
- exception pcapkit.utilities.exceptions.FormatError(*args, quiet=False, **kwargs)[source]¶
Bases:
BaseError
,AttributeError
Unknown format(s).
- exception pcapkit.utilities.exceptions.UnsupportedCall(*args, quiet=False, **kwargs)[source]¶
Bases:
BaseError
,AttributeError
Unsupported function or property call.
- exception pcapkit.utilities.exceptions.FileError(*args, quiet=False, **kwargs)[source]¶
-
[Errno 5] Wrong file format.
- exception pcapkit.utilities.exceptions.FileExists(*args, quiet=False, **kwargs)[source]¶
Bases:
BaseError
,FileExistsError
[Errno 17] File already exists.
- exception pcapkit.utilities.exceptions.FileNotFound(*args, quiet=False, **kwargs)[source]¶
Bases:
BaseError
,FileNotFoundError
[Errno 2] File not found.
- exception pcapkit.utilities.exceptions.ProtocolNotFound(*args, quiet=False, **kwargs)[source]¶
Bases:
BaseError
,IndexError
Protocol not found in ProtoChain.
- exception pcapkit.utilities.exceptions.VersionError(*args, quiet=False, **kwargs)[source]¶
Bases:
BaseError
,ValueError
Unknown IP version.
- exception pcapkit.utilities.exceptions.IndexNotFound(*args, quiet=False, **kwargs)[source]¶
Bases:
BaseError
,ValueError
Protocol not in ProtoChain.
- exception pcapkit.utilities.exceptions.ProtocolError(*args, quiet=False, **kwargs)[source]¶
Bases:
BaseError
,ValueError
Invalid protocol format.
- exception pcapkit.utilities.exceptions.EndianError(*args, quiet=False, **kwargs)[source]¶
Bases:
BaseError
,ValueError
Invalid endian (byte order).
- exception pcapkit.utilities.exceptions.KeyExists(*args, quiet=False, **kwargs)[source]¶
Bases:
BaseError
,ValueError
Key already exists.
- exception pcapkit.utilities.exceptions.ProtocolNotImplemented(*args, quiet=False, **kwargs)[source]¶
Bases:
BaseError
,NotImplementedError
Protocol not implemented.
- exception pcapkit.utilities.exceptions.VendorNotImplemented(*args, quiet=False, **kwargs)[source]¶
Bases:
BaseError
,NotImplementedError
Vendor not implemented.
- exception pcapkit.utilities.exceptions.StructError(*args, eof=False, **kwargs)[source]¶
-
Unpack failed.
- exception pcapkit.utilities.exceptions.MissingKeyError(*args, quiet=False, **kwargs)[source]¶
-
Key not found.
- exception pcapkit.utilities.exceptions.FragmentError(*args, quiet=False, **kwargs)[source]¶
-
Invalid fragment dict.
- exception pcapkit.utilities.exceptions.PacketError(*args, quiet=False, **kwargs)[source]¶
-
Invalid packet dict.
- exception pcapkit.utilities.exceptions.ModuleNotFound(*args, quiet=False, **kwargs)[source]¶
Bases:
BaseError
,ModuleNotFoundError
Module not found.
- pcapkit.utilities.exceptions.stacklevel()[source]¶
Fetch current stack level.
The function will walk through the straceback stack (
traceback.extract_stack()
), and fetch the stack level where the path contains/pcapkit/
. So that it won’t display any disturbing internal traceback information when raising errors.- Return type
- Returns
Stack level until internal stacks, i.e. contains
/pcapkit/
.
User Defined Warnings¶
pcapkit.warnings
refined built-in warnings.
- pcapkit.utilities.warnings.warn(message, category, stacklevel=None)[source]¶
Wrapper function of
warnings.warn()
.
- exception pcapkit.utilities.warnings.BaseWarning(*args, **kwargs)[source]¶
Bases:
UserWarning
Base warning class of all kinds.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
None
- exception pcapkit.utilities.warnings.FormatWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,ImportWarning
Warning on unknown format(s).
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
None
- exception pcapkit.utilities.warnings.EngineWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,ImportWarning
Unsupported extraction engine.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
None
- exception pcapkit.utilities.warnings.InvalidVendorWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,ImportWarning
Vendor CLI invalid updater.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
None
- exception pcapkit.utilities.warnings.FileWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,RuntimeWarning
Warning on file(s).
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
None
- exception pcapkit.utilities.warnings.LayerWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,RuntimeWarning
Unrecognised layer.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
None
- exception pcapkit.utilities.warnings.ProtocolWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,RuntimeWarning
Unrecognised protocol.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
None
- exception pcapkit.utilities.warnings.AttributeWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,RuntimeWarning
Unsupported attribute.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
None
- exception pcapkit.utilities.warnings.DevModeWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,RuntimeWarning
Run in development mode.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
None
- exception pcapkit.utilities.warnings.VendorRequestWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,RuntimeWarning
Vendor request connection failed.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
None
- exception pcapkit.utilities.warnings.VendorRuntimeWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,RuntimeWarning
Vendor failed during runtime.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
None
- exception pcapkit.utilities.warnings.DPKTWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,ResourceWarning
Warnings on DPKT usage.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
None
- exception pcapkit.utilities.warnings.ScapyWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,ResourceWarning
Warnings on Scapy usage.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
None
- exception pcapkit.utilities.warnings.PySharkWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,ResourceWarning
Warnings on PyShark usage.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
None
- exception pcapkit.utilities.warnings.EmojiWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,ResourceWarning
Warnings on Emoji usage.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
None
- exception pcapkit.utilities.warnings.VendorWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,ResourceWarning
Warnings on vendor usage.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
None
Version Compatibility¶
pcapkit
further provides a compatibility layer for the
following objects and functions:
Python 3.6+ |
|
Python 3.6+ |
|
Python 3.5+ |
|
Python 3.8+ |
Constant Enumerations¶
This module contains all constant enumerations of pcapkit
, which are
automatically generated from the pcapkit.vendor
module.
Protocol Numbers¶
Protocol Type Registry Constant Enumerations¶
This module contains all constant enumerations of protocol type registry implementations. Available enumerations include:
Link-Layer Header Type Values * |
|
Ethertype IEEE 802 Numbers † |
|
Transport Layer Protocol Numbers ‡ |
Link-Layer Header Type Values¶
This module contains the constant enumeration for Link-Layer Header Type Values,
which is automatically generated from pcapkit.vendor.reg.linktype.LinkType
.
- class pcapkit.const.reg.linktype.LinkType(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[LinkType] Link-Layer Header Type Values
- NULL = 0¶
[
DLT_NULL
] BSD loopback encapsulation; the link layer header is a 4-byte field, in host byte order, containing a value of 2 for IPv4 packets, a value of either 24, 28, or 30 for IPv6 packets, a value of 7 for OSI packets, or a value of 23 for IPX packets. All of the IPv6 values correspond to IPv6 packets; code reading files should check for all of them. Note that ``host byte order’’ is the byte order of the machine on that the packets are captured; if a live capture is being done, ``host byte order’’ is the byte order of the machine capturing the packets, but if a ``savefile’’ is being read, the byte order is not necessarily that of the machine reading the capture file.
- ETHERNET = 1¶
[
DLT_EN10MB
] IEEE 802.3 Ethernet (10Mb, 100Mb, 1000Mb, and up); the 10MB in the DLT_ name is historical.
- AX25 = 3¶
[
DLT_AX25
] AX.25 packet, with nothing preceding it.
- IEEE802_5 = 6¶
[
DLT_IEEE802
] IEEE 802.5 Token Ring; the IEEE802, without _5, in the DLT_ name is historical.
- ARCNET_BSD = 7¶
[
DLT_ARCNET
] ARCNET Data Packets, as described by the ARCNET Trade Association standard ATA 878.1-1999, but without the Starting Delimiter, Information Length, or Frame Check Sequence fields, and with only the first ISU of the Destination Identifier. For most packet types, ARCNET Trade Association draft standard ATA 878.2 is also used. See also RFC 1051 and RFC 1201; for RFC 1051 frames, ATA 878.2 is not used.
- SLIP = 8¶
[
DLT_SLIP
] SLIP, encapsulated with a LINKTYPE_SLIP header.
- PPP = 9¶
[
DLT_PPP
] PPP, as per RFC 1661 and RFC 1662; if the first 2 bytes are 0xff and 0x03, it’s PPP in HDLC-like framing, with the PPP header following those two bytes, otherwise it’s PPP without framing, and the packet begins with the PPP header. The data in the frame is not octet-stuffed or bit- stuffed.
- FDDI = 10¶
[
DLT_FDDI
] FDDI, as specified by ANSI INCITS 239-1994.
- PPP_HDLC = 50¶
[
DLT_PPP_SERIAL
] PPP in HDLC-like framing, as per RFC 1662, or Cisco PPP with HDLC framing, as per section 4.3.1 of RFC 1547; the first byte will be 0xFF for PPP in HDLC-like framing, and will be 0x0F or 0x8F for Cisco PPP with HDLC framing. The data in the frame is not octet-stuffed or bit- stuffed.
- PPP_ETHER = 51¶
[
DLT_PPP_ETHER
] PPPoE; the packet begins with a PPPoE header, as per RFC 2516.
- ATM_RFC1483 = 100¶
[
DLT_ATM_RFC1483
] RFC 1483 LLC/SNAP-encapsulated ATM; the packet begins with an ISO 8802-2 (formerly known as IEEE 802.2) LLC header.
- RAW = 101¶
[
DLT_RAW
] Raw IP; the packet begins with an IPv4 or IPv6 header, with the version field of the header indicating whether it’s an IPv4 or IPv6 header.
- C_HDLC = 104¶
[
DLT_C_HDLC
] Cisco PPP with HDLC framing, as per section 4.3.1 of RFC 1547.
- IEEE802_11 = 105¶
[
DLT_IEEE802_11
] IEEE 802.11 wireless LAN.
- FRELAY = 107¶
[
DLT_FRELAY
] Frame Relay LAPF frames, beginning with a ITU-T Recommendation Q.922 LAPF header starting with the address field, and without an FCS at the end of the frame.
- LOOP = 108¶
[
DLT_LOOP
] OpenBSD loopback encapsulation; the link-layer header is a 4-byte field, in network byte order, containing a value of 2 for IPv4 packets, a value of either 24, 28, or 30 for IPv6 packets, a value of 7 for OSI packets, or a value of 23 for IPX packets. All of the IPv6 values correspond to IPv6 packets; code reading files should check for all of them.
- LINUX_SLL = 113¶
[
DLT_LINUX_SLL
] Linux “cooked” capture encapsulation.
- LTALK = 114¶
[
DLT_LTALK
] Apple LocalTalk; the packet begins with an AppleTalk LocalTalk Link Access Protocol header, as described in chapter 1 of Inside AppleTalk, Second Edition.
- PFLOG = 117¶
[
DLT_PFLOG
] OpenBSD pflog; the link-layer header contains a struct pfloghdr structure, as defined by the host on that the file was saved. (This differs from operating system to operating system and release to release; there is nothing in the file to indicate what the layout of that structure is.)
- IEEE802_11_PRISM = 119¶
[
DLT_PRISM_HEADER
] Prism monitor mode information followed by an 802.11 header.
- IP_OVER_FC = 122¶
[
DLT_IP_OVER_FC
] RFC 2625 IP-over-Fibre Channel, with the link-layer header being the Network_Header as described in that RFC.
- SUNATM = 123¶
[
DLT_SUNATM
] ATM traffic, encapsulated as per the scheme used by SunATM devices.
- IEEE802_11_RADIOTAP = 127¶
[
DLT_IEEE802_11_RADIO
] Radiotap link-layer information followed by an 802.11 header.
- ARCNET_LINUX = 129¶
[
DLT_ARCNET_LINUX
] ARCNET Data Packets, as described by the ARCNET Trade Association standard ATA 878.1-1999, but without the Starting Delimiter, Information Length, or Frame Check Sequence fields, with only the first ISU of the Destination Identifier, and with an extra two-ISU offset field following the Destination Identifier. For most packet types, ARCNET Trade Association draft standard ATA 878.2 is also used; however, no exception frames are supplied, and reassembled frames, rather than fragments, are supplied. See also RFC 1051 and RFC 1201; for RFC 1051 frames, ATA 878.2 is not used.
- APPLE_IP_OVER_IEEE1394 = 138¶
[
DLT_APPLE_IP_OVER_IEEE1394
] Apple IP-over-IEEE 1394 cooked header.
- MTP2_WITH_PHDR = 139¶
[
DLT_MTP2_WITH_PHDR
] Signaling System 7 Message Transfer Part Level 2, as specified by ITU-T Recommendation Q.703, preceded by a pseudo-header.
- MTP2 = 140¶
[
DLT_MTP2
] Signaling System 7 Message Transfer Part Level 2, as specified by ITU-T Recommendation Q.703.
- MTP3 = 141¶
[
DLT_MTP3
] Signaling System 7 Message Transfer Part Level 3, as specified by ITU-T Recommendation Q.704, with no MTP2 header preceding the MTP3 packet.
- SCCP = 142¶
[
DLT_SCCP
] Signaling System 7 Signalling Connection Control Part, as specified by ITU-T Recommendation Q.711, ITU-T Recommendation Q.712, ITU-T Recommendation Q.713, and ITU-T Recommendation Q.714, with no MTP3 or MTP2 headers preceding the SCCP packet.
- DOCSIS = 143¶
[
DLT_DOCSIS
] DOCSIS MAC frames, as described by the DOCSIS 3.1 MAC and Upper Layer Protocols Interface Specification or earlier specifications for MAC frames.
- LINUX_IRDA = 144¶
[
DLT_LINUX_IRDA
] Linux-IrDA packets, with a LINKTYPE_LINUX_IRDA header, with the payload for IrDA frames beginning with by the IrLAP header as defined by IrDA Data Specifications, including the IrDA Link Access Protocol specification.
- USER0 = 147¶
[
DLT_USER0
] Reserved for private use; see above.
- USER1 = 148¶
[
DLT_USER1
] Reserved for private use; see above.
- USER2 = 149¶
[
DLT_USER2
] Reserved for private use; see above.
- USER3 = 150¶
[
DLT_USER3
] Reserved for private use; see above.
- USER4 = 151¶
[
DLT_USER4
] Reserved for private use; see above.
- USER5 = 152¶
[
DLT_USER5
] Reserved for private use; see above.
- USER6 = 153¶
[
DLT_USER6
] Reserved for private use; see above.
- USER7 = 154¶
[
DLT_USER7
] Reserved for private use; see above.
- USER8 = 155¶
[
DLT_USER8
] Reserved for private use; see above.
- USER9 = 156¶
[
DLT_USER9
] Reserved for private use; see above.
- USER10 = 157¶
[
DLT_USER10
] Reserved for private use; see above.
- USER11 = 158¶
[
DLT_USER11
] Reserved for private use; see above.
- USER12 = 159¶
[
DLT_USER12
] Reserved for private use; see above.
- USER13 = 160¶
[
DLT_USER13
] Reserved for private use; see above.
- USER14 = 161¶
[
DLT_USER14
] Reserved for private use; see above.
- USER15 = 162¶
[
DLT_USER15
] Reserved for private use; see above.
- IEEE802_11_AVS = 163¶
[
DLT_IEEE802_11_RADIO_AVS
] AVS monitor mode information followed by an 802.11 header.
- BACNET_MS_TP = 165¶
[
DLT_BACNET_MS_TP
] BACnet MS/TP frames, as specified by section 9.3 MS/TP Frame Format of ANSI/ASHRAE Standard 135, BACnet® - A Data Communication Protocol for Building Automation and Control Networks, including the preamble and, if present, the Data CRC.
- PPP_PPPD = 166¶
[
DLT_PPP_PPPD
] PPP in HDLC-like encapsulation, like LINKTYPE_PPP_HDLC, but with the 0xff address byte replaced by a direction indication—0x00 for incoming and 0x01 for outgoing.
- GPRS_LLC = 169¶
[
DLT_GPRS_LLC
] General Packet Radio Service Logical Link Control, as defined by 3GPP TS 04.64.
- GPF_T = 170¶
[
DLT_GPF_T
] Transparent-mapped generic framing procedure, as specified by ITU-T Recommendation G.7041/Y.1303.
- GPF_F = 171¶
[
DLT_GPF_F
] Frame-mapped generic framing procedure, as specified by ITU-T Recommendation G.7041/Y.1303.
- LINUX_LAPD = 177¶
[
DLT_LINUX_LAPD
] Link Access Procedures on the D Channel (LAPD) frames, as specified by ITU-T Recommendation Q.920 and ITU-T Recommendation Q.921, captured via vISDN, with a LINKTYPE_LINUX_LAPD header, followed by the Q.921 frame, starting with the address field.
- MFR = 182¶
[
DLT_MFR
] FRF.16.1 Multi-Link Frame Relay frames, beginning with an FRF.12 Interface fragmentation format fragmentation header.
- BLUETOOTH_HCI_H4 = 187¶
[
DLT_BLUETOOTH_HCI_H4
] Bluetooth HCI UART transport layer; the frame contains an HCI packet indicator byte, as specified by the UART Transport Layer portion of the most recent Bluetooth Core specification, followed by an HCI packet of the specified packet type, as specified by the Host Controller Interface Functional Specification portion of the most recent Bluetooth Core Specification.
- USB_LINUX = 189¶
[
DLT_USB_LINUX
] USB packets, beginning with a Linux USB header, as specified by the struct usbmon_packet in the Documentation/usb/usbmon.txt file in the Linux source tree. Only the first 48 bytes of that header are present. All fields in the header are in host byte order. When performing a live capture, the host byte order is the byte order of the machine on that the packets are captured. When reading a pcap file, the byte order is the byte order for the file, as specified by the file’s magic number; when reading a pcapng file, the byte order is the byte order for the section of the pcapng file, as specified by the Section Header Block.
- PPI = 192¶
[
DLT_PPI
] Per-Packet Information information, as specified by the Per- Packet Information Header Specification, followed by a packet with the LINKTYPE_ value specified by the pph_dlt field of that header.
- IEEE802_15_4_WITHFCS = 195¶
[
DLT_IEEE802_15_4_WITHFCS
] IEEE 802.15.4 Low-Rate Wireless Networks, with each packet having the FCS at the end of the frame.
- SITA = 196¶
[
DLT_SITA
] Various link-layer types, with a pseudo-header, for SITA.
- ERF = 197¶
[
DLT_ERF
] Various link-layer types, with a pseudo-header, for Endace DAG cards; encapsulates Endace ERF records.
- BLUETOOTH_HCI_H4_WITH_PHDR = 201¶
[
DLT_BLUETOOTH_HCI_H4_WITH_PHDR
] Bluetooth HCI UART transport layer; the frame contains a 4-byte direction field, in network byte order (big-endian), the low-order bit of which is set if the frame was sent from the host to the controller and clear if the frame was received by the host from the controller, followed by an HCI packet indicator byte, as specified by the UART Transport Layer portion of the most recent Bluetooth Core specification, followed by an HCI packet of the specified packet type, as specified by the Host Controller Interface Functional Specification portion of the most recent Bluetooth Core Specification.
- AX25_KISS = 202¶
[
DLT_AX25_KISS
] AX.25 packet, with a 1-byte KISS header containing a type indicator.
- LAPD = 203¶
[
DLT_LAPD
] Link Access Procedures on the D Channel (LAPD) frames, as specified by ITU-T Recommendation Q.920 and ITU-T Recommendation Q.921, starting with the address field, with no pseudo-header.
- PPP_WITH_DIR = 204¶
[
DLT_PPP_WITH_DIR
] PPP, as per RFC 1661 and RFC 1662, preceded with a one-byte pseudo-header with a zero value meaning “received by this host” and a non-zero value meaning “sent by this host”; if the first 2 bytes are 0xff and 0x03, it’s PPP in HDLC-like framing, with the PPP header following those two bytes, otherwise it’s PPP without framing, and the packet begins with the PPP header. The data in the frame is not octet-stuffed or bit-stuffed.
- C_HDLC_WITH_DIR = 205¶
[
DLT_C_HDLC_WITH_DIR
] Cisco PPP with HDLC framing, as per section 4.3.1 of RFC 1547, preceded with a one-byte pseudo-header with a zero value meaning “received by this host” and a non-zero value meaning “sent by this host”.
- FRELAY_WITH_DIR = 206¶
[
DLT_FRELAY_WITH_DIR
] Frame Relay LAPF frames, beginning with a one-byte pseudo-header with a zero value meaning “received by this host” (DCE->DTE) and a non-zero value meaning “sent by this host” (DTE->DCE), followed by an ITU-T Recommendation Q.922 LAPF header starting with the address field, and without an FCS at the end of the frame.
- LAPB_WITH_DIR = 207¶
[
DLT_LAPB_WITH_DIR
] Link Access Procedure, Balanced (LAPB), as specified by ITU-T Recommendation X.25, preceded with a one-byte pseudo-header with a zero value meaning “received by this host” (DCE->DTE) and a non-zero value meaning “sent by this host” (DTE->DCE).
- IPMB_LINUX = 209¶
[
DLT_IPMB_LINUX
] IPMB over an I2C circuit, with a Linux-specific pseudo- header.
- FLEXRAY = 210¶
[
DLT_FLEXRAY
] FlexRay automotive bus frames or symbols, preceded by a pseudo-header.
- LIN = 212¶
[
DLT_LIN
] Local Interconnect Network (LIN) automotive bus, preceded by a pseudo-header.
- IEEE802_15_4_NONASK_PHY = 215¶
[
DLT_IEEE802_15_4_NONASK_PHY
] IEEE 802.15.4 Low-Rate Wireless Networks, with each packet having the FCS at the end of the frame, and with the PHY- level data for the O-QPSK, BPSK, GFSK, MSK, and RCC DSS BPSK PHYs (4 octets of 0 as preamble, one octet of SFD, one octet of frame length + reserved bit) preceding the MAC-layer data (starting with the frame control field).
- USB_LINUX_MMAPPED = 220¶
[
DLT_USB_LINUX_MMAPPED
] USB packets, beginning with a Linux USB header, as specified by the struct usbmon_packet in the Documentation/usb/usbmon.txt file in the Linux source tree. All 64 bytes of the header are present. All fields in the header are in host byte order. When performing a live capture, the host byte order is the byte order of the machine on that the packets are captured. When reading a pcap file, the byte order is the byte order for the file, as specified by the file’s magic number; when reading a pcapng file, the byte order is the byte order for the section of the pcapng file, as specified by the Section Header Block. For isochronous transfers, the ndesc field specifies the number of isochronous descriptors that follow.
- FC_2 = 224¶
[
DLT_FC_2
] Fibre Channel FC-2 frames, beginning with a Frame_Header.
- FC_2_WITH_FRAME_DELIMS = 225¶
[
DLT_FC_2_WITH_FRAME_DELIMS
] Fibre Channel FC-2 frames, beginning an encoding of the SOF, followed by a Frame_Header, and ending with an encoding of the SOF. The encodings represent the frame delimiters as 4-byte sequences representing the corresponding ordered sets, with K28.5 represented as 0xBC, and the D symbols as the corresponding byte values; for example, SOFi2, which is K28.5 - D21.5 - D1.2 - D21.2, is represented as 0xBC 0xB5 0x55 0x55.
- IPNET = 226¶
[
DLT_IPNET
] Solaris ipnet pseudo-header, followed by an IPv4 or IPv6 datagram.
- CAN_SOCKETCAN = 227¶
[
DLT_CAN_SOCKETCAN
] CAN (Controller Area Network) frames, with a pseudo- header followed by the frame payload.
- IPV4 = 228¶
[
DLT_IPV4
] Raw IPv4; the packet begins with an IPv4 header.
- IPV6 = 229¶
[
DLT_IPV6
] Raw IPv6; the packet begins with an IPv6 header.
- IEEE802_15_4_NOFCS = 230¶
[
DLT_IEEE802_15_4_NOFCS
] IEEE 802.15.4 Low-Rate Wireless Network, without the FCS at the end of the frame.
- DBUS = 231¶
[
DLT_DBUS
] Raw D-Bus messages, starting with the endianness flag, followed by the message type, etc., but without the authentication handshake before the message sequence.
- DVB_CI = 235¶
[
DLT_DVB_CI
] DVB-CI (DVB Common Interface for communication between a PC Card module and a DVB receiver), with the message format specified by the PCAP format for DVB-CI specification.
- MUX27010 = 236¶
[
DLT_MUX27010
] Variant of 3GPP TS 27.010 multiplexing protocol (similar to, but not the same as, 27.010).
- STANAG_5066_D_PDU = 237¶
[
DLT_STANAG_5066_D_PDU
] D_PDUs as described by NATO standard STANAG 5066, starting with the synchronization sequence, and including both header and data CRCs. The current version of STANAG 5066 is backwards-compatible with the 1.0.2 version, although newer versions are classified.
- NFLOG = 239¶
[
DLT_NFLOG
] Linux netlink NETLINK NFLOG socket log messages.
- NETANALYZER = 240¶
[
DLT_NETANALYZER
] Pseudo-header for Hilscher Gesellschaft für Systemautomation mbH netANALYZER devices, followed by an Ethernet frame, beginning with the MAC header and ending with the FCS.
- NETANALYZER_TRANSPARENT = 241¶
[
DLT_NETANALYZER_TRANSPARENT
] Pseudo-header for Hilscher Gesellschaft für Systemautomation mbH netANALYZER devices, followed by an Ethernet frame, beginning with the preamble, SFD, and MAC header, and ending with the FCS.
- IPOIB = 242¶
[
DLT_IPOIB
] IP-over-InfiniBand, as specified by RFC 4391 section 6.
- MPEG_2_TS = 243¶
[
DLT_MPEG_2_TS
] MPEG-2 Transport Stream transport packets, as specified by ISO 13818-1/ITU-T Recommendation H.222.0 (see table 2-2 of section 2.4.3.2 “Transport Stream packet layer”).
- NG40 = 244¶
[
DLT_NG40
] Pseudo-header for ng4T GmbH’s UMTS Iub/Iur-over-ATM and Iub/Iur-over-IP format as used by their ng40 protocol tester, followed by frames for the Frame Protocol as specified by 3GPP TS 25.427 for dedicated channels and 3GPP TS 25.435 for common/shared channels in the case of ATM AAL2 or UDP traffic, by SSCOP packets as specified by ITU-T Recommendation Q.2110 for ATM AAL5 traffic, and by NBAP packets for SCTP traffic.
- NFC_LLCP = 245¶
[
DLT_NFC_LLCP
] Pseudo-header for NFC LLCP packet captures, followed by frame data for the LLCP Protocol as specified by NFCForum-TS-LLCP_1.1.
- INFINIBAND = 247¶
[
DLT_INFINIBAND
] Raw InfiniBand frames, starting with the Local Routing Header, as specified in Chapter 5 “Data packet format” of InfiniBand™ Architectural Specification Release 1.2.1 Volume 1 - General Specifications.
- SCTP = 248¶
[
DLT_SCTP
] SCTP packets, as defined by RFC 4960, with no lower-level protocols such as IPv4 or IPv6.
- USBPCAP = 249¶
[
DLT_USBPCAP
] USB packets, beginning with a USBPcap header.
- RTAC_SERIAL = 250¶
[
DLT_RTAC_SERIAL
] Serial-line packet header for the Schweitzer Engineering Laboratories “RTAC” product, followed by a payload for one of a number of industrial control protocols.
- BLUETOOTH_LE_LL = 251¶
[
DLT_BLUETOOTH_LE_LL
] Bluetooth Low Energy air interface Link Layer packets, in the format described in section 2.1 “PACKET FORMAT” of volume 6 of the Bluetooth Specification Version 4.0 (see PDF page 2200), but without the Preamble.
- NETLINK = 253¶
[
DLT_NETLINK
] Linux Netlink capture encapsulation.
- BLUETOOTH_LINUX_MONITOR = 254¶
[
DLT_BLUETOOTH_LINUX_MONITOR
] Bluetooth Linux Monitor encapsulation of traffic for the BlueZ stack.
- BLUETOOTH_BREDR_BB = 255¶
[
DLT_BLUETOOTH_BREDR_BB
] Bluetooth Basic Rate and Enhanced Data Rate baseband packets.
- BLUETOOTH_LE_LL_WITH_PHDR = 256¶
[
DLT_BLUETOOTH_LE_LL_WITH_PHDR
] Bluetooth Low Energy link-layer packets.
- PROFIBUS_DL = 257¶
[
DLT_PROFIBUS_DL
] PROFIBUS data link layer packets, as specified by IEC standard 61158-4-3, beginning with the start delimiter, ending with the end delimiter, and including all octets between them.
- PKTAP = 258¶
[
DLT_PKTAP
] Apple PKTAP capture encapsulation.
- EPON = 259¶
[
DLT_EPON
] Ethernet-over-passive-optical-network packets, starting with the last 6 octets of the modified preamble as specified by 65.1.3.2 “Transmit” in Clause 65 of Section 5 of IEEE 802.3, followed immediately by an Ethernet frame.
- IPMI_HPM_2 = 260¶
[
DLT_IPMI_HPM_2
] IPMI trace packets, as specified by Table 3-20 “Trace Data Block Format” in the PICMG HPM.2 specification. The time stamps for packets in this format must match the time stamps in the Trace Data Blocks.
- ZWAVE_R1_R2 = 261¶
[
DLT_ZWAVE_R1_R2
] Z-Wave RF profile R1 and R2 packets, as specified by ITU-T Recommendation G.9959, with some MAC layer fields moved.
- ZWAVE_R3 = 262¶
[
DLT_ZWAVE_R3
] Z-Wave RF profile R3 packets, as specified by ITU-T Recommendation G.9959, with some MAC layer fields moved.
- WATTSTOPPER_DLM = 263¶
[
DLT_WATTSTOPPER_DLM
] Formats for WattStopper Digital Lighting Management (DLM) and Legrand Nitoo Open protocol common packet structure captures.
- ISO_14443 = 264¶
[
DLT_ISO_14443
] Messages between ISO 14443 contactless smartcards (Proximity Integrated Circuit Card, PICC) and card readers (Proximity Coupling Device, PCD), with the message format specified by the PCAP format for ISO14443 specification.
- RDS = 265¶
[
DLT_RDS
] Radio data system (RDS) groups, as per IEC 62106, encapsulated in this form.
- USB_DARWIN = 266¶
[
DLT_USB_DARWIN
] USB packets, beginning with a Darwin (macOS, etc.) USB header.
- SDLC = 268¶
[
DLT_SDLC
] SDLC packets, as specified by Chapter 1, “DLC Links”, section “Synchronous Data Link Control (SDLC)” of Systems Network Architecture Formats, GA27-3136-20, without the flag fields, zero-bit insertion, or Frame Check Sequence field, containing SNA path information units (PIUs) as the payload.
- LORATAP = 270¶
[
DLT_LORATAP
] LoRaTap pseudo-header, followed by the payload, which is typically the PHYPayload from the LoRaWan specification.
- VSOCK = 271¶
[
DLT_VSOCK
] Protocol for communication between host and guest machines in VMware and KVM hypervisors.
- NORDIC_BLE = 272¶
[
DLT_NORDIC_BLE
] Messages to and from a Nordic Semiconductor nRF Sniffer for Bluetooth LE packets, beginning with a pseudo-header.
- DOCSIS31_XRA31 = 273¶
[
DLT_DOCSIS31_XRA31
] DOCSIS packets and bursts, preceded by a pseudo- header giving metadata about the packet.
- ETHERNET_MPACKET = 274¶
[
DLT_ETHERNET_MPACKET
] mPackets, as specified by IEEE 802.3br Figure 99-4, starting with the preamble and always ending with a CRC field.
- DISPLAYPORT_AUX = 275¶
[
DLT_DISPLAYPORT_AUX
] DisplayPort AUX channel monitoring data as specified by VESA DisplayPort (DP) Standard preceded by a pseudo-header.
- LINUX_SLL2 = 276¶
[
DLT_LINUX_SLL2
] Linux “cooked” capture encapsulation v2.
- OPENVIZSLA = 278¶
[
DLT_OPENVIZSLA
] Openvizsla FPGA-based USB sniffer.
- EBHSCR = 279¶
[
DLT_EBHSCR
] Elektrobit High Speed Capture and Replay (EBHSCR) format.
- VPP_DISPATCH = 280¶
//fd.io VPP graph dispatch tracer, in the the graph dispatcher trace format.
- Type
[
DLT_VPP_DISPATCH
] Records in traces from the http
- DSA_TAG_BRCM = 281¶
[
DLT_DSA_TAG_BRCM
] Ethernet frames, with a switch tag inserted between the source address field and the type/length field in the Ethernet header.
- DSA_TAG_BRCM_PREPEND = 282¶
[
DLT_DSA_TAG_BRCM_PREPEND
] Ethernet frames, with a switch tag inserted before the destination address in the Ethernet header.
- IEEE802_15_4_TAP = 283¶
[
DLT_IEEE802_15_4_TAP
] IEEE 802.15.4 Low-Rate Wireless Networks, with a pseudo-header containing TLVs with metadata preceding the 802.15.4 header.
- DSA_TAG_DSA = 284¶
[
DLT_DSA_TAG_DSA
] Ethernet frames, with a switch tag inserted between the source address field and the type/length field in the Ethernet header.
- DSA_TAG_EDSA = 285¶
[
DLT_DSA_TAG_EDSA
] Ethernet frames, with a programmable Ethernet type switch tag inserted between the source address field and the type/length field in the Ethernet header.
- ELEE = 286¶
[
DLT_ELEE
] Payload of lawful intercept packets using the ELEE protocol. The packet begins with the ELEE header; it does not include any transport- layer or lower-layer headers for protcols used to transport ELEE packets.
- Z_WAVE_SERIAL = 287¶
[
DLT_Z_WAVE_SERIAL
] Serial frames transmitted between a host and a Z-Wave chip over an RS-232 or USB serial connection, as described in section 5 of the Z-Wave Serial API Host Application Programming Guide.
- USB_2_0 = 288¶
[
DLT_USB_2_0
] USB 2.0, 1.1, or 1.0 packet, beginning with a PID, as described by Chapter 8 “Protocol Layer” of the the Universal Serial Bus Specification Revision 2.0.
- ATSC_ALP = 289¶
[
DLT_ATSC_ALP
] ATSC Link-Layer Protocol frames, as described in section 5 of the A/330 Link-Layer Protocol specification, found at the ATSC 3.0 standards page, beginning with a Base Header.
- ETW = 290¶
[
DLT_ETW
] Event Tracing for Windows messages, beginning with a pseudo- header.
- ZBOSS_NCP = 292¶
[
DLT_ZBOSS_NCP
] Serial NCP (Network Co-Processor) protocol for Zigbee stack ZBOSS by DSR. ZBOSS NCP protocol, beginning with a header.
Ethertype IEEE 802 Numbers¶
This module contains the constant enumeration for Ethertype IEEE 802 Numbers,
which is automatically generated from pcapkit.vendor.reg.ethertype.EtherType
.
- class pcapkit.const.reg.ethertype.EtherType(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[EtherType] Ethertype IEEE 802 Numbers
- XEROX_PUP = 512¶
XEROX PUP (see 0A00) [Boggs, D., J. Shoch, E. Taft, and R. Metcalfe, “PUP: An Internetwork Architecture”, XEROX Palo Alto Research Center, CSL-79-10, July 1979; also in IEEE Transactions on Communication, Volume COM-28, Number 4, April 1980.][Neil Sembower]
- PUP_Addr_Trans_0x0201 = 513¶
PUP Addr Trans (see 0A01) [Neil Sembower]
- Nixdorf = 1024¶
Nixdorf [Neil Sembower]
- XEROX_NS_IDP = 1536¶
Data Link Layer and Physical Layer Specification”, AA-K759B-TK, Digital Equipment Corporation, Maynard, MA. Also as: “The Ethernet - A Local Area Network”, Version 1.0, Digital Equipment Corporation, Intel Corporation, Xerox Corporation, September 1980. And: “The Ethernet, A Local Area Network: Data Link Layer and Physical Layer Specifications”, Digital, Intel and Xerox, November 1982. And: XEROX, “The Ethernet, A Local Area Network: Data Link Layer and Physical Layer Specification”, X3T51/80-50, Xerox Corporation, Stamford, CT., October 1980.][Neil Sembower]
- Type
XEROX NS IDP [“The Ethernet, A Local Area Network
- DLOG_0x0660 = 1632¶
DLOG [Neil Sembower]
- DLOG_0x0661 = 1633¶
DLOG [Neil Sembower]
- X_75_Internet = 2049¶
X.75 Internet [Neil Sembower]
- NBS_Internet = 2050¶
NBS Internet [Neil Sembower]
- ECMA_Internet = 2051¶
ECMA Internet [Neil Sembower]
- Chaosnet = 2052¶
Chaosnet [Neil Sembower]
- X_25_Level_3 = 2053¶
X.25 Level 3 [Neil Sembower]
- XNS_Compatability = 2055¶
XNS Compatability [Neil Sembower]
- Symbolics_Private = 2076¶
Symbolics Private [David Plummer]
- Ungermann_Bass_net_debugr = 2304¶
Ungermann-Bass net debugr [Neil Sembower]
- Xerox_IEEE802_3_PUP = 2560¶
Xerox IEEE802.3 PUP [Neil Sembower]
- PUP_Addr_Trans_0x0A01 = 2561¶
PUP Addr Trans [Neil Sembower]
- Banyan_VINES = 2989¶
Banyan VINES [Neil Sembower]
- Berkeley_Trailer_nego = 4096¶
Berkeley Trailer nego [Neil Sembower]
- Valid_Systems = 5632¶
Valid Systems [Neil Sembower]
- PCS_Basic_Block_Protocol = 16962¶
PCS Basic Block Protocol [Neil Sembower]
- BBN_Simnet = 21000¶
BBN Simnet [Neil Sembower]
- DEC_Unassigned_0x6000 = 24576¶
DEC Unassigned (Exp.) [Neil Sembower]
- DEC_MOP_Dump_Load = 24577¶
DEC MOP Dump/Load [Neil Sembower]
- DEC_MOP_Remote_Console = 24578¶
DEC MOP Remote Console [Neil Sembower]
- DEC_DECNET_Phase_IV_Route = 24579¶
DEC DECNET Phase IV Route [Neil Sembower]
- DEC_LAT = 24580¶
DEC LAT [Neil Sembower]
- DEC_Diagnostic_Protocol = 24581¶
DEC Diagnostic Protocol [Neil Sembower]
- DEC_Customer_Protocol = 24582¶
DEC Customer Protocol [Neil Sembower]
- DEC_LAVC_SCA = 24583¶
DEC LAVC, SCA [Neil Sembower]
- Ungermann_Bass_download = 28672¶
Ungermann-Bass download [Neil Sembower]
- Ungermann_Bass_dia_loop = 28674¶
Ungermann-Bass dia/loop [Neil Sembower]
- Proteon = 28720¶
Proteon [Neil Sembower]
- Cabletron = 28724¶
Cabletron [Neil Sembower]
- HP_Probe = 32773¶
HP Probe [Neil Sembower]
- Nestar = 32774¶
Nestar [Neil Sembower]
- AT_T_0x8008 = 32776¶
AT&T [Neil Sembower]
- Excelan = 32784¶
Excelan [Neil Sembower]
- SGI_diagnostics = 32787¶
SGI diagnostics [Andrew Cherenson]
- SGI_network_games = 32788¶
SGI network games [Andrew Cherenson]
- SGI_reserved = 32789¶
SGI reserved [Andrew Cherenson]
- SGI_bounce_server = 32790¶
SGI bounce server [Andrew Cherenson]
- Apollo_Domain = 32793¶
Apollo Domain [Neil Sembower]
Tymshare [Neil Sembower]
- Tigan_Inc = 32815¶
Tigan, Inc. [Neil Sembower]
- Reverse_Address_Resolution_Protocol = 32821¶
Reverse Address Resolution Protocol (RARP) [RFC 903][Joseph Murdock]
- Aeonic_Systems = 32822¶
Aeonic Systems [Neil Sembower]
- DEC_LANBridge = 32824¶
DEC LANBridge [Neil Sembower]
- DEC_Ethernet_Encryption = 32829¶
DEC Ethernet Encryption [Neil Sembower]
- DEC_Unassigned_0x803E = 32830¶
DEC Unassigned [Neil Sembower]
- DEC_LAN_Traffic_Monitor = 32831¶
DEC LAN Traffic Monitor [Neil Sembower]
- Planning_Research_Corp = 32836¶
Planning Research Corp. [Neil Sembower]
- AT_T_0x8046 = 32838¶
AT&T [Neil Sembower]
- AT_T_0x8047 = 32839¶
AT&T [Neil Sembower]
- ExperData = 32841¶
ExperData [Neil Sembower]
- Stanford_V_Kernel_exp = 32859¶
Stanford V Kernel exp. [Neil Sembower]
- Stanford_V_Kernel_prod = 32860¶
Stanford V Kernel prod. [Neil Sembower]
- Evans_Sutherland = 32861¶
Evans & Sutherland [Neil Sembower]
- Little_Machines = 32864¶
Little Machines [Neil Sembower]
- Counterpoint_Computers = 32866¶
Counterpoint Computers [Neil Sembower]
- Univ_of_Mass_Amherst_0x8065 = 32869¶
Univ. of Mass. @ Amherst [Neil Sembower]
- Univ_of_Mass_Amherst_0x8066 = 32870¶
Univ. of Mass. @ Amherst [Neil Sembower]
- Veeco_Integrated_Auto = 32871¶
Veeco Integrated Auto. [Neil Sembower]
- General_Dynamics = 32872¶
General Dynamics [Neil Sembower]
- AT_T_0x8069 = 32873¶
AT&T [Neil Sembower]
- Autophon = 32874¶
Autophon [Neil Sembower]
- ComDesign = 32876¶
ComDesign [Neil Sembower]
- Computgraphic_Corp = 32877¶
Computgraphic Corp. [Neil Sembower]
- Matra = 32890¶
Matra [Neil Sembower]
- Dansk_Data_Elektronik = 32891¶
Dansk Data Elektronik [Neil Sembower]
- Merit_Internodal = 32892¶
Merit Internodal [Hans Werner Braun]
- Vitalink_TransLAN_III = 32896¶
Vitalink TransLAN III [Neil Sembower]
- Appletalk = 32923¶
Appletalk [Neil Sembower]
- Spider_Systems_Ltd = 32927¶
Spider Systems Ltd. [Neil Sembower]
- Nixdorf_Computers = 32931¶
Nixdorf Computers [Neil Sembower]
- Banyan_Systems_0x80C4 = 32964¶
Banyan Systems [Neil Sembower]
- Banyan_Systems_0x80C5 = 32965¶
Banyan Systems [Neil Sembower]
- Pacer_Software = 32966¶
Pacer Software [Neil Sembower]
- Applitek_Corporation = 32967¶
Applitek Corporation [Neil Sembower]
- IBM_SNA_Service_on_Ether = 32981¶
IBM SNA Service on Ether [Neil Sembower]
- Varian_Associates = 32989¶
Varian Associates [Neil Sembower]
- Retix = 33010¶
Retix [Neil Sembower]
- AppleTalk_AARP = 33011¶
AppleTalk AARP (Kinetics) [Neil Sembower]
- Apollo_Computer = 33015¶
Apollo Computer [Neil Sembower]
- Wellfleet_Communications = 33023¶
Wellfleet Communications [Neil Sembower]
- Customer_VLAN_Tag_Type = 33024¶
Customer VLAN Tag Type (C-Tag, formerly called the Q-Tag) (initially Wellfleet) [RFC 7042]
- Hayes_Microcomputers = 33072¶
Hayes Microcomputers [Neil Sembower]
- VG_Laboratory_Systems = 33073¶
VG Laboratory Systems [Neil Sembower]
- Logicraft = 33096¶
Logicraft [Neil Sembower]
- Network_Computing_Devices = 33097¶
Network Computing Devices [Neil Sembower]
- Alpha_Micro = 33098¶
Alpha Micro [Neil Sembower]
- SNMP = 33100¶
SNMP [Joyce K Reynolds]
- BIIN_0x814D = 33101¶
BIIN [Neil Sembower]
- BIIN_0x814E = 33102¶
BIIN [Neil Sembower]
- Technically_Elite_Concept = 33103¶
Technically Elite Concept [Neil Sembower]
- Rational_Corp = 33104¶
Rational Corp [Neil Sembower]
- XTP = 33149¶
XTP [Neil Sembower]
- SGI_Time_Warner_prop = 33150¶
SGI/Time Warner prop. [Neil Sembower]
- HIPPI_FP_encapsulation = 33152¶
HIPPI-FP encapsulation [Neil Sembower]
- STP_HIPPI_ST = 33153¶
STP, HIPPI-ST [Neil Sembower]
- Reserved_for_HIPPI_6400_0x8182 = 33154¶
Reserved for HIPPI-6400 [Neil Sembower]
- Reserved_for_HIPPI_6400_0x8183 = 33155¶
Reserved for HIPPI-6400 [Neil Sembower]
- Motorola_Computer = 33165¶
Motorola Computer [Neil Sembower]
- ARAI_Bunkichi = 33188¶
ARAI Bunkichi [Neil Sembower]
- SECTRA = 34523¶
SECTRA [Neil Sembower]
- Delta_Controls = 34526¶
Delta Controls [Neil Sembower]
- ATOMIC = 34527¶
ATOMIC [Joe Touch]
- IEEE_Std_802_3_Ethernet_Passive_Optical_Network = 34824¶
IEEE Std 802.3 - Ethernet Passive Optical Network (EPON) [EPON][RFC 7042]
- Slow_Protocols = 34825¶
Slow Protocols (Link Aggregation, OAM, etc.) [IEEE]
- Ethernet_NIC_hardware_and_software_testing = 34850¶
Ethernet NIC hardware and software testing [Wind River]
- Multicast_Channel_Allocation_Protocol = 34913¶
Multicast Channel Allocation Protocol (MCAP) [RFC 7042]
- PPP_over_Ethernet_Session_Stage = 34916¶
PPP over Ethernet (PPPoE) Session Stage [RFC 2516][RFC 8822]
- IEEE_Std_802_1X_Port_based_network_access_control = 34958¶
IEEE Std 802.1X - Port-based network access control [IEEE]
- IEEE_Std_802_1Q_Service_VLAN_tag_identifier = 34984¶
IEEE Std 802.1Q - Service VLAN tag identifier (S-Tag) [IEEE]
- IEEE_Std_802_Local_Experimental_Ethertype_0x88B5 = 34997¶
IEEE Std 802 - Local Experimental Ethertype [IEEE]
- IEEE_Std_802_Local_Experimental_Ethertype_0x88B6 = 34998¶
IEEE Std 802 - Local Experimental Ethertype [IEEE]
- IEEE_Std_802_OUI_Extended_Ethertype = 34999¶
IEEE Std 802 - OUI Extended Ethertype [IEEE]
- IEEE_Std_802_11_Pre_Authentication = 35015¶
IEEE Std 802.11 - Pre-Authentication (802.11i) [IEEE]
- IEEE_Std_802_1AB_Link_Layer_Discovery_Protocol = 35020¶
IEEE Std 802.1AB - Link Layer Discovery Protocol (LLDP) [IEEE]
- IEEE_Std_802_1AE_Media_Access_Control_Security = 35045¶
IEEE Std 802.1AE - Media Access Control Security [IEEE]
- Provider_Backbone_Bridging_Instance_tag = 35047¶
Provider Backbone Bridging Instance tag [IEEE Std 802.1Q-2014]
- IEEE_Std_802_1Q_Multiple_VLAN_Registration_Protocol = 35061¶
IEEE Std 802.1Q - Multiple VLAN Registration Protocol (MVRP) [IEEE]
- IEEE_Std_802_1Q_Multiple_Multicast_Registration_Protocol = 35062¶
IEEE Std 802.1Q - Multiple Multicast Registration Protocol (MMRP) [IEEE]
- IEEE_Std_802_11_Fast_Roaming_Remote_Request = 35085¶
IEEE Std 802.11 - Fast Roaming Remote Request (802.11r) [IEEE]
- IEEE_Std_802_21_Media_Independent_Handover_Protocol = 35095¶
IEEE Std 802.21 - Media Independent Handover Protocol [IEEE]
- IEEE_Std_802_1Qbe_Multiple_I_SID_Registration_Protocol = 35113¶
IEEE Std 802.1Qbe - Multiple I-SID Registration Protocol [IEEE]
- IEEE_Std_802_1Qbg_ECP_Protocol = 35136¶
IEEE Std 802.1Qbg - ECP Protocol (also used in 802.1BR) [IEEE]
- GeoNetworking_as_defined_in_ETSI_EN_302_636_4_1 = 35143¶
GeoNetworking as defined in ETSI EN 302 636-4-1 [IEEE]
- Loopback = 36864¶
Loopback [Neil Sembower]
- EtherType_3Com_XNS_Sys_Mgmt = 36865¶
3Com(Bridge) XNS Sys Mgmt [Neil Sembower]
- EtherType_3Com_TCP_IP_Sys = 36866¶
3Com(Bridge) TCP-IP Sys [Neil Sembower]
- EtherType_3Com_loop_detect = 36867¶
3Com(Bridge) loop detect [Neil Sembower]
- The_Ethertype_will_be_used_to_identify_a_Channel_in_which_control_messages_are_encapsulated_as_payload_of_GRE_packets_When_a_GRE_packet_tagged_with_the_Ethertype_is_received_the_payload_will_be_handed_to_the_network_processor_for_processing = 47082¶
The Ethertype will be used to identify a “Channel” in which control messages are encapsulated as payload of GRE packets. When a GRE packet tagged with the Ethertype is received, the payload will be handed to the network processor for processing. [RFC 8157]
- BBN_VITAL_LanBridge_cache = 65280¶
BBN VITAL-LanBridge cache [Neil Sembower]
Transport Layer Protocol Numbers¶
This module contains the constant enumeration for Transport Layer Protocol Numbers,
which is automatically generated from pcapkit.vendor.reg.transtype.TransType
.
- class pcapkit.const.reg.transtype.TransType(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[TransType] Transport Layer Protocol Numbers
- TCP = 6¶
Transmission Control [RFC-ietf-tcpm-rfc793bis-28]
- CBT = 7¶
CBT [Tony Ballardie]
- IGP = 9¶
any private interior gateway (used by Cisco for their IGRP) [Internet Assigned Numbers Authority]
- BBN_RCC_MON = 10¶
BBN RCC Monitoring [Steve Chipman]
- PUP = 12¶
An Internetwork Architecture”, XEROX Palo Alto Research Center, CSL-79-10, July 1979; also in IEEE Transactions on Communication, Volume COM-28, Number 4, April 1980.][XEROX]
- Type
PUP [Boggs, D., J. Shoch, E. Taft, and R. Metcalfe, “PUP
- ARGUS = 13¶
ARGUS (deprecated)) [Robert W Scheifler]
- EMCON = 14¶
EMCON [<mystery contact>]
- XNET = 15¶
Cross Net Debugger [Haverty, J., “XNET Formats for Internet Protocol Version 4”, IEN 158, October 1980.][Jack Haverty]
- CHAOS = 16¶
Chaos [J Noel Chiappa]
- MUX = 18¶
Multiplexing [Cohen, D. and J. Postel, “Multiplexing Protocol”, IEN 90, USC/Information Sciences Institute, May 1979.][Jon Postel]
- DCN_MEAS = 19¶
DCN Measurement Subsystems [David Mills]
- PRM = 21¶
Packet Radio Measurement [Zaw Sing Su]
- XNS_IDP = 22¶
Data Link Layer and Physical Layer Specification”, AA-K759B-TK, Digital Equipment Corporation, Maynard, MA. Also as: “The Ethernet - A Local Area Network”, Version 1.0, Digital Equipment Corporation, Intel Corporation, Xerox Corporation, September 1980. And: “The Ethernet, A Local Area Network: Data Link Layer and Physical Layer Specifications”, Digital, Intel and Xerox, November 1982. And: XEROX, “The Ethernet, A Local Area Network: Data Link Layer and Physical Layer Specification”, X3T51/80-50, Xerox Corporation, Stamford, CT., October 1980.][XEROX]
- Type
XEROX NS IDP [“The Ethernet, A Local Area Network
- TRUNK_1 = 23¶
Trunk-1 [Barry Boehm]
- TRUNK_2 = 24¶
Trunk-2 [Barry Boehm]
- LEAF_1 = 25¶
Leaf-1 [Barry Boehm]
- LEAF_2 = 26¶
Leaf-2 [Barry Boehm]
- MFE_NSP = 31¶
MFE Network Services Protocol [Shuttleworth, B., “A Documentary of MFENet, a National Computer Network”, UCRL-52317, Lawrence Livermore Labs, Livermore, California, June 1977.][Barry Howard]
- MERIT_INP = 32¶
MERIT Internodal Protocol [Hans Werner Braun]
- TransType_3PC = 34¶
Third Party Connect Protocol [Stuart A Friedberg]
- IDPR = 35¶
Inter-Domain Policy Routing Protocol [Martha Steenstrup]
- XTP = 36¶
XTP [Greg Chesson]
- DDP = 37¶
Datagram Delivery Protocol [Wesley Craig]
- IDPR_CMTP = 38¶
IDPR Control Message Transport Proto [Martha Steenstrup]
- TP = 39¶
TP++ Transport Protocol [Dirk Fromhein]
- IL = 40¶
IL Transport Protocol [Dave Presotto]
- SDRP = 42¶
Source Demand Routing Protocol [Deborah Estrin]
- IPv6_Route = 43¶
Routing Header for IPv6 [Steve Deering]
- IPv6_Frag = 44¶
Fragment Header for IPv6 [Steve Deering]
- IDRP = 45¶
Inter-Domain Routing Protocol [Sue Hares]
- BNA = 49¶
BNA [Gary Salamon]
- I_NLSP = 52¶
Integrated Net Layer Security TUBA [K Robert Glenn]
- SWIPE = 53¶
IP with Encryption (deprecated)) [John Ioannidis]
- MOBILE = 55¶
IP Mobility [Charlie Perkins]
- TLSP = 56¶
Transport Layer Security Protocol using Kryptonet key management [Christer Oberg]
- SKIP = 57¶
SKIP [Tom Markson]
- any_host_internal_protocol = 61¶
any host internal protocol [Internet Assigned Numbers Authority]
- CFTP = 62¶
CFTP [Forsdick, H., “CFTP”, Network Message, Bolt Beranek and Newman, January 1982.][Harry Forsdick]
- any_local_network = 63¶
any local network [Internet Assigned Numbers Authority]
- SAT_EXPAK = 64¶
SATNET and Backroom EXPAK [Steven Blumenthal]
- KRYPTOLAN = 65¶
Kryptolan [Paul Liu]
- RVD = 66¶
MIT Remote Virtual Disk Protocol [Michael Greenwald]
- IPPC = 67¶
Internet Pluribus Packet Core [Steven Blumenthal]
- any_distributed_file_system = 68¶
any distributed file system [Internet Assigned Numbers Authority]
- SAT_MON = 69¶
SATNET Monitoring [Steven Blumenthal]
- VISA = 70¶
VISA Protocol [Gene Tsudik]
- IPCV = 71¶
Internet Packet Core Utility [Steven Blumenthal]
- CPNX = 72¶
Computer Protocol Network Executive [David Mittnacht]
- CPHB = 73¶
Computer Protocol Heart Beat [David Mittnacht]
- WSN = 74¶
Wang Span Network [Victor Dafoulas]
- PVP = 75¶
Packet Video Protocol [Steve Casner]
- BR_SAT_MON = 76¶
Backroom SATNET Monitoring [Steven Blumenthal]
- SUN_ND = 77¶
SUN ND PROTOCOL-Temporary [William Melohn]
- WB_MON = 78¶
WIDEBAND Monitoring [Steven Blumenthal]
- WB_EXPAK = 79¶
WIDEBAND EXPAK [Steven Blumenthal]
- ISO_IP = 80¶
ISO Internet Protocol [Marshall T Rose]
- VMTP = 81¶
VMTP [Dave Cheriton]
- SECURE_VMTP = 82¶
SECURE-VMTP [Dave Cheriton]
- VINES = 83¶
VINES [Brian Horn]
- TTP = 84¶
Transaction Transport Protocol [Jim Stevens]
- IPTM = 84¶
Internet Protocol Traffic Manager [Jim Stevens]
- NSFNET_IGP = 85¶
NSFNET-IGP [Hans Werner Braun]
- DGP = 86¶
Dissimilar Gateway Protocol [M/A-COM Government Systems, “Dissimilar Gateway Protocol Specification, Draft Version”, Contract no. CS901145, November 16, 1987.][Mike Little]
- TCF = 87¶
TCF [Guillermo A Loyola]
- Sprite_RPC = 90¶
Sprite RPC Protocol [Welch, B., “The Sprite Remote Procedure Call System”, Technical Report, UCB/Computer Science Dept., 86/302, University of California at Berkeley, June 1986.][Bruce Willins]
- LARP = 91¶
Locus Address Resolution Protocol [Brian Horn]
- MTP = 92¶
Multicast Transport Protocol [Susie Armstrong]
- AX_25 = 93¶
AX.25 Frames [Brian Kantor]
- IPIP = 94¶
IP-within-IP Encapsulation Protocol [John Ioannidis]
- MICP = 95¶
Mobile Internetworking Control Pro. (deprecated)) [John Ioannidis]
- SCC_SP = 96¶
Semaphore Communications Sec. Pro. [Howard Hart]
- any_private_encryption_scheme = 99¶
any private encryption scheme [Internet Assigned Numbers Authority]
- GMTP = 100¶
GMTP [RXB5]
- IFMP = 101¶
Ipsilon Flow Management Protocol [Bob Hinden][November 1995, 1997.]
- PNNI = 102¶
PNNI over IP [Ross Callon]
- ARIS = 104¶
ARIS [Nancy Feldman]
- SCPS = 105¶
SCPS [Robert Durst]
- QNX = 106¶
QNX [Michael Hunter]
- A_N = 107¶
Active Networks [Bob Braden]
- SNP = 109¶
Sitara Networks Protocol [Manickam R Sridhar]
- Compaq_Peer = 110¶
Compaq Peer Protocol [Victor Volpe]
- IPX_in_IP = 111¶
IPX in IP [CJ Lee]
- PGM = 113¶
PGM Reliable Transport Protocol [Tony Speakman]
- any_0_hop_protocol = 114¶
any 0-hop protocol [Internet Assigned Numbers Authority]
- DDX = 116¶
D-II Data Exchange (DDX) [John Worley]
- IATP = 117¶
Interactive Agent Transfer Protocol [John Murphy]
- STP = 118¶
Schedule Transfer Protocol [Jean Michel Pittet]
- SRP = 119¶
SpectraLink Radio Protocol [Mark Hamilton]
- UTI = 120¶
UTI [Peter Lothberg]
- SMP = 121¶
Simple Message Protocol [Leif Ekblad]
- SM = 122¶
Simple Multicast Protocol (deprecated)) [Jon Crowcroft][draft-perlman- simple-multicast]
- PTP = 123¶
Performance Transparency Protocol [Michael Welzl]
- ISIS_over_IPv4 = 124¶
[Tony Przygienda]
- FIRE = 125¶
[Criag Partridge]
- CRTP = 126¶
Combat Radio Transport Protocol [Robert Sautter]
- CRUDP = 127¶
Combat Radio User Datagram [Robert Sautter]
- SSCOPMCE = 128¶
[Kurt Waber]
- IPLT = 129¶
[Hollbach]
- SPS = 130¶
Secure Packet Shield [Bill McIntosh]
- PIPE = 131¶
Private IP Encapsulation within IP [Bernhard Petri]
- SCTP = 132¶
Stream Control Transmission Protocol [Randall R Stewart]
- Reserved_255 = 255¶
[Internet Assigned Numbers Authority]
Link Layer¶
ARP
Constant Enumerations¶
This module contains all constant enumerations of ARP
and RARP
implementations. Available
enumerations include:
ARP Hardware Types * |
|
Operation Codes † |
Hardware Types¶
This module contains the constant enumeration for Hardware Types,
which is automatically generated from pcapkit.vendor.arp.hardware.Hardware
.
- class pcapkit.const.arp.hardware.Hardware(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[Hardware] Hardware Types [RFC 826][RFC 5494]
- Ethernet = 1¶
Ethernet (10Mb) [Jon Postel]
- Experimental_Ethernet = 2¶
Experimental Ethernet (3Mb) [Jon Postel]
- Amateur_Radio_AX_25 = 3¶
Amateur Radio AX.25 [Philip Koch]
- Proteon_ProNET_Token_Ring = 4¶
Proteon ProNET Token Ring [Avri Doria]
- Chaos = 5¶
Chaos [Gill Pratt]
- IEEE_802_Networks = 6¶
IEEE 802 Networks [Jon Postel]
- Hyperchannel = 8¶
Hyperchannel [Jon Postel]
- Lanstar = 9¶
Lanstar [Tom Unger]
- Autonet_Short_Address = 10¶
Autonet Short Address [Mike Burrows]
- LocalTalk = 11¶
LocalTalk [Joyce K Reynolds]
- LocalNet = 12¶
LocalNet (IBM PCNet or SYTEK LocalNET) [Joseph Murdock]
- Ultra_link = 13¶
Ultra link [Rajiv Dhingra]
- SMDS = 14¶
SMDS [George Clapp]
- Frame_Relay = 15¶
Frame Relay [Andy Malis]
- Asynchronous_Transmission_Mode_16 = 16¶
Asynchronous Transmission Mode (ATM) [JXB2]
- HDLC = 17¶
HDLC [Jon Postel]
- Serial_Line = 20¶
Serial Line [Jon Postel]
- Asynchronous_Transmission_Mode_21 = 21¶
Asynchronous Transmission Mode (ATM) [Mike Burrows]
- MIL_STD_188_220 = 22¶
MIL-STD-188-220 [Herb Jensen]
- Metricom = 23¶
Metricom [Jonathan Stone]
- IEEE_1394_1995 = 24¶
IEEE 1394.1995 [Myron Hattig]
- Twinaxial = 26¶
Twinaxial [Marion Pitts]
- EUI_64 = 27¶
EUI-64 [Kenji Fujisawa]
- HIPARP = 28¶
HIPARP [Jean Michel Pittet]
- IP_and_ARP_over_ISO_7816_3 = 29¶
IP and ARP over ISO 7816-3 [Scott Guthery]
- ARPSec = 30¶
ARPSec [Jerome Etienne]
- TIA_102_Project_25_Common_Air_Interface = 33¶
TIA-102 Project 25 Common Air Interface (CAI) [Jeff Anderson, Telecommunications Industry of America (TIA) TR-8.5 Formulating Group, <cja015&motorola.com>, June 2004]
- Wiegand_Interface = 34¶
Wiegand Interface [Scott Guthery 2]
- Pure_IP = 35¶
Pure IP [Inaky Perez-Gonzalez]
- HFI = 37¶
HFI [Tseng-Hui Lin]
- AEthernet = 257¶
AEthernet [Geoffroy Gramaize]
Operation Codes¶
This module contains the constant enumeration for Operation Codes,
which is automatically generated from pcapkit.vendor.arp.operation.Operation
.
- class pcapkit.const.arp.operation.Operation(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[Operation] Operation Codes [RFC 826][RFC 5494]
- MARS_Request = 11¶
MARS-Request [Grenville Armitage]
- MARS_Multi = 12¶
MARS-Multi [Grenville Armitage]
- MARS_MServ = 13¶
MARS-MServ [Grenville Armitage]
- MARS_Join = 14¶
MARS-Join [Grenville Armitage]
- MARS_Leave = 15¶
MARS-Leave [Grenville Armitage]
- MARS_NAK = 16¶
MARS-NAK [Grenville Armitage]
- MARS_Unserv = 17¶
MARS-Unserv [Grenville Armitage]
- MARS_SJoin = 18¶
MARS-SJoin [Grenville Armitage]
- MARS_SLeave = 19¶
MARS-SLeave [Grenville Armitage]
- MARS_Grouplist_Request = 20¶
MARS-Grouplist-Request [Grenville Armitage]
- MARS_Grouplist_Reply = 21¶
MARS-Grouplist-Reply [Grenville Armitage]
- MARS_Redirect_Map = 22¶
MARS-Redirect-Map [Grenville Armitage]
L2TP
Constant Enumerations¶
This module contains all constant enumerations of
L2TP
implementations. Available
enumerations include:
L2TP Types |
L2TP Type¶
This module contains the constant enumeration for L2TP Type,
which is automatically generated from pcapkit.vendor.l2tp.type.Type
.
OSPF
Constant Enumerations¶
This module contains all constant enumerations of
OSPF
implementations. Available
enumerations include:
Authentication Codes * |
|
OSPF Packet Types † |
Authentication Types¶
This module contains the constant enumeration for Authentication Types,
which is automatically generated from pcapkit.vendor.ospf.authentication.Authentication
.
- class pcapkit.const.ospf.authentication.Authentication(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[Authentication] Authentication Types
- Cryptographic_Authentication_with_Extended_Sequence_Numbers = 3¶
Cryptographic Authentication with Extended Sequence Numbers [RFC 7474]
OSPF Packet Types¶
This module contains the constant enumeration for OSPF Packet Types,
which is automatically generated from pcapkit.vendor.ospf.packet.Packet
.
- class pcapkit.const.ospf.packet.Packet(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[Packet] OSPF Packet Types
- Reserved_0 = 0¶
Reserved
VLAN
Constant Enumerations¶
This module contains all constant enumerations of
VLAN
implementations. Available
enumerations include:
Priority Levels * |
Priority levels defined in IEEE 802.1p.¶
This module contains the constant enumeration for Priority levels defined in IEEE 802.1p.,
which is automatically generated from pcapkit.vendor.vlan.priority_level.PriorityLevel
.
- class pcapkit.const.vlan.priority_level.PriorityLevel(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[PriorityLevel] Priority levels defined in IEEE 802.1p.
- BK = 1¶
Background (lowest)
- BE = 0¶
Best effort (default)
- EE = 2¶
Excellent effort
- CA = 3¶
Critical applications
- VI = 4¶
Video, < 100 ms latency and jitter
- VO = 5¶
Voice, < 10 ms latency and jitter
- IC = 6¶
Internetwork control
- NC = 7¶
Network control (highest)
Internet Layer¶
HIP
Constant Enumerations¶
This module contains all constant enumerations of
HIP
implementations. Available
enumerations include:
HIP Certificate Types * |
|
HIP Cipher IDs † |
|
DI-Types ‡ |
|
ECDSA Curve Label § |
|
ECDSA_LOW Curve Label ¶ |
|
ESP Transform Suite IDs # |
|
Group IDs ♠ |
|
HI Algorithm ♥ |
|
HIT Suite IDs ♦ |
|
HIP NAT Traversal Modes ♣ |
|
Notify Message Types ** |
|
Packet Types †† |
|
Parameter Types ‡‡ |
|
Registration Types §§ |
|
Registration Failure Types ¶¶ |
|
Suite IDs ## |
|
HIP Transport Modes ♠♠ |
HIP Certificate Types¶
This module contains the constant enumeration for HIP Certificate Types,
which is automatically generated from pcapkit.vendor.hip.certificate.Certificate
.
- class pcapkit.const.hip.certificate.Certificate(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[Certificate] HIP Certificate Types
Cipher IDs¶
This module contains the constant enumeration for Cipher IDs,
which is automatically generated from pcapkit.vendor.hip.cipher.Cipher
.
- class pcapkit.const.hip.cipher.Cipher(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[Cipher] Cipher IDs
DI-Types¶
This module contains the constant enumeration for DI-Types,
which is automatically generated from pcapkit.vendor.hip.di.DITypes
.
- class pcapkit.const.hip.di.DITypes(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[DITypes] DI-Types
ECDSA Curve Label¶
This module contains the constant enumeration for ECDSA Curve Label,
which is automatically generated from pcapkit.vendor.hip.ecdsa_curve.ECDSACurve
.
- class pcapkit.const.hip.ecdsa_curve.ECDSACurve(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[ECDSACurve] ECDSA Curve Label
ECDSA_LOW Curve Label¶
This module contains the constant enumeration for ECDSA_LOW Curve Label,
which is automatically generated from pcapkit.vendor.hip.ecdsa_low_curve.ECDSALowCurve
.
- class pcapkit.const.hip.ecdsa_low_curve.ECDSALowCurve(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[ECDSALowCurve] ECDSA_LOW Curve Label
ESP Transform Suite IDs¶
This module contains the constant enumeration for ESP Transform Suite IDs,
which is automatically generated from pcapkit.vendor.hip.esp_transform_suite.ESPTransformSuite
.
- class pcapkit.const.hip.esp_transform_suite.ESPTransformSuite(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[ESPTransformSuite] ESP Transform Suite IDs
Group IDs¶
This module contains the constant enumeration for Group IDs,
which is automatically generated from pcapkit.vendor.hip.group.Group
.
- class pcapkit.const.hip.group.Group(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[Group] Group IDs
HI Algorithm¶
This module contains the constant enumeration for HI Algorithm,
which is automatically generated from pcapkit.vendor.hip.hi_algorithm.HIAlgorithm
.
- class pcapkit.const.hip.hi_algorithm.HIAlgorithm(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[HIAlgorithm] HI Algorithm
- Unassigned_2 = 2¶
Unassigned
- Unassigned_4 = 4¶
Unassigned
- Unassigned_6 = 6¶
Unassigned
- Unassigned_8 = 8¶
Unassigned
HIT Suite ID¶
This module contains the constant enumeration for HIT Suite ID,
which is automatically generated from pcapkit.vendor.hip.hit_suite.HITSuite
.
- class pcapkit.const.hip.hit_suite.HITSuite(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[HITSuite] HIT Suite ID
HIP NAT Traversal Modes¶
This module contains the constant enumeration for HIP NAT Traversal Modes,
which is automatically generated from pcapkit.vendor.hip.nat_traversal.NATTraversal
.
- class pcapkit.const.hip.nat_traversal.NATTraversal(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[NATTraversal] HIP NAT Traversal Modes
Notify Message Types¶
This module contains the constant enumeration for Notify Message Types,
which is automatically generated from pcapkit.vendor.hip.notify_message.NotifyMessage
.
- class pcapkit.const.hip.notify_message.NotifyMessage(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[NotifyMessage] Notify Message Types
- Unassigned_25 = 25¶
Unassigned
- Unassigned_27 = 27¶
Unassigned
- Unassigned_41 = 41¶
Unassigned
- Unassigned_43 = 43¶
Unassigned
- Unassigned_45 = 45¶
Unassigned
- Unassigned_47 = 47¶
Unassigned
- Unassigned_49 = 49¶
Unassigned
- SERVER_REFLEXIVE_CANDIDATE_ALLOCATION_FAILED = 63¶
SERVER_REFLEXIVE_CANDIDATE_ALLOCATION_FAILED [RFC 9028]
HIP Packet Types¶
This module contains the constant enumeration for HIP Packet Types,
which is automatically generated from pcapkit.vendor.hip.packet.Packet
.
- class pcapkit.const.hip.packet.Packet(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[Packet] HIP Packet Types
HIP Parameter Types¶
This module contains the constant enumeration for HIP Parameter Types,
which is automatically generated from pcapkit.vendor.hip.parameter.Parameter
.
- class pcapkit.const.hip.parameter.Parameter(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[Parameter] HIP Parameter Types
- Unassigned_512 = 512¶
Unassigned
- Unassigned_578 = 578¶
Unassigned
- Unassigned_609 = 609¶
Unassigned
- Unassigned_931 = 931¶
Unassigned
- Unassigned_933 = 933¶
Unassigned
- Unassigned_935 = 935¶
Unassigned
- Unassigned_65499 = 65499¶
Unassigned
- Unassigned_65501 = 65501¶
Unassigned
Registration Types¶
This module contains the constant enumeration for Registration Types,
which is automatically generated from pcapkit.vendor.hip.registration.Registration
.
- class pcapkit.const.hip.registration.Registration(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[Registration] Registration Types
- Unassigned_0 = 0¶
Unassigned
Registration Failure Types¶
This module contains the constant enumeration for Registration Failure Types,
which is automatically generated from pcapkit.vendor.hip.registration_failure.RegistrationFailure
.
- class pcapkit.const.hip.registration_failure.RegistrationFailure(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[RegistrationFailure] Registration Failure Types
- Registration_requires_additional_credentials = 0¶
Registration requires additional credentials [RFC 8003]
Registration type unavailable [RFC 8003]
- Simultaneous_Rendezvous_and_Control_Relay_Service_usage_prohibited = 9¶
Simultaneous Rendezvous and Control Relay Service usage prohibited [RFC 9028]
Suite IDs¶
This module contains the constant enumeration for Suite IDs,
which is automatically generated from pcapkit.vendor.hip.suite.Suite
.
- class pcapkit.const.hip.suite.Suite(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[Suite] Suite IDs
HIP Transport Modes¶
This module contains the constant enumeration for HIP Transport Modes,
which is automatically generated from pcapkit.vendor.hip.transport.Transport
.
- class pcapkit.const.hip.transport.Transport(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[Transport] HIP Transport Modes
- *
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#certificate-types
- †
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#hip-cipher-id
- ‡
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#hip-parameters-7
- §
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#ecdsa-curve-label
- ¶
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#ecdsa-low-curve-label
- #
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#esp-transform-suite-ids
- ♠
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#hip-parameters-5
- ♥
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#hi-algorithm
- ♦
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#hit-suite-id
- ♣
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#nat-traversal
- **
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#hip-parameters-9
- ††
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#hip-parameters-1
- ‡‡
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#hip-parameters-4
- §§
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#hip-parameters-11
- ¶¶
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#hip-parameters-13
- ##
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#hip-parameters-6
- ♠♠
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#transport-modes
IPv4
Constant Enumerations¶
This module contains all constant enumerations of
IPv4
implementations. Available
enumerations include:
Classification Level Encodings |
|
Option Classes |
|
IP Option Numbers * |
|
Protection Authority Bit Assignments |
|
QS Functions |
|
IPv4 Router Alert Option Values † |
|
ToS (DS Field) Delay |
|
ToS ECN Field |
|
|
ToS (DS Field) Precedence |
|
ToS (DS Field) Reliability |
|
ToS (DS Field) Throughput |
TS Flag |
Classification Level Encodings¶
This module contains the constant enumeration for Classification Level Encodings,
which is automatically generated from pcapkit.vendor.ipv4.classification_level.ClassificationLevel
.
- class pcapkit.const.ipv4.classification_level.ClassificationLevel(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[ClassificationLevel] Classification Level Encodings
- Reserved_4 = 1¶
- Top_Secret = 61¶
- Secret = 90¶
- Confidential = 150¶
- Reserved_3 = 102¶
- Reserved_2 = 204¶
- Unclassified = 171¶
- Reserved_1 = 241¶
Option Classes¶
This module contains the constant enumeration for Option Classes,
which is automatically generated from pcapkit.vendor.ipv4.option_class.OptionClass
.
- class pcapkit.const.ipv4.option_class.OptionClass(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[OptionClass] Option Classes
- control = 0¶
- reserved_for_future_use_1 = 1¶
- debugging_and_measurement = 2¶
- reserved_for_future_use_3 = 3¶
IP Option Numbers¶
This module contains the constant enumeration for IP Option Numbers,
which is automatically generated from pcapkit.vendor.ipv4.option_number.OptionNumber
.
- class pcapkit.const.ipv4.option_number.OptionNumber(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[OptionNumber] IP Option Numbers
- CIPSO = 134¶
CIPSO
, Commercial Security [draft-ietf-cipso-ipsecurity-01]
- ZSU = 10¶
ZSU
, Experimental Measurement [ZSu]
- FINN = 205¶
FINN
, Experimental Flow Control [Greg Finn]
- IMITD = 144¶
IMITD
, IMI Traffic Descriptor [Lee]
- Unassigned_150 = 150¶
Unassigned (Released 18 October 2005)
- class pcapkit.const.ipv4.protection_authority.ProtectionAuthority(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[ProtectionAuthority] Protection Authority Bit Assignments
- GENSER = 0¶
- SIOP_ESI = 1¶
- SCI = 2¶
- NSA = 3¶
- DOE = 4¶
- Unassigned_5 = 5¶
- Unassigned_6 = 6¶
- Field_Termination_Indicator = 7¶
QS Functions¶
This module contains the constant enumeration for QS Functions,
which is automatically generated from pcapkit.vendor.ipv4.qs_function.QSFunction
.
- class pcapkit.const.ipv4.qs_function.QSFunction(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[QSFunction] QS Functions
- Quick_Start_Request = 0¶
- Report_of_Approved_Rate = 8¶
IPv4 Router Alert Option Values¶
This module contains the constant enumeration for IPv4 Router Alert Option Values,
which is automatically generated from pcapkit.vendor.ipv4.router_alert.RouterAlert
.
- class pcapkit.const.ipv4.router_alert.RouterAlert(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[RouterAlert] IPv4 Router Alert Option Values
ToS (DS Field) Delay¶
This module contains the constant enumeration for ToS (DS Field) Delay,
which is automatically generated from pcapkit.vendor.ipv4.tos_del.ToSDelay
.
- class pcapkit.const.ipv4.tos_del.ToSDelay(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[ToSDelay] ToS (DS Field) Delay
- NORMAL = 0¶
- LOW = 1¶
ToS ECN Field¶
This module contains the constant enumeration for ToS ECN Field,
which is automatically generated from pcapkit.vendor.ipv4.tos_ecn.ToSECN
.
- class pcapkit.const.ipv4.tos_ecn.ToSECN(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[ToSECN] ToS ECN Field
- Not_ECT = 0¶
- ECT_0b01 = 1¶
- ECT_0b10 = 2¶
- CE = 3¶
ToS (DS Field) Precedence¶
This module contains the constant enumeration for ToS (DS Field) Precedence,
which is automatically generated from pcapkit.vendor.ipv4.tos_pre.ToSPrecedence
.
- class pcapkit.const.ipv4.tos_pre.ToSPrecedence(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[ToSPrecedence] ToS (DS Field) Precedence
- Network_Control = 7¶
- Internetwork_Control = 6¶
- CRITIC_ECP = 5¶
- Flash_Override = 4¶
- Flash = 3¶
- Immediate = 2¶
- Priority = 1¶
- Routine = 0¶
ToS (DS Field) Reliability¶
This module contains the constant enumeration for ToS (DS Field) Reliability,
which is automatically generated from pcapkit.vendor.ipv4.tos_rel.ToSReliability
.
- class pcapkit.const.ipv4.tos_rel.ToSReliability(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[ToSReliability] ToS (DS Field) Reliability
- NORMAL = 0¶
- HIGH = 1¶
ToS (DS Field) Throughput¶
This module contains the constant enumeration for ToS (DS Field) Throughput,
which is automatically generated from pcapkit.vendor.ipv4.tos_thr.ToSThroughput
.
- class pcapkit.const.ipv4.tos_thr.ToSThroughput(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[ToSThroughput] ToS (DS Field) Throughput
- NORMAL = 0¶
- HIGH = 1¶
TS Flag¶
This module contains the constant enumeration for TS Flag,
which is automatically generated from pcapkit.vendor.ipv4.ts_flag.TSFlag
.
- class pcapkit.const.ipv4.ts_flag.TSFlag(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[TSFlag] TS Flag
- Timestamp_Only = 0¶
- IP_with_Timestamp = 1¶
- Prespecified_IP_with_Timestamp = 3¶
IPv6
Constant Enumerations¶
This module contains all constant enumerations of
IPv6
implementations. Available
enumerations include:
IPv6 Extension Header Types * |
|
Destination Options and Hop-by-Hop Options † |
|
IPv6 QS Functions |
|
IPv6 Router Alert Option Values ‡ |
|
Routing Types § |
|
Seed-ID Types |
|
Simplified Multicast Forwarding Duplicate Packet Detection ( |
|
Tagger-ID Types ¶ |
IPv6 Extension Header Types¶
This module contains the constant enumeration for IPv6 Extension Header Types,
which is automatically generated from pcapkit.vendor.ipv6.extension_header.ExtensionHeader
.
- class pcapkit.const.ipv6.extension_header.ExtensionHeader(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[ExtensionHeader] IPv6 Extension Header Types
- IPv6_Route = 43¶
IPv6-Route, Routing Header for IPv6 [Steve Deering]
- IPv6_Frag = 44¶
IPv6-Frag, Fragment Header for IPv6 [Steve Deering]
Destination Options and Hop-by-Hop Options¶
This module contains the constant enumeration for Destination Options and Hop-by-Hop Options,
which is automatically generated from pcapkit.vendor.ipv6.option.Option
.
- class pcapkit.const.ipv6.option.Option(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[Option] Destination Options and Hop-by-Hop Options
- Endpoint_Identification = 138¶
Endpoint Identification (DEPRECATED) [CHARLES LYNN]
- Path_MTU_Record_Option = 48¶
Path MTU Record Option [RFC-ietf-6man-mtu-option-15]
- IOAM_0x11 = 17¶
IOAM (TEMPORARY - registered 2020-04-16, extension registered 2022-04-12, expires 2023-04-16) [draft-ietf-ippm-ioam-ipv6-options-05]
- IOAM_0x31 = 49¶
IOAM (TEMPORARY - registered 2020-04-16, extension registered 2022-04-12, expires 2023-04-16) [draft-ietf-ippm-ioam-ipv6-options-05]
QS Functions¶
This module contains the constant enumeration for QS Functions,
which is automatically generated from pcapkit.vendor.ipv6.qs_function.QSFunction
.
- class pcapkit.const.ipv6.qs_function.QSFunction(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[QSFunction] QS Functions
- Quick_Start_Request = 0¶
- Report_of_Approved_Rate = 8¶
IPv6 Router Alert Option Values¶
This module contains the constant enumeration for IPv6 Router Alert Option Values,
which is automatically generated from pcapkit.vendor.ipv6.router_alert.RouterAlert
.
- class pcapkit.const.ipv6.router_alert.RouterAlert(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[RouterAlert] IPv6 Router Alert Option Values
- Datagram_contains_a_Multicast_Listener_Discovery_message = 0¶
Datagram contains a Multicast Listener Discovery message [RFC 2710]
- Datagram_contains_an_Active_Networks_message = 2¶
Datagram contains an Active Networks message [RFC 2711]
- Reserved_65535 = 65535¶
Reserved [The Internet Assigned Numbers Authority]
IPv6 Routing Types¶
This module contains the constant enumeration for IPv6 Routing Types,
which is automatically generated from pcapkit.vendor.ipv6.routing.Routing
.
- class pcapkit.const.ipv6.routing.Routing(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[Routing] IPv6 Routing Types
- Nimrod(DEPRECATED 2009-05-06) = 1¶
Nimrod (DEPRECATED 2009-05-06)
- CRH_16 = 5¶
CRH-16 (TEMPORARY - registered 2021-06-07, extension registered 2022-04-25, expires 2023-06-07) [draft-bonica-6man-comp-rtg-hdr-26]
- CRH_32 = 6¶
CRH-32 (TEMPORARY - registered 2021-06-07, extension registered 2022-04-25, expires 2023-06-07) [draft-bonica-6man-comp-rtg-hdr-26]
- Reserved_255 = 255¶
Reserved
Seed-ID Types¶
This module contains the constant enumeration for Seed-ID Types,
which is automatically generated from pcapkit.vendor.ipv6.seed_id.SeedID
.
- class pcapkit.const.ipv6.seed_id.SeedID(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[SeedID] Seed-ID Types
- IPV6_SOURCE_ADDRESS = 0¶
- SEEDID_16_BIT_UNSIGNED_INTEGER = 1¶
- SEEDID_64_BIT_UNSIGNED_INTEGER = 2¶
- SEEDID_128_BIT_UNSIGNED_INTEGER = 3¶
Simplified Multicast Forwarding Duplicate Packet Detection (SMF_DPD
) Options¶
This module contains the constant enumeration for Simplified Multicast Forwarding Duplicate Packet Detection (``SMF_DPD``) Options,
which is automatically generated from pcapkit.vendor.ipv6.smf_dpd_mode.SMFDPDMode
.
- class pcapkit.const.ipv6.smf_dpd_mode.SMFDPDMode(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[SMFDPDMode] Simplified Multicast Forwarding Duplicate Packet Detection (
SMF_DPD
) Options- I_DPD = 0¶
- H_DPD = 1¶
TaggerID Types¶
This module contains the constant enumeration for TaggerID Types,
which is automatically generated from pcapkit.vendor.ipv6.tagger_id.TaggerID
.
- class pcapkit.const.ipv6.tagger_id.TaggerID(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[TaggerID] TaggerID Types
- *
https://www.iana.org/assignments/ipv6-parameters/ipv6-parameters.xhtml#extension-header
- †
https://www.iana.org/assignments/ipv6-parameters/ipv6-parameters.xhtml#ipv6-parameters-2
- ‡
- §
https://www.iana.org/assignments/ipv6-parameters/ipv6-parameters.xhtml#ipv6-parameters-3
- ¶
https://www.iana.org/assignments/ipv6-parameters/ipv6-parameters.xhtml#taggerId-types
IPX
Constant Enumerations¶
This module contains all constant enumerations of
IPX
implementations. Available
enumerations include:
IPX Packet Types * |
|
IPX Socket Types † |
IPX Packet Types¶
This module contains the constant enumeration for IPX Packet Types,
which is automatically generated from pcapkit.vendor.ipx.packet.Packet
.
- class pcapkit.const.ipx.packet.Packet(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[Packet] IPX Packet Types
- Unknown = 0¶
Unknown
- Echo_Packet = 2¶
Echo Packet
- Error_Packet = 3¶
Error Packet
- PEP = 4¶
PEP
, Packet Exchange Protocol, used for SAP (Service Advertising Protocol)
- SPX = 5¶
SPX
, Sequenced Packet Exchange
- NCP = 17¶
NCP
, NetWare Core Protocol
Socket Types¶
This module contains the constant enumeration for Socket Types,
which is automatically generated from pcapkit.vendor.ipx.socket.Socket
.
- class pcapkit.const.ipx.socket.Socket(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[Socket] Socket Types
- Routing_Information_Packet = 1¶
Routing Information Packet
- Echo_Protocol_Packet = 2¶
Echo Protocol Packet
- Error_Handling_Packet = 3¶
Error Handling Packet
- NetWare_Core_Protocol = 1105¶
NetWare Core Protocol, NCP – used by Novell NetWare servers
- Service_Advertising_Protocol = 1106¶
Service Advertising Protocol, SAP
- Routing_Information_Protocol = 1107¶
Routing Information Protocol, RIP
- NetBIOS = 1109¶
NetBIOS
- Diagnostic_Packet = 1110¶
Diagnostic Packet
- Serialization_Packet = 1111¶
Serialization Packet, used for NCP as well
- Used_by_Novell_NetWare_Client = 16387¶
Used by Novell NetWare Client
- IPX = 32864¶
IPX
- TCP_over_IPXF = 37009¶
TCP over IPXF
- UDP_over_IPXF = 37010¶
UDP over IPXF
- IPXF = 37011¶
IPXF, IPX Fragmentation Protocol
MH
Constant Enumerations¶
This module contains all constant enumerations of
MH
implementations. Available
enumerations include:
Mobility Header Types * |
Mobility Header Types - for the MH Type field in the Mobility Header¶
This module contains the constant enumeration for Mobility Header Types - for the MH Type field in the Mobility Header,
which is automatically generated from pcapkit.vendor.mh.packet.Packet
.
- class pcapkit.const.mh.packet.Packet(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[Packet] Mobility Header Types - for the MH Type field in the Mobility Header
Transport Layer¶
TCP
Constant Enumerations¶
This module contains all constant enumerations of
TCP
implementations. Available
enumerations include:
TCP Checksum * |
|
|
Multipath TCP options † |
|
TCP Option Kind Numbers |
TCP Checksum¶
This module contains the constant enumeration for TCP Checksum,
which is automatically generated from pcapkit.vendor.tcp.checksum.Checksum
.
- class pcapkit.const.tcp.checksum.Checksum(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[Checksum] TCP Checksum [RFC 1146]
- TCP_checksum = 0¶
- Checksum_8_bit_Fletcher_s_algorithm = 1¶
- Checksum_16_bit_Fletcher_s_algorithm = 2¶
- Redundant_Checksum_Avoidance = 3¶
Multipath TCP options¶
This module contains the constant enumeration for Multipath TCP options,
which is automatically generated from pcapkit.vendor.tcp.mp_tcp_option.MPTCPOption
.
- class pcapkit.const.tcp.mp_tcp_option.MPTCPOption(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[MPTCPOption] Multipath TCP options [RFC 6824]
- MP_CAPABLE = 0¶
- MP_JOIN = 1¶
- DSS = 2¶
- ADD_ADDR = 3¶
- REMOVE_ADDR = 4¶
- MP_PRIO = 5¶
- MP_FAIL = 6¶
- MP_FASTCLOSE = 7¶
TCP Option Kind Numbers¶
This module contains the constant enumeration for TCP Option Kind Numbers,
which is automatically generated from pcapkit.vendor.tcp.option.Option
.
- class pcapkit.const.tcp.option.Option(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[Option] TCP Option Kind Numbers
- End_of_Option_List = 0¶
End of Option List [RFC-ietf-tcpm-rfc793bis-28]
- No_Operation = 1¶
No-Operation [RFC-ietf-tcpm-rfc793bis-28]
- Maximum_Segment_Size = 2¶
Maximum Segment Size [RFC-ietf-tcpm-rfc793bis-28]
- Partial_Order_Connection_Permitted = 9¶
Partial Order Connection Permitted (obsolete) [RFC 1693][RFC 6247]
- Skeeter = 16¶
Skeeter [Stev Knowles]
- Bubba = 17¶
Bubba [Stev Knowles]
- Trailer_Checksum_Option = 18¶
Trailer Checksum Option [Subbu Subramaniam][Monroe Bridges]
- SCPS_Capabilities = 20¶
SCPS Capabilities [Keith Scott]
- Selective_Negative_Acknowledgements = 21¶
Selective Negative Acknowledgements [Keith Scott]
- Record_Boundaries = 22¶
Record Boundaries [Keith Scott]
- Corruption_experienced = 23¶
Corruption experienced [Keith Scott]
- SNAP = 24¶
SNAP [Vladimir Sukonnik]
- Unassigned_25 = 25¶
Unassigned (released 2000-12-18)
- TCP_Compression_Filter = 26¶
TCP Compression Filter [Steve Bellovin]
- User_Timeout_Option = 28¶
User Timeout Option (also, other known unauthorized use) [***][1] [RFC 5482]
- Reserved_31 = 31¶
Reserved (known unauthorized use without proper IANA assignment) [**]
- Reserved_32 = 32¶
Reserved (known unauthorized use without proper IANA assignment) [**]
- Reserved_33 = 33¶
Reserved (known unauthorized use without proper IANA assignment) [**]
- Reserved_70 = 70¶
Reserved (known unauthorized use without proper IANA assignment) [**]
- Reserved_76 = 76¶
Reserved (known unauthorized use without proper IANA assignment) [**]
- Reserved_77 = 77¶
Reserved (known unauthorized use without proper IANA assignment) [**]
- Reserved_78 = 78¶
Reserved (known unauthorized use without proper IANA assignment) [**]
- RFC3692_style_Experiment_1 = 253¶
RFC3692-style Experiment 1 (also improperly used for shipping products) [*] [RFC 4727]
Application Layer¶
FTP
Constant Enumerations¶
This module contains all constant enumerations of
FTP
implementations. Available
enumerations include:
|
FTP Commands * |
FTP Return Codes † |
FTP Command¶
This module contains the constant enumeration for FTP Command,
which is automatically generated from pcapkit.vendor.ftp.command.Command
.
- pcapkit.const.ftp.command.Command: defaultInfo[CommandType]¶
FTP commands.
- class pcapkit.const.ftp.command.CommandType(*args, **kwargs)[source]¶
Bases:
Info
FTP command type.
- Parameters
args (VT) –
kwargs (VT) –
- Return type
- class pcapkit.const.ftp.command.defaultInfo(*args, **kwargs)[source]¶
Bases:
Info
[CommandType
]Extended
Info
with default values.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
FTP Server Return Code¶
This module contains the constant enumeration for FTP Server Return Code,
which is automatically generated from pcapkit.vendor.ftp.return_code.ReturnCode
.
- class pcapkit.const.ftp.return_code.ReturnCode(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[ReturnCode] FTP Server Return Code
- CODE_110 = 110¶
Restart marker replay. In this case, the text is exact and not left to the particular implementation; it must read: MARK yyyy = mmmm where yyyy is User-process data stream marker, and mmmm server’s equivalent marker (note the spaces between markers and “=”).
- CODE_120 = 120¶
Service ready in nnn minutes.
- CODE_125 = 125¶
Data connection already open; transfer starting.
- CODE_150 = 150¶
File status okay; about to open data connection.
- CODE_202 = 202¶
Command not implemented, superfluous at this site.
- CODE_211 = 211¶
System status, or system help reply.
- CODE_212 = 212¶
Directory status.
- CODE_213 = 213¶
File status.
- CODE_214 = 214¶
Help message. Explains how to use the server or the meaning of a particular non-standard command. This reply is useful only to the human user.
- CODE_215 = 215¶
NAME system type. Where NAME is an official system name from the registry kept by IANA.
- CODE_220 = 220¶
Service ready for new user.
- CODE_221 = 221¶
Service closing control connection.
- CODE_225 = 225¶
Data connection open; no transfer in progress.
- CODE_226 = 226¶
Closing data connection. Requested file action successful (for example, file transfer or file abort).
- CODE_227 = 227¶
Entering Passive Mode (h1,h2,h3,h4,p1,p2).
- CODE_228 = 228¶
Entering Long Passive Mode (long address, port).
- CODE_229 = 229¶
Entering Extended Passive Mode (|||port|).
- CODE_230 = 230¶
User logged in, proceed. Logged out if appropriate.
- CODE_231 = 231¶
User logged out; service terminated.
- CODE_232 = 232¶
Logout command noted, will complete when transfer done.
- CODE_234 = 234¶
Specifies that the server accepts the authentication mechanism specified by the client, and the exchange of security data is complete. A higher level nonstandard code created by Microsoft.
- CODE_250 = 250¶
Requested file action okay, completed.
- CODE_257 = 257¶
“PATHNAME” created.
- CODE_331 = 331¶
User name okay, need password.
- CODE_332 = 332¶
Need account for login.
- CODE_350 = 350¶
Requested file action pending further information
- CODE_421 = 421¶
Service not available, closing control connection. This may be a reply to any command if the service knows it must shut down.
- CODE_425 = 425¶
Can’t open data connection.
- CODE_426 = 426¶
Connection closed; transfer aborted.
- CODE_430 = 430¶
Invalid username or password
- CODE_434 = 434¶
Requested host unavailable.
- CODE_450 = 450¶
Requested file action not taken.
- CODE_451 = 451¶
Requested action aborted. Local error in processing.
- CODE_452 = 452¶
Requested action not taken. Insufficient storage space in system. File unavailable (e.g., file busy).
- CODE_501 = 501¶
Syntax error in parameters or arguments.
- CODE_502 = 502¶
Command not implemented.
- CODE_503 = 503¶
Bad sequence of commands.
- CODE_504 = 504¶
Command not implemented for that parameter.
- CODE_530 = 530¶
Not logged in.
- CODE_532 = 532¶
Need account for storing files.
- CODE_534 = 534¶
Could Not Connect to Server - Policy Requires SSL
- CODE_550 = 550¶
Requested action not taken. File unavailable (e.g., file not found, no access).
- CODE_551 = 551¶
Requested action aborted. Page type unknown.
- CODE_552 = 552¶
Requested file action aborted. Exceeded storage allocation (for current directory or dataset).
- CODE_553 = 553¶
Requested action not taken. File name not allowed.
- CODE_631 = 631¶
Integrity protected reply.
- CODE_632 = 632¶
Confidentiality and integrity protected reply.
- CODE_633 = 633¶
Confidentiality protected reply.
HTTP
Constant Enumerations¶
This module contains all constant enumerations of
HTTP
implementations. Available
enumerations include:
HTTP/2 Error Code * |
|
HTTP/2 Frame Type † |
|
HTTP/2 Settings ‡ |
HTTP/2 Error Code¶
This module contains the constant enumeration for HTTP/2 Error Code,
which is automatically generated from pcapkit.vendor.http.error_code.ErrorCode
.
- class pcapkit.const.http.error_code.ErrorCode(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[ErrorCode] HTTP/2 Error Code
- NO_ERROR = 0¶
NO_ERROR, Graceful shutdown [:rfc:`9113, Section 7`]
- PROTOCOL_ERROR = 1¶
PROTOCOL_ERROR, Protocol error detected [:rfc:`9113, Section 7`]
- INTERNAL_ERROR = 2¶
INTERNAL_ERROR, Implementation fault [:rfc:`9113, Section 7`]
- FLOW_CONTROL_ERROR = 3¶
FLOW_CONTROL_ERROR, Flow-control limits exceeded [:rfc:`9113, Section 7`]
- SETTINGS_TIMEOUT = 4¶
SETTINGS_TIMEOUT, Settings not acknowledged [:rfc:`9113, Section 7`]
- STREAM_CLOSED = 5¶
STREAM_CLOSED, Frame received for closed stream [:rfc:`9113, Section 7`]
- FRAME_SIZE_ERROR = 6¶
FRAME_SIZE_ERROR, Frame size incorrect [:rfc:`9113, Section 7`]
- REFUSED_STREAM = 7¶
REFUSED_STREAM, Stream not processed [:rfc:`9113, Section 7`]
- CANCEL = 8¶
CANCEL, Stream cancelled [:rfc:`9113, Section 7`]
- COMPRESSION_ERROR = 9¶
COMPRESSION_ERROR, Compression state not updated [:rfc:`9113, Section 7`]
- CONNECT_ERROR = 10¶
9113, Section 7]
- Type
CONNECT_ERROR, TCP connection error for CONNECT method [
- Type
rfc
- ENHANCE_YOUR_CALM = 11¶
ENHANCE_YOUR_CALM, Processing capacity exceeded [:rfc:`9113, Section 7`]
- INADEQUATE_SECURITY = 12¶
9113, Section 7]
- Type
INADEQUATE_SECURITY, Negotiated TLS parameters not acceptable [
- Type
rfc
- HTTP_1_1_REQUIRED = 13¶
HTTP_1_1_REQUIRED, Use HTTP/1.1 for the request [:rfc:`9113, Section 7`]
HTTP/2 Frame Type¶
This module contains the constant enumeration for HTTP/2 Frame Type,
which is automatically generated from pcapkit.vendor.http.frame.Frame
.
- class pcapkit.const.http.frame.Frame(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[Frame] HTTP/2 Frame Type
- DATA = 0¶
DATA
[:rfc:`9113, Section 6.1`]
- HEADERS = 1¶
HEADERS
[:rfc:`9113, Section 6.2`]
- PRIORITY = 2¶
PRIORITY
[:rfc:`9113, Section 6.3`]
- RST_STREAM = 3¶
RST_STREAM
[:rfc:`9113, Section 6.4`]
- SETTINGS = 4¶
SETTINGS
[:rfc:`9113, Section 6.5`]
- PUSH_PROMISE = 5¶
PUSH_PROMISE
[:rfc:`9113, Section 6.6`]
- PING = 6¶
PING
[:rfc:`9113, Section 6.7`]
- GOAWAY = 7¶
GOAWAY
[:rfc:`9113, Section 6.8`]
- WINDOW_UPDATE = 8¶
WINDOW_UPDATE
[:rfc:`9113, Section 6.9`]
- CONTINUATION = 9¶
CONTINUATION
[:rfc:`9113, Section 6.10`]
- ALTSVC = 10¶
ALTSVC
[:rfc:`7838, Section 4`]
- Unassigned_0x0B = 11¶
Unassigned
HTTP/2 Settings¶
This module contains the constant enumeration for HTTP/2 Settings,
which is automatically generated from pcapkit.vendor.http.setting.Setting
.
- class pcapkit.const.http.setting.Setting(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
[Setting] HTTP/2 Settings
- HEADER_TABLE_SIZE = 1¶
- Type
HEADER_TABLE_SIZE
[:rfc:`9113, Section 6.5.2`] (Initial Value
- ENABLE_PUSH = 2¶
- Type
ENABLE_PUSH
[:rfc:`9113, Section 6.5.2`] (Initial Value
- MAX_CONCURRENT_STREAMS = 3¶
MAX_CONCURRENT_STREAMS
[:rfc:`9113, Section 6.5.2`] (Initial Value: infinite)
- INITIAL_WINDOW_SIZE = 4¶
- Type
INITIAL_WINDOW_SIZE
[:rfc:`9113, Section 6.5.2`] (Initial Value
- MAX_FRAME_SIZE = 5¶
- Type
MAX_FRAME_SIZE
[:rfc:`9113, Section 6.5.2`] (Initial Value
- MAX_HEADER_LIST_SIZE = 6¶
MAX_HEADER_LIST_SIZE
[:rfc:`9113, Section 6.5.2`] (Initial Value: infinite)
- Unassigned_0x0007 = 7¶
Unassigned
- SETTINGS_ENABLE_CONNECT_PROTOCOL = 8¶
- Type
SETTINGS_ENABLE_CONNECT_PROTOCOL
[RFC 8441] (Initial Value
- TLS_RENEG_PERMITTED = 16¶
TLS_RENEG_PERMITTED
[MS-HTTP2E][Gabriel Montenegro] (Initial Value: 0x00)
Vendor Crawlers¶
This module contains all web crawlers of pcapkit
, which are
automatically generating from the pcapkit.const
module’s constant
enumerations.
Base Crawler¶
Base Crawler¶
pcapkit.vendor.default
contains Vendor
only, which is the base meta class for all vendor crawlers.
Vendor Crawler¶
- class pcapkit.vendor.default.Vendor[source]¶
Bases:
object
Default vendor generator.
Inherit this class with
FLAG
&LINK
attributes, etc., to implement a new vendor generator.- Return type
- static __new__(cls)[source]¶
Subclassing checkpoint.
- Raises
VendorNotImplemented – If
cls
is not a subclass ofVendor
.- Return type
- rename(name, code, *, original=None)[source]¶
Rename duplicated fields.
- Parameters
- Return type
- Returns
Revised field name.
Example
If
name
has multiple occurrences in the source registry, the field name will be sanitised as${name}_${code}
.Otherwise, the plain
name
will be returned.
- _request()[source]¶
Fetch CSV data from
LINK
.This is the low-level call of
request()
.If
LINK
isNone
, it will directly call the upper methodrequest()
with NO arguments.The method will first try to GET the content of
LINK
. Should any exception raised, it will first try with proxy settings fromget_proxies()
.Note
Since some
LINK
links are from Wikipedia, etc., they might not be available in certain areas, e.g. the amazing PRC :)Would proxies failed again, it will prompt for user intervention, i.e. it will use
webbrowser.open()
to open the page in browser for you, and you can manually load that page and save the HTML source at the location it provides.- Returns
CSV data.
- Warns
VendorRequestWarning – If connection failed with and/or without proxies.
- Return type
See also
Crawler Template¶
- pcapkit.vendor.default.LINE(NAME, DOCS, FLAG, ENUM, MISS, MODL)¶
Default constant template of enumeration registry from IANA CSV.
- Parameters
NAME (str) – name of the constant enumeration class
DOCS (str) – docstring for the constant enumeration class
FLAG (str) – threshold value validator (range of valid values)
ENUM (str) – enumeration data (class attributes)
MISS (str) – missing value handler (default value)
MODL (str) – module name of the constant enumeration class
- Return type
Crawler Proxy¶
Protocol Numbers¶
Protocol Type Registry Vendor Crawlers¶
This module contains all vendor crawlers of protocol type registry implementations. Available enumerations include:
|
Link-Layer Header Type Values * |
|
Ethertype IEEE 802 Numbers † |
|
Transport Layer Protocol Numbers ‡ |
Ethertype IEEE 802 Numbers¶
This module contains the vendor crawler for Ethertype IEEE 802 Numbers,
which is automatically generating pcapkit.const.reg.ethertype.EtherType
.
- class pcapkit.vendor.reg.ethertype.EtherType[source]
Bases:
Vendor
Ethertype IEEE 802 Numbers
- Return type
- FLAG: str = 'isinstance(value, int) and 0x0000 <= value <= 0xFFFF'
Value limit checker.
- LINK: str = 'https://www.iana.org/assignments/ieee-802-numbers/ieee-802-numbers-1.csv'
Link to registry.
Link Layer¶
ARP
Vendor Crawlers¶
This module contains all vendor crawlers of ARP
and RARP
implementations. Available
vendor crawlers include:
|
ARP Hardware Types * |
|
Operation Codes † |
L2TP
Vendor Crawlers¶
This module contains all vendor crawlers of
L2TP
implementations. Available
enumerations include:
|
L2TP Types |
OSPF
Vendor Crawlers¶
This module contains all vendor crawlers of
OSPF
implementations. Available
enumerations include:
|
Authentication Codes * |
|
OSPF Packet Types † |
VLAN
Vendor Crawlers¶
This module contains all vendor crawlers of
VLAN
implementations. Available
enumerations include:
|
Priority Levels * |
Internet Layer¶
HIP
Vendor Crawlers¶
This module contains all vendor crawlers of
HIP
implementations. Available
crawlers include:
|
HIP Certificate Types * |
|
HIP Cipher IDs † |
|
DI-Types ‡ |
|
ECDSA Curve Label § |
|
ECDSA_LOW Curve Label ¶ |
|
ESP Transform Suite IDs # |
|
Group IDs ♠ |
|
HI Algorithm ♥ |
|
HIT Suite IDs ♦ |
|
HIP NAT Traversal Modes ♣ |
|
Notify Message Types ** |
|
Packet Types †† |
|
Parameter Types ‡‡ |
|
Registration Types §§ |
|
Registration Failure Types ¶¶ |
|
Suite IDs ## |
|
HIP Transport Modes ♠♠ |
- *
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#certificate-types
- †
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#hip-cipher-id
- ‡
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#hip-parameters-7
- §
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#ecdsa-curve-label
- ¶
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#ecdsa-low-curve-label
- #
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#esp-transform-suite-ids
- ♠
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#hip-parameters-5
- ♥
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#hi-algorithm
- ♦
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#hit-suite-id
- ♣
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#nat-traversal
- **
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#hip-parameters-9
- ††
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#hip-parameters-1
- ‡‡
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#hip-parameters-4
- §§
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#hip-parameters-11
- ¶¶
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#hip-parameters-13
- ##
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#hip-parameters-6
- ♠♠
https://www.iana.org/assignments/hip-parameters/hip-parameters.xhtml#transport-modes
IPv4
Vendor Crawlers¶
This module contains all vendor crawlers of
IPv4
implementations. Available
crawlers include:
|
Classification Level Encodings |
|
Option Classes |
|
IP Option Numbers * |
|
Protection Authority Bit Assignments |
|
QS Functions |
|
IPv4 Router Alert Option Values † |
|
ToS (DS Field) Delay |
|
ToS ECN Field |
|
ToS (DS Field) Precedence |
|
ToS (DS Field) Reliability |
|
ToS (DS Field) Throughput |
IPv6
Vendor Crawlers¶
This module contains all vendor crawlers of
IPv6
implementations. Available
crawlers include:
|
IPv6 Extension Header Types * |
|
Destination Options and Hop-by-Hop Options † |
|
IPv6 QS Functions |
|
IPv6 Router Alert Option Values ‡ |
|
Routing Types § |
|
Seed-ID Types |
|
Simplified Multicast Forwarding Duplicate Packet Detection ( |
|
Tagger-ID Types ¶ |
- *
https://www.iana.org/assignments/ipv6-parameters/ipv6-parameters.xhtml#extension-header
- †
https://www.iana.org/assignments/ipv6-parameters/ipv6-parameters.xhtml#ipv6-parameters-2
- ‡
- §
https://www.iana.org/assignments/ipv6-parameters/ipv6-parameters.xhtml#ipv6-parameters-3
- ¶
https://www.iana.org/assignments/ipv6-parameters/ipv6-parameters.xhtml#taggerId-types
IPX
Vendor Crawlers¶
This module contains all vendor crawlers of
IPX
implementations. Available
crawlers include:
|
IPX Packet Types * |
|
IPX Socket Types † |
MH
Vendor Crawlers¶
This module contains all vendor crawlers of
MH
implementations. Available
enumerations include:
|
Mobility Header Types * |
Transport Layer¶
Application Layer¶
FTP
Vendor Crawler¶
This module contains all vendor crawlers of
FTP
implementations. Available
crawlers include:
|
FTP Commands * |
|
FTP Return Codes † |
HTTP
Venddor Crawlers¶
This module contains all vendor crawlers of
HTTP
implementations. Available
vendor crawlers include:
|
HTTP/2 Error Code * |
|
HTTP/2 Frame Type † |
|
HTTP/2 Settings ‡ |
usage: pcapkit-vendor [-h] [-V] ...
update constant enumerations
positional arguments:
target update targets, supply none to update all
optional arguments:
-h, --help show this help message and exit
-V, --version show program's version number and exit
Command Line Tool¶
Important
This module requires emoji
package to be installed.
pcapkit.__main__
was originally the module file of
jspcapy
, which is now deprecated and merged with pcapkit
.
usage: pcapkit-cli [-h] [-V] [-o file-name] [-f format] [-j] [-p] [-t] [-a]
[-v] [-F] [-E PKG] [-P PROTOCOL] [-L LAYER]
input-file-name
PCAP file extractor and formatted dumper
positional arguments:
input-file-name The name of input pcap file. If ".pcap" omits, it will
be automatically appended.
optional arguments:
-h, --help show this help message and exit
-V, --version show program's version number and exit
-o file-name, --output file-name
The name of input pcap file. If format extension
omits, it will be automatically appended.
-f format, --format format
Print a extraction report in the specified output
format. Available are all formats supported by
dictdumper, e.g.: json, plist, and tree.
-j, --json Display extraction report as json. This will yield
"raw" output that may be used by external tools. This
option overrides all other options.
-p, --plist Display extraction report as macOS Property List
(plist). This will yield "raw" output that may be used
by external tools. This option overrides all other
options.
-t, --tree Display extraction report as tree view text. This will
yield "raw" output that may be used by external tools.
This option overrides all other options.
-a, --auto-extension If output file extension omits, append automatically.
-v, --verbose Show more information.
-F, --files Split each frame into different files.
-E PKG, --engine PKG Indicate extraction engine. Note that except default
or pcapkit engine, all other engines need support of
corresponding packages.
-P PROTOCOL, --protocol PROTOCOL
Indicate extraction stops after which protocol.
-L LAYER, --layer LAYER
Indicate extract frames until which layer.
Library Index¶
pcapkit
has defined various and numerous functions
and classes, which have different features and purposes.
To make a simple index for this library, pcapkit.all
contains all things from pcapkit
.
How to …¶
Basic Samples¶
pcapkit
is quite easy to use, with simply three verbs as
its main interface. Several scenarios are shown as below.
extract a PCAP file and dump the result to a specific file (with no reassembly)
from pcapkit import extract # dump to a PLIST file with no frame storage (property frame disabled) plist = extract(fin='in.pcap', fout='out.plist', format='plist', store=False) # dump to a JSON file with no extension auto-complete json = extract(fin='in.cap', fout='out.json', format='json', extension=False) # dump to a folder with each tree-view text file per frame tree = extract(fin='in.pcap', fout='out', format='tree', files=True)
extract a PCAP file and fetch IP packet (both IPv4 and IPv6) from a frame (with no output file)
from pcapkit import IP, extract extraction = extract(fin='in.pcap', nofile=True) frame0 = extraction.frame[0] # check if IP (IPv4 or IPv6) in this frame flag = IP in frame0 if IP in frame0: # fetch the IP packet from this frame ip = frame0[IP]
extract a PCAP file and reassemble TCP payload (with no output file nor frame storage)
from pcapkit import HTTP, extract # set strict to make sure full reassembly extraction = extract(fin='in.pcap', store=False, nofile=True, tcp=True, strict=True) # print extracted packet if HTTP in reassembled payloads for datagram in extraction.reassembly.tcp: if datagram.packet is not None and HTTP in datagram.packet: print(datagram.packet[HTTP])
CLI Samples¶
The CLI (command line interface) of pcapkit
has two different access.
through console scripts
Use command name
pcapkit-cli [...]
directly (as shown in samples).through Python module
python -m pypcapkit [...]
works exactly the same as above.
Here are some usage samples:
export to a macOS Property List (Xcode has special support for this format)
$ pcapkit-cli in --format plist --verbose 🚨Loading file 'in.pcap' Frame 1: Ethernet:IPv6:IPv6_ICMP Frame 2: Ethernet:IPv6:IPv6_ICMP Frame 3: Ethernet:IPv4:TCP Frame 4: Ethernet:IPv4:TCP Frame 5: Ethernet:IPv4:TCP Frame 6: Ethernet:IPv4:UDP:Raw 🍺Report file stored in 'out.plist'
export to a JSON file (with no format specified)
$ pcapkit-cli in --output out.json --verbose 🚨Loading file 'in.pcap' Frame 1: Ethernet:IPv6:IPv6_ICMP Frame 2: Ethernet:IPv6:IPv6_ICMP Frame 3: Ethernet:IPv4:TCP Frame 4: Ethernet:IPv4:TCP Frame 5: Ethernet:IPv4:TCP Frame 6: Ethernet:IPv4:UDP:Raw 🍺Report file stored in 'out.json'
export to a text tree view file (without extension autocorrect)
$ pcapkit-cli in --output out.txt --format tree --verbose 🚨Loading file 'in.pcap' Frame 1: Ethernet:IPv6:IPv6_ICMP Frame 2: Ethernet:IPv6:IPv6_ICMP Frame 3: Ethernet:IPv4:TCP Frame 4: Ethernet:IPv4:TCP Frame 5: Ethernet:IPv4:TCP Frame 6: Ethernet:IPv4:UDP:Raw 🍺Report file stored in 'out.txt'
Help Wanted¶
Important
This is a copy of the discussion thread started on the GitHub. The documentation is only used as a backup reference to the original discussion thread.
As PyPCAPKit reaches its 16k lines of code and 800th commit, I figure it would be a better idea to record the project enchancement proposals here in the discussion thread. The proposals and/or notes will be documented and maintained here.
Pull requests for the existing proposals and any new ideas are highly welcomed and encouraged. Should you have any questions, please leave a note either in this thread or under the Q&A category discussions.
Wish you enjoy PyPCAPKit!!!
More Protocols, More!!!¶
As you may have noticed, there are some protocol-named files under the
NotImplemented
folders. These protocols are what I planned to implement
but not yet done. Namely, grouped by each TCP/IP layer and ordered by protocol
name alphabetically,
Link Layer: DSL, EAPOL, FDDI, ISDN, PPP
Internet Layer: ECN, ESP, ICMP, ICMPv6, IGMP, NDP, Shim6
Transport Layer: DCCP, QUIC, RSVP, SCTP
Application Layer: BGP, DHCP, DHCPv6, DNS, IMAP, LDAP, MQTT, NNTP, NTP, ONC/RPC, POP, RIP, RTP, SIP, SMTP, SNMP, SSH, Telnet, TLS/SSL, XMPP
Specifically, I have attempted to implement ESP several years ago, and I abandoned the implementation in the NotImplemented folder due to some design flaws within PyPCAPKit at that time. But now, the protocol should be able to implement quite smoothly.
More over, MH
requires some help to
implement all the message data types, you can find more information in the
specific file.
Also, for the existing protocols, I am looking for a helping hand to implement
the construction features, as defined in the Protocol.make
method. You can find some reference from the PCAP’s Frame
header class.
PCAPNG Support¶
As mentioned in #35, PyPCAPKit does not support parsing PCAPNG files with its builtin default engine at the moment – partly because I could not understand the file format specifications.
If you are to help with it, please refer to the implementation of PCAP format
support in pcapkit.protocols.misc.pcap
module.
Maybe Even Faster?¶
Based on my recent benchmarking, PyPCAPKit’s builtin default engine is only 4 times slower than Scapy and 10 times to DPKT. Considering the general overhead and verbose features provided by PyPCAPKit’s builtin default engine, such performance difference is acceptable.
However, there might still be a way to further accelerate the protocol
implementation – merge and concatenation _read_xxxxxx
methods within one
single file.read()
, such that we shall decrease the overall number of IO
calls and reduce the duplicated struct.unpack()
calls, etc. I am not yet
confident about the performance improvement, but this is the most efficient way
to accelerate PyPCAPKit at the moment, inspired from the implementation of
Scapy and DPKT themselves.
Specifically, as the following code from pcapkit.protocols.misc.pcap.Frame.read()
,
_tsus = self._read_unpack(4, lilendian=True)
_ilen = self._read_unpack(4, lilendian=True)
_olen = self._read_unpack(4, lilendian=True)
we might be able to rewrite it as
_tsus, _ilen, _olen = self._read_fields(unpack(4, lilendian=True), unpack(4, lilendian=True), unpack(4, lilendian=True))
and the PoC of _read_fields
would be something like
def _read_fields(self, *fields: 'Field') -> 'tuple[Any, ...]':
# built template
fmt = ''.join(field.template for field in fields)
len = sum([field.length for field in fields])
# read from buffer & do unpack
buf = self._file.read(fmt)
tmp = struct.unpack(fmt, buf)
# do post-processing based on field-specific implementations
ret = []
for field, val in itertools.chain(fields, tmp):
ret.append(field.post_process(val))
return ret
Logging Integration¶
As PyPCAPKit now has the pcapkit.utilities.logging.logger
in place, I’m
expecting to fully extend its functionality in the entire module. Ideas and
contributions are welcomed to integrate the logging system into PyPCAPKit.
New Engines¶
Although PyPCAPKit already has support for some popular PCAP parsing libraries, I’m expecting to extend the list of supported engines furthermore. The candidate engines include:
Implementation for support of new engines would include adding corresponding
handler methods and code blocks into pcapkit.foundation.extraction.Extractor
(see support for Scapy, DPKT, and/or PyShark), as well as, the unified auxiliary
tools located in pcapkit.toolkit
.
About¶
PyPCAPKit
is an independent open source library, using only
DictDumper
as its formatted output dumper.
Note
There is a project called jspcapy
works on pcapkit
, which is a
command line tool for PCAP extraction.
Unlike popular PCAP file extractors, such as Scapy
,
dpkt
, PyShark
, and etc, pcapkit
uses
streaming strategy to read input files. That is to read frame by frame,
decrease occupation on memory, as well as enhance efficiency in some way.
Module Structure¶
In pcapkit
, all files can be described as following eight parts.
Interface (
pcapkit.interface
)User interface for the
pcapkit
library, which standardises and simplifies the usage of this library.Foundation (
pcapkit.foundation
)Synthesises file I/O and protocol analysis, coordinates information exchange in all network layers, as well as provides the foundamental functions for
pcapkit
.Protocols (
pcapkit.protocols
)Collection of all protocol family, with detailed implementation and methods.
Utilities (
pcapkit.utilities
)Auxiliary functions and tools for
pcapkit
.CoreKit (
pcapkit.corekit
)Core utilities for
pcapkit
implementation, mainly for internal data structure and processing.ToolKit (
pcapkit.toolkit
)Auxiliary tools for
pcapkit
to support the multiple extraction engines with a unified interface.DumpKit (
pcapkit.dumpkit
)File output formatters for
pcapkit
.Constants (
pcapkit.const
)Constant enumerations used in
pcapkit
for protocol family extraction and representation.
Engine Comparison¶
Due to the general overhead of pcapkit
, its extraction procedure takes
around 0.0008 seconds per packet, which is already impressive but not enough
comparing to other popular extration engines availbale on the market. Thus
pcapkit
introduced alternative extractionengines to accelerate this
procedure. By now pcapkit
supports Scapy, DPKT, and PyShark.
Test Environment¶
Operating System |
macOS Monterey |
Processor Name |
Intel Core i7 |
Processor Speed |
2.6 GHz |
Total Number of Cores |
6 |
Memory |
16 GB |
Test Results¶
Engine |
Performance (seconds per packet) |
---|---|
|
0.00006832083066304525 |
|
0.0002489296595255534 |
|
0.0008274253209431966 |
|
0.039607704480489093 |
Installation¶
Note
pcapkit
supports Python versions since 3.6.
Simply run the following to install the current version from PyPI:
pip install pypcapkit
Or install the latest version from the gi repository:
git clone https://github.com/JarryShaw/PyPCAPKit.git
cd pypcapkit
pip install -e .
# and to update at any time
git pull
And since pcapkit
supports various extraction engines, and extensive
plug-in functions, you may want to install the optional ones:
# for DPKT only
pip install pypcapkit[DPKT]
# for Scapy only
pip install pypcapkit[Scapy]
# for PyShark only
pip install pypcapkit[PyShark]
# and to install all the optional packages
pip install pypcapkit[all]
# or to do this explicitly
pip install pypcapkit dpkt scapy pyshark
For CLI usage, you will need to install the optional packages:
pip install pypcapkit[cli]
# or explicitly...
pip install pypcapkit emoji