Welcome to PyPCAPKit’s documentation!¶
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.4 or later.
Stream PCAP File Extractor¶
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.
Library Foundation¶
pcapkit.foundation
is a collection of fundations for
pcapkit
, including PCAP file extraction tool
Extrator
, application
layer protocol analyser Analysis
,
and TCP flow tracer TraceFlow
.
Analyser for Application Layer¶
pcapkit.foundation.analysis
works as a header quarter to
analyse and match application layer protocol. Then, call
corresponding modules and functions to extract the attributes.
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.
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.
Data Structure¶
- trace.packet¶
Data structure for TCP flow tracing (
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 )
- trace.buffer¶
Data structure for internal buffering when performing reassembly algorithms (
_buffer
) is as following:(dict) buffer --> memory buffer for reassembly |--> (tuple) BUFID : (dict) | |--> ip.src | | |--> ip.dst | | |--> tcp.srcport | | |--> 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 ...
- trace.index¶
Data structure for TCP flow tracing (element from
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 ...
Implementation¶
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¶
Application Layer Analysis¶
Payload Reassembly¶
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'¶
- pcapkit.interface.core.MPServer = 'server'¶
- pcapkit.interface.core.MPPipeline = 'pipeline'¶
Auxiliary Interface¶
pcapkit.interface.misc
contains miscellaneous
user interface functions, classes, etc., which are
generally provided per user’s requests.
Protocol Family¶
pcapkit.protocols
is collection of all protocol families,
with detailed implementation and methods.
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;
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit
module.
- class DataType_Header¶
- Bases
TypedDict
PCAP global header.
- magic_number: DataType_MagicNumber¶
magic number
- network: pcapkit.const.reg.linktype.LinkType¶
data link type
- class DataType_MagicNumber¶
- Bases
TypedDict
PCAP magic number.
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;
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit
module.
- class pcapkit.protocols.misc.pcap.frame.DataType_Frame¶
- Bases
TypedDict
PCAP frame header.
- frame_info: DataType_FrameInfo¶
PCAP frame information
- time: datetime.datetime¶
timestamp
- protocols: pcapkit.corekit.protochain.ProtoChain¶
protocol chain
- class pcapkit.protocols.misc.pcap.frame.DataType_FrameInfo¶
- Bases
TypedDict
Frame information.
Link Layer Protocols¶
pcapkit.protocols.link
is collection of all protocols in
link layer, with detailed implementation and methods.
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 |
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit
module.
- class pcapkit.protocols.link.arp.DataType_ARP¶
- Bases
TypedDict
ARP header [RFC 826].
- htype: pcapkit.const.arp.Headware¶
hardware type
- ptype: Union[pcapkit.const.reg.ethertype.EtherType, str]¶
protocol type
- oper: pcapkit.const.arp.operation.Operation¶
operation
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) |
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit
module.
- class DataType_Ethernet¶
- Bases
TypedDict
Ethernet header.
- type: pcapkit.const.reg.ethertype.EtherType¶
protocol (Internet layer)
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 |
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit
module.
- class DataType_L2TP¶
- Bases
TypedDict
L2TP header.
- flags: DataTYpe_Flags¶
flags & versoion info
- version: Literal[2]¶
version (
2
)
- class DataType_Flags¶
- Bases
TypedDict
Flags and version info.
- type: Literal['Control', 'Data']¶
type (control / data)
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 |
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit
module.
- class DataType_OSPF¶
- Bases
TypedDict
OSPF header.
- type: pcapkit.const.ospf.packet.Packet¶
type
- router_id: ipaddress.IPv4Address¶
router ID
- area_id: ipaddress.IPv4Address¶
area ID
- autype: pcapkit.const.ospf.authentication.Authentication¶
authentication type
- auth: Union[bytes, DataType_Auth]¶
authentication
For cryptographic authentication information as described in RFC 2328, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
Reserved (must be zero |
|
0 |
0 |
|
Key ID |
0 |
1 |
|
Authentication Data Length |
0 |
2 |
|
Cryptographic Sequence Number |
- class DataType_Auth¶
- Bases
TypedDict
Cryptographic authentication.
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 |
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) |
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit
module.
- class DataType_VLAN¶
- Bases
TypedDict
IEEE 802.1Q customer VLAN tag type [RFC 7042].
- tci: DataType_TCI¶
Tag control information.
- type: pcapkit.const.reg.ethertype.EtherType¶
Protocol (internet layer).
- class DataType_TCI¶
- Bases
TypedDict
Tag control information.
- pcp: pcapkit.const.vlan.priority_level.PriorityLevel¶
Priority code point.
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.
Internet Layer Protocols¶
pcapkit.protocols.internet
is collection of all protocols in
internet layer, with detailed implementation and methods.
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) |
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit
module.
- class DataType_AH¶
- Bases
TypedDict
Authentication header [RFC 4302].
- next: pcapkit.const.reg.transtype.TransType¶
Next header.
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 |
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit
module.
- class DataType_HIP¶
- Bases
TypedDict
HIP header [RFC 5201][RFC 7401].
- next: pcapkit.const.reg.transtype.TransType¶
Next header.
- type: pcapkit.const.hip.packet.Packet¶
Packet type.
- version: Literal[1, 2]¶
Version.
- control: DataType_Control¶
Controls.
- parameters: Optional[Tuple[pcapkit.const.hip.parameter.Parameter]]¶
HIP parameters.
- class DataType_Parameter¶
- Bases
TypedDict
HIP parameters.
- type: pcapkit.const.hip.parameter.Parameter¶
Parameter type.
For HIP unassigned parameters as described in RFC 5201 and RFC 7401, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Contents Padding |
ESP_INFO
Parameter¶For HIP ESP_INFO
parameter as described in RFC 7402,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
Reserved |
|
6 |
48 |
|
KEYMAT Index |
8 |
64 |
|
OLD SPI |
12 |
96 |
|
NEW SPI |
R1_COUNTER
Parameter¶For HIP R1_COUNTER
parameter as described in RFC 5201 and RFC 7401,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
Reserved |
|
8 |
64 |
|
Generation of Valid Puzzles |
LOCATOR_SET
Parameter¶For HIP LOCATOR_SET
parameter as described in RFC 8046,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
? |
? |
… |
… |
4 |
32 |
|
Traffic Type |
5 |
40 |
|
Locator Type |
6 |
48 |
|
Locator Length |
7 |
56 |
Reserved |
|
7 |
63 |
|
Preferred Locator |
8 |
64 |
|
Locator Lifetime |
12 |
96 |
|
Locator |
? |
? |
… |
… |
- class DataType_Param_Locator_Set¶
- Bases
DataType_Parameter
Structure of HIP
LOCATOR_SET
parameter [RFC 8046].- locator: Tuple[DataType_Locator]¶
Locator set.
- class DataType_Locator¶
- Bases
TypedDict
Locator.
- object: DataType_Locator_Dict¶
Locator.
- class DataType_Locator_Dict¶
- Bases
TypedDict
Locator type 2.
PUZZLE
Parameter¶For HIP PUZZLE
parameter as described in RFC 5201 and RFC 7401,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Number of Verified Bits |
5 |
40 |
|
Lifetime |
6 |
48 |
|
Opaque |
8 |
64 |
|
Random Number |
SOLUTION
Parameter¶For HIP SOLUTION
parameter as described in RFC 5201 and RFC 7401,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Number of Verified Bits |
5 |
40 |
|
Lifetime |
6 |
48 |
|
Opaque |
8 |
64 |
|
Random Number |
? |
? |
|
Puzzle Solution |
SEQ
Parameter¶For HIP SEQ
parameter as described in RFC 7401,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Update ID |
ACK
Parameter¶For HIP ACK
parameter as described in RFC 7401,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Peer Update ID |
DH_GROUP_LIST
Parameter¶For HIP DH_GROUP_LIST
parameter as described in RFC 7401,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
DH GROUP ID |
DEFFIE_HELLMAN
Parameter¶For HIP DEFFIE_HELLMAN
parameter as described in RFC 7401,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Group ID |
5 |
40 |
|
Public Value Length |
6 |
48 |
|
Public Value |
? |
? |
Padding |
HIP_TRANSFORM
Parameter¶For HIP HIP_TRANSFORM
parameter as described in RFC 5201,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Group ID |
? |
? |
… |
… |
? |
? |
Padding |
HIP_CIPHER
Parameter¶For HIP HIP_CIPHER
parameter as described in RFC 7401,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
hip_cipher.type |
Parameter Type |
1 |
15 |
hip_cipher.critical |
Critical Bit |
2 |
16 |
hip_cipher.length |
Length of Contents |
4 |
32 |
hip_cipher.id |
Cipher ID |
? |
? |
… |
… |
? |
? |
Padding |
NAT_TRAVERSAL_MODE
Parameter¶For HIP NAT_TRAVERSAL_MODE
parameter as described in RFC 5770,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
Reserved |
|
6 |
48 |
|
Mode ID |
? |
? |
… |
… |
? |
? |
Padding |
TRANSACTION_PACING
Parameter¶For HIP TRANSACTION_PACING
parameter as described in RFC 5770,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Min Ta |
ENCRYPTED
Parameter¶For HIP ENCRYPTED
parameter as described in RFC 7401,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
Reserved |
|
8 |
48 |
|
Initialization Vector |
? |
? |
|
Encrypted data |
? |
? |
Padding |
HOST_ID
Parameter¶For HIP HOST_ID
parameter as described in RFC 7401,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Host Identity Length |
6 |
48 |
|
Domain Identifier Type |
6 |
52 |
|
Domain Identifier Length |
8 |
64 |
|
Algorithm |
10 |
80 |
|
Host Identity |
? |
? |
|
Domain Identifier |
? |
? |
Padding |
- class DataType_Param_Host_ID¶
- Bases
DataType_Parameter
Structure of HIP
HOST_ID
parameter [RFC 7401].- di_type: pcapkit.const.hip.di_type.DIType¶
Domain identifier type.
- algorithm: pcapkit.const.hip.hi_algorithm.HIAlgorithm¶
Algorithm.
- host_id: Union[bytes, DataType_Host_ID_ECDSA_Curve, DataType_Host_ID_ECDSA_LOW_Curve]¶
Host identity.
HIT_SUITE_LIST
Parameter¶For HIP HIT_SUITE_LIST
parameter as described in RFC 7401,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
HIT Suite ID |
? |
? |
… |
… |
? |
? |
Padding |
CERT
Parameter¶For HIP CERT
parameter as described in RFC 7401,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
|
5 |
40 |
|
|
6 |
48 |
|
|
7 |
56 |
|
|
8 |
64 |
|
Certificate |
? |
? |
Padding |
NOTIFICATION
Parameter¶For HIP NOTIFICATION
parameter as described in RFC 7401,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
Reserved |
|
6 |
48 |
|
Notify Message Type |
8 |
64 |
|
Notification Data |
? |
? |
Padding |
ECHO_REQUEST_SIGNED
Parameter¶For HIP ECHO_REQUEST_SIGNED
parameter as described in RFC 7401,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Opaque Data |
REG_INFO
Parameter¶For HIP REG_INFO
parameter as described in RFC 8003,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Lifetime |
4 |
32 |
|
Min Lifetime |
5 |
40 |
|
Max Lifetime |
6 |
48 |
|
Reg Type |
? |
? |
… |
… |
? |
? |
Padding |
- class DataType_Param_Reg_Info¶
- Bases
DataType_Parameter
Structure of HIP
REG_INFO
parameter [RFC 8003].- lifetime: DataType_Lifetime¶
Lifetime.
- reg_type: Tuple[pcapkit.const.hip.registration.Registration]¶
Array of registration type.
REG_REQUEST
Parameter¶For HIP REG_REQUEST
parameter as described in RFC 8003,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Lifetime |
4 |
32 |
|
Min Lifetime |
5 |
40 |
|
Max Lifetime |
6 |
48 |
|
Reg Type |
? |
? |
… |
… |
? |
? |
Padding |
- class DataType_Param_Reg_Request¶
- Bases
DataType_Parameter
Structure of HIP
REG_REQUEST
parameter [RFC 8003].- lifetime: DataType_Lifetime¶
Lifetime.
- reg_type: Tuple[pcapkit.const.hip.registration.Registration]¶
Array of registration type.
REG_RESPONSE
Parameter¶For HIP REG_RESPONSE
parameter as described in RFC 8003,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Lifetime |
4 |
32 |
|
Min Lifetime |
5 |
40 |
|
Max Lifetime |
6 |
48 |
|
Reg Type |
? |
? |
… |
… |
? |
? |
Padding |
- class DataType_Param_Reg_Response¶
- Bases
DataType_Parameter
Structure of HIP
REG_RESPONSE
parameter [RFC 8003].- lifetime: DataType_Lifetime¶
Lifetime.
- reg_type: Tuple[pcapkit.const.hip.registration.Registration]¶
Array of registration type.
REG_FAILED
Parameter¶For HIP REG_FAILED
parameter as described in RFC 8003,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Lifetime |
4 |
32 |
|
Min Lifetime |
5 |
40 |
|
Max Lifetime |
6 |
48 |
|
Reg Type |
? |
? |
… |
… |
? |
? |
Padding |
- class DataType_Param_Reg_Failed¶
- Bases
DataType_Parameter
Structure of HIP
REG_FAILED
parameter [RFC 8003].- lifetime: DataType_Lifetime¶
Lifetime.
- reg_type: Tuple[pcapkit.const.hip.registration.Registration]¶
Array of registration type.
REG_FROM
Parameter¶For HIP REG_FROM
parameter as described in RFC 5770,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Port |
6 |
48 |
|
Protocol |
7 |
56 |
Reserved |
|
8 |
64 |
|
Address (IPv6) |
- class DataType_Param_Reg_From¶
- Bases
DataType_Parameter
Structure of HIP
REG_FROM
parameter [RFC 5770].- protocol: pcapkit.const.reg.transtype.TransType¶
Protocol.
- ip: ipaddress.IPv6Address¶
IPv6 address.
ECHO_RESPONSE_SIGNED
Parameter¶For HIP ECHO_RESPONSE_SIGNED
parameter as described in RFC 7401,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Opaque Data |
TRANSPORT_FORMAT_LIST
Parameter¶For HIP TRANSPORT_FORMAT_LIST
parameter as described in RFC 7401,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
TF Type |
? |
? |
… |
… |
? |
? |
Padding |
ESP_TRANSFORM
Parameter¶For HIP ESP_TRANSFORM
parameter as described in RFC 7402,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
Reserved |
|
6 |
48 |
|
Suite ID |
? |
? |
… |
… |
? |
? |
Padding |
SEQ_DATA
Parameter¶For HIP SEQ_DATA
parameter as described in RFC 6078,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Sequence number |
ACK_DATA
Parameter¶For HIP ACK_DATA
parameter as described in RFC 6078,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Acked Sequence number |
PAYLOAD_MIC
Parameter¶For HIP PAYLOAD_MIC
parameter as described in RFC 6078,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Next Header |
5 |
40 |
Reserved |
|
8 |
64 |
|
Payload Data |
12 |
96 |
|
MIC Value |
? |
? |
Padding |
TRANSACTION_ID
Parameter¶For HIP TRANSACTION_ID
parameter as described in RFC 6078,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Identifier |
OVERLAY_ID
Parameter¶For HIP OVERLAY_ID
parameter as described in RFC 6079,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Identifier |
ROUTE_DST
Parameter¶For HIP ROUTE_DST
parameter as described in RFC 6079,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Flags |
4 |
32 |
|
SYMMETRIC [RFC 6028] |
4 |
33 |
|
MUST_FOLLOW [RFC 6028] |
6 |
48 |
Reserved |
|
8 |
64 |
|
HIT |
? |
? |
… |
… |
- class DataType_Param_Route_Dst¶
- Bases
DataType_Parameter
Structure of HIP
ROUTE_DST
parameter [RFC 6028].- flags: DataType_Flags¶
Flags.
- ip: Tuple[ipaddress.IPv6Address]¶
Array of HIT addresses.
HIP_TRANSPORT_MODE
Parameter¶For HIP HIP_TRANSPORT_MODE
parameter as described in RFC 6261,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Port |
6 |
48 |
|
Mode ID |
? |
? |
… |
… |
? |
? |
Padding |
HIP_MAC
Parameter¶For HIP HIP_MAC
parameter as described in RFC 7401,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
HMAC |
? |
? |
Padding |
HIP_MAC_2
Parameter¶For HIP HIP_MAC_2
parameter as described in RFC 7401,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
HMAC |
? |
? |
Padding |
HIP_SIGNATURE_2
Parameter¶For HIP HIP_SIGNATURE_2
parameter as described in RFC 7401,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
SIG Algorithm |
6 |
48 |
|
Signature |
? |
? |
Padding |
HIP_SIGNATURE
Parameter¶For HIP HIP_SIGNATURE
parameter as described in RFC 7401,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
SIG Algorithm |
6 |
48 |
|
Signature |
? |
? |
Padding |
ECHO_REQUEST_UNSIGNED
Parameter¶For HIP ECHO_REQUEST_UNSIGNED
parameter as described in RFC 7401,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Opaque Data |
ECHO_RESPONSE_UNSIGNED
Parameter¶For HIP ECHO_RESPONSE_UNSIGNED
parameter as described in RFC 7401,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Opaque Data |
RELAY_FROM
Parameter¶For HIP RELAY_FROM
parameter as described in RFC 5770,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Port |
6 |
48 |
|
Protocol |
7 |
56 |
Reserved |
|
8 |
64 |
|
Address (IPv6) |
- class DataType_Param_Relay_From¶
- Bases
DataType_Parameter
Structure of HIP
RELAY_FROM
parameter [RFC 5770].- protocol: pcapkit.const.reg.transtype.TransType¶
Protocol.
- ip: ipaddress.IPv6Address¶
IPv6 address.
RELAY_TO
Parameter¶For HIP RELAY_TO
parameter as described in RFC 5770,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Port |
6 |
48 |
|
Protocol |
7 |
56 |
Reserved |
|
8 |
64 |
|
Address (IPv6) |
- class DataType_Param_Relay_To¶
- Bases
DataType_Parameter
Structure of HIP
RELAY_TO
parameter [RFC 5770].- port: in¶
Port.
- protocol: pcapkit.const.reg.transtype.TransType¶
Protocol.
- ip: ipaddress.IPv6Address¶
IPv6 address.
OVERLAY_TTL
Parameter¶For HIP OVERLAY_TTL
parameter as described in RFC 6078,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
TTL |
6 |
48 |
Reserved |
ROUTE_VIA
Parameter¶For HIP ROUTE_VIA
parameter as described in RFC 6028,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Flags |
4 |
32 |
|
|
4 |
33 |
|
|
6 |
48 |
Reserved |
|
8 |
64 |
|
HIT |
? |
? |
… |
… |
- class DataType_Param_Route_Via¶
- Bases
DataType_Parameter
Structure of HIP
ROUTE_VIA
parameter [RFC 6028].- flags: DataType_Flags¶
Flags.
- ip: Tuple[ipaddress.IPv6Address]¶
Array of HITs.
FROM
Parameter¶For HIP FROM
parameter as described in RFC 8004,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Address |
- class DataType_Param_From¶
- Bases
DataType_Parameter
Structure of HIP
FROM
parameter [RFC 8004].- ip: ipaddress.IPv6Address¶
IPv6 address.
RVS_HMAC
Parameter¶For HIP RVS_HMAC
parameter as described in RFC 8004,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
HMAC |
? |
? |
Padding |
VIA_RVS
Parameter¶For HIP VIA_RVS
parameter as described in RFC 6028,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
Address |
? |
? |
… |
… |
RELAY_HMAC
Parameter¶For HIP RELAY_HMAC
parameter as described in RFC 5770,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Parameter Type |
1 |
15 |
|
Critical Bit |
2 |
16 |
|
Length of Contents |
4 |
32 |
|
HMAC |
? |
? |
Padding |
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 |
- pcapkit.protocols.internet.hopopt._HOPOPT_ACT: Dict[str, str]¶
HOPOPT unknown option actions.
Code
Action
00
skip over this option and continue processing the header
01
discard the packet
10
discard the packet and, regardless of whether or not the packet’s Destination Address was a multicast address, send an ICMP Parameter Problem, Code 2, message to the packet’s Source Address, pointing to the unrecognized Option Type
11
discard the packet and, only if the packet’s Destination Address was not a multicast address, send an ICMP Parameter Problem, Code 2, message to the packet’s Source Address, pointing to the unrecognized Option Type
- pcapkit.protocols.internet.hopopt._HOPOPT_OPT: Dict[int, Tuple[str, str]]¶
HOPOPT options.
Code
Acronym
Option
Reference
0x00
pad
Pad1
[RFC 8200] 0
0x01
pad
PadN
[RFC 8200]
0x04
tun
Tunnel Encapsulation Limit
[RFC 2473] 1
0x05
ra
Router Alert
[RFC 2711] 2
0x07
calipso
Common Architecture Label IPv6 Security Option
[RFC 5570]
0x08
smf_dpd
Simplified Multicast Forwarding
[RFC 6621]
0x0F
pdm
Performance and Diagnostic Metrics
[RFC 8250] 10
0x26
qs
Quick-Start
[RFC 4782][RFC Errata 2034] 6
0x63
rpl
Routing Protocol for Low-Power and Lossy Networks
[RFC 6553]
0x6D
mpl
Multicast Protocol for Low-Power and Lossy Networks
[RFC 7731]
0x8B
ilnp
Identifier-Locator Network Protocol Nonce
[RFC 6744]
0x8C
lio
Line-Identification Option
[RFC 6788]
0xC2
jumbo
Jumbo Payload
[RFC 2675]
0xC9
home
Home Address
[RFC 6275]
0xEE
ip_dff
Depth-First Forwarding
[RFC 6971]
- pcapkit.protocols.internet.hopopt._HOPOPT_NULL: Dict[int, str]¶
HOPOPT unknown option descriptions.
Code
Description
Reference
0x1E
RFC3692-style Experiment
[RFC 4727]
0x3E
RFC3692-style Experiment
[RFC 4727]
0x4D
Deprecated
[RFC 7731]
0x5E
RFC3692-style Experiment
[RFC 4727]
0x7E
RFC3692-style Experiment
[RFC 4727]
0x8A
Endpoint Identification
DEPRECATED
0x9E
RFC3692-style Experiment
[RFC 4727]
0xBE
RFC3692-style Experiment
[RFC 4727]
0xDE
RFC3692-style Experiment
[RFC 4727]
0xFE
RFC3692-style Experiment
[RFC 4727]
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit
module.
- class pcapkit.protocols.internet.hopopt.DataType_HOPOPT¶
- class pcapkit.protocols.internet.hopopt.DataType_Option¶
- Bases
TypedDict
HOPOPT option.
- type: DataType_Option_Type¶
Option type.
For HOPOPT option type field as described in RFC 791, its structure is described as below:
Octets |
Bits |
Name |
Descriptions |
---|---|---|---|
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
For HOPOPT unassigned options as described in RFC 8200, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
Option Data |
Pad1
Option¶For HOPOPT Pad1
option as described in RFC 8200,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
PadN
Option¶For HOPOPT PadN
option as described in RFC 8200,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
Padding |
For HOPOPT Tunnel Encapsulation Limit option as described in RFC 2473, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
Tunnel Encapsulation Limit |
For HOPOPT Router Alert option as described in RFC 2711, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
Value |
CALIPSO
Option¶For HOPOPT CALIPSO
option as described in RFC 5570,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action (00) |
0 |
2 |
|
Change Flag (0) |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
CALIPSO Domain of Interpretation |
6 |
48 |
|
Cmpt Length |
7 |
56 |
|
Sens Level |
8 |
64 |
|
Checksum (CRC-16) |
9 |
72 |
|
Compartment Bitmap |
SMF_DPD
Option¶For IPv6 SMF_DPD
option header in I-DPD mode as described in RFC 5570,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
DPD Type ( |
2 |
17 |
|
TaggerID Type |
2 |
20 |
|
TaggerID Length |
3 |
24 |
|
TaggerID |
? |
? |
|
Identifier |
For IPv6 SMF_DPD
option header in H-DPD mode as described in RFC 5570,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
DPD Type ( |
2 |
17 |
|
Hash Assist Value |
PDM
Option¶For HOPOPT PDM
option as described in RFC 8250,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
Scale Delta Time Last Received |
3 |
24 |
|
Scale Delta Time Last Sent |
4 |
32 |
|
Packet Sequence Number This Packet |
6 |
48 |
|
Packet Sequence Number Last Received |
8 |
64 |
|
Delta Time Last Received |
10 |
80 |
|
Delta Time Last Sent |
- class pcapkit.protocols.internet.hopopt.DataType_Opt_PDM¶
- Bases
DataType_Option
Structure of HOPOPT
PDM
option [RFC 8250].- scaledtlr: datetime.timedelta¶
Scale delta time last received.
- scaledtls: datetime.timedelta¶
Scale delta time last sent.
- deltatlr: datetime.timedelta¶
Delta time last received.
- deltatls: datetime.timedelta¶
Delta time last sent.
For HOPOPT Quick Start option as described in RFC 4782, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
Function ( |
2 |
20 |
|
Rate Request / Report (in Kbps) |
3 |
24 |
|
QS TTL / |
4 |
32 |
|
QS Nounce |
7 |
62 |
Reserved |
RPL
Option¶For HOPOPT RPL
option as described in RFC 6553,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
RPL Option Flags |
2 |
16 |
|
Down Flag |
2 |
17 |
|
Rank-Error Flag |
2 |
18 |
|
Forwarding-Error Flag |
3 |
24 |
|
RPL Instance ID |
4 |
32 |
|
SenderRank |
6 |
48 |
|
Sub-TLVs |
- class pcapkit.protocols.internet.hopopt.DataType_Opt_RPL¶
- Bases
DataType_Option
Structure of HOPOPT
RPL
option [RFC 6553].- flags: DataType_RPL_Flags¶
RPL option flags.
MPL
Option¶For HOPOPT MPL
option as described in RFC 7731,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
Seed-ID Length |
2 |
18 |
|
MPL Option Flags |
2 |
18 |
|
Maximum SEQ Flag |
2 |
19 |
|
Verification Flag |
2 |
20 |
Reserved |
|
3 |
24 |
|
Sequence |
4 |
32 |
|
Seed-ID |
- class pcapkit.protocols.internet.hopopt.DataType_Opt_MPL¶
- Bases
DataType_Option
Structure of HOPOPT
MPL
option [RFC 7731].- seed_len: pcapkit.const.ipv6.seed_id.SeedID¶
Seed-ID length.
- flags: DataType_MPL_Flags¶
MPL option flags.
ILNP
Nounce Option¶For HOPOPT ILNP
Nounce option as described in RFC 6744,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
Nonce Value |
For HOPOPT Line-Identification option as described in RFC 6788, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
Line ID Length |
3 |
24 |
|
Line ID |
For HOPOPT Jumbo Payload option as described in RFC 2675, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
Jumbo Payload Length |
For HOPOPT Home Address option as described in RFC 6275, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
Home Address |
- class pcapkit.protocols.internet.hopopt.DataType_Opt_Home¶
- Bases
DataType_Option
Structure of HOPOPT Home Address option [RFC 6275].
- ip: ipaddress.IPv6Address¶
Home address.
IP_DFF
Option¶For HOPOPT IP_DFF
option as described in RFC 6971,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
Version |
2 |
18 |
|
Flags |
2 |
18 |
|
|
2 |
19 |
|
|
2 |
20 |
Reserved |
|
3 |
24 |
|
Sequence Number |
- class pcapkit.protocols.internet.hopopt.DataType_Opt_IP_DFF¶
- Bases
DataType_Option
Structure of HOPOPT
IP_DFF
option [RFC 6971].- flags: DataType_IP_DFF_Flags¶
Flags.
- class pcapkit.protocols.internet.hopopt.DataType_IP_DFF_Flags¶
- Bases
TypedDict
Flags.
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
.
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
†.
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 > |
- pcapkit.protocols.internet.ipv4.IPv4_OPT: DataType_IPv4_OPT¶
IPv4 option
dict
parsing mapping.copy
class
number
kind
length
process
name
0
0
0
0
[RFC 791] End of Option List
0
0
1
1
[RFC 791] No-Operation
0
0
7
7
?
2
[RFC 791] Record Route
0
0
11
11
4
1
0
0
12
12
4
1
0
0
25
25
8
3
[RFC 4782] Quick-Start
0
2
4
68
?
4
[RFC 791] Time Stamp
0
2
18
82
?
5
1
0
2
130
?
6
[RFC 1108] Security
1
0
3
131
?
2
[RFC 791] Loose Source Route
1
0
5
133
?
6
[RFC 1108] Extended Security
1
0
8
136
4
1
1
0
9
137
?
2
[RFC 791] Strict Source Route
1
0
17
145
?
0
1
0
20
148
4
7
[RFC 2113] Router Alert
- pcapkit.protocols.internet.ipv4.process_opt: Dict[int, Callable[[pcapkit.protocols.internet.ipv4.IPv4, int, int], DataType_Opt]]¶
Process method for IPv4 options.
Code
Method
Description
0
_read_mode_donone()
do nothing
1
_read_mode_unpack()
unpack according to size
2
_read_mode_route()
unpack route data options
3
_read_mode_qs()
unpack Quick-Start
4
_read_mode_ts()
unpack Time Stamp
5
_read_mode_tr()
unpack Traceroute
6
_read_mode_sec()
unpack (Extended) Security
7
_read_mode_rsralt()
unpack Router Alert
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit
module.
- class pcapkit.protocols.internet.ipv4.DataType_IPv4¶
- Bases
TypedDict
Structure of IPv4 header [RFC 791].
- version: Literal[4]¶
Version (
4
).
- dsfield: DataType_DS_Field¶
Type of services.
- flags: DataType_IPv4_Flags¶
Flags.
- proto: pcapkit.const.reg.transtype.TransType¶
Protocol (transport layer).
- src: ipaddress.IPv4Address¶
Source IP address.
- dst: ipaddress.IPv4Address¶
Destination IP address.
- opt: Tuple[pcapkit.const.ipv4.option_number.OptionNumber]¶
Tuple of option acronyms.
- class pcapkit.protocols.internet.ipv4.DataType_DS_Field¶
- Bases
TypedDict
IPv4 DS fields.
- dscp: DataType_IPv4_DSCP¶
Differentiated services code point (DSCP).
- ecn: pcapkit.const.ipv4.tos_ecn.ToSECN¶
Explicit congestion notification (ECN).
- class pcapkit.protocols.internet.ipv4.DataType_IPv4_DSCP¶
- Bases
TypedDict
Differentiated services code point (DSCP).
- pre: pcapkit.const.ipv4.tos_pre.ToSPrecedence¶
ToS precedence.
- del: pcapkit.const.ipv4.tos_del.ToSDelay¶
ToS delay.
- thr: pcapkit.const.ipv4.tos_thr.ToSThroughput¶
ToS throughput.
- rel: pcapkit.const.ipv4.tos_rel.ToSReliability¶
ToS reliability.
- class pcapkit.protocols.internet.ipv4.DataType_IPv4_Flags¶
- Bases
TypedDict
IPv4 flags.
- class pcapkit.protocols.internet.ipv4.DataType_Opt¶
- Bases
TypedDict
IPv4 option data.
- type: DataType_IPv4_Option_Type¶
Option type info.
- class pcapkit.protocols.internet.ipv4.DataType_IPv4_OPT¶
- Bases
TypedDict
IPv4 option
dict
parsing mapping.
For IPv4 option type field as described in RFC 791, its structure is described as below:
Octets |
Bits |
Name |
Descriptions |
---|---|---|---|
0 |
0 |
|
Copied Flag ( |
0 |
1 |
|
Option Class ( |
0 |
3 |
|
Option Number |
For IPv4 options require no process, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind |
0 |
0 |
|
Copied Flag |
0 |
1 |
|
Option Class |
0 |
3 |
|
Option Number |
1 |
8 |
|
Length |
2 |
16 |
|
Kind-specific Data |
For IPv4 options require unpack process, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind |
0 |
0 |
|
Copied Flag |
0 |
1 |
|
Option Class |
0 |
3 |
|
Option Number |
1 |
8 |
|
Length |
2 |
16 |
|
Kind-specific Data |
For IPv4 options with route data as described in RFC 791, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind ( |
0 |
0 |
|
Copied Flag ( |
0 |
1 |
|
Option Class ( |
0 |
3 |
|
Option Number ( |
1 |
8 |
|
Length |
2 |
16 |
|
Pointer ( |
3 |
24 |
|
Route Data |
For IPv4 Quick Start options as described in RFC 4782, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind ( |
0 |
0 |
|
Copied Flag ( |
0 |
1 |
|
Option Class ( |
0 |
3 |
|
Option Number ( |
1 |
8 |
|
Length ( |
2 |
16 |
|
Function ( |
2 |
20 |
|
Rate Request / Report (in Kbps) |
3 |
24 |
|
QS TTL / |
4 |
32 |
|
QS Nounce |
7 |
62 |
Reserved ( |
For IPv4 Time Stamp option as described in RFC 791, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind ( |
0 |
0 |
|
Copied Flag ( |
0 |
1 |
|
Option Class ( |
0 |
3 |
|
Option Number ( |
1 |
8 |
|
Length ( |
2 |
16 |
|
Pointer ( |
3 |
24 |
|
Overflow Octets |
3 |
28 |
|
Flag |
4 |
32 |
|
Internet Address |
8 |
64 |
|
Timestamp |
- class pcapkit.protocols.internet.ipv4.DataType_Opt_TimeStamp¶
- Bases
DataType_Opt
Structure of Timestamp (TS) option [RFC 791].
- ip: Optional[Tuple[ipaddress.IPv4Address]]¶
Array of Internet addresses (if
flag
is1
/3
).
- timestamp: Optional[Tuple[datetime.datetime]]¶
Array of timestamps (if
flag
is0
/1
/3
).
For IPv4 Traceroute option as described in RFC 6814, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
ip.tr.kind |
Kind (82) |
0 |
0 |
ip.tr.type.copy |
Copied Flag (0) |
0 |
1 |
ip.tr.type.class |
Option Class (0) |
0 |
3 |
ip.tr.type.number |
Option Number (18) |
1 |
8 |
ip.tr.length |
Length (12) |
2 |
16 |
ip.tr.id |
ID Number |
4 |
32 |
ip.tr.ohc |
Outbound Hop Count |
6 |
48 |
ip.tr.rhc |
Return Hop Count |
8 |
64 |
ip.tr.ip |
Originator IP Address |
For IPv4 options with security info as described in RFC 1108, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind ( |
0 |
0 |
|
Copied Flag ( |
0 |
1 |
|
Option Class ( |
0 |
3 |
|
Option Number ( |
1 |
8 |
|
Length ( |
2 |
16 |
|
Classification Level |
3 |
24 |
|
Protection Authority Flags |
- class pcapkit.protocols.internet.ipv4.DataType_Opt_Security_Info¶
- Bases
DataType_Opt
Structure of IPv4 options with security info [RFC 791].
- level: pcapkit.const.ipv4.classification_level.ClassificationLevel¶
Classification level.
- flags: Tuple[DataType_SEC_Flags]¶
Array of protection authority flags.
- class pcapkit.protocols.internet.ipv4.DataType_SEC_Flags¶
- Bases
pcapkit.corekit.infoclass.Info
Protection authority flags, as mapping of protection authority bit assignments
enumeration
andbool
flags.
For IPv4 Router Alert option as described in RFC 2113, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind ( |
0 |
0 |
|
Copied Flag ( |
0 |
1 |
|
Option Class ( |
0 |
3 |
|
Option Number ( |
1 |
8 |
|
Length ( |
2 |
16 |
|
Alert |
2 |
16 |
|
Alert Code |
- class pcapkit.protocols.internet.ipv4.DataType_Opt_RouterAlert¶
- Bases
DataType_Opt
Structure of Router Alert (RTRALT) option [RFC 2113].
- alert: pcapkit.const.ipv4.router_alert.RouterAlert¶
Alert.
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 |
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit
module.
- class DataType_IPv6_Frag¶
- Bases
TypedDict
Structure of IPv6-Frag header [RFC 8200].
- next: pcapkit.const.reg.transtype.TransType¶
Next header.
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 |
- pcapkit.protocols.internet.ipv6_opts._IPv6_Opts_ACT: Dict[str, str]¶
IPv6-Opts unknown option actions.
Code
Action
00
skip over this option and continue processing the header
01
discard the packet
10
discard the packet and, regardless of whether or not the packet’s Destination Address was a multicast address, send an ICMP Parameter Problem, Code 2, message to the packet’s Source Address, pointing to the unrecognized Option Type
11
discard the packet and, only if the packet’s Destination Address was not a multicast address, send an ICMP Parameter Problem, Code 2, message to the packet’s Source Address, pointing to the unrecognized Option Type
- pcapkit.protocols.internet.ipv6_opts._IPv6_Opts_OPT: Dict[int, Tuple[str, str]]¶
IPv6-Opts options.
Code
Acronym
Option
Reference
0x00
pad
Pad1
[RFC 8200] 0
0x01
pad
PadN
[RFC 8200]
0x04
tun
Tunnel Encapsulation Limit
[RFC 2473] 1
0x05
ra
Router Alert
[RFC 2711] 2
0x07
calipso
Common Architecture Label IPv6 Security Option
[RFC 5570]
0x08
smf_dpd
Simplified Multicast Forwarding
[RFC 6621]
0x0F
pdm
Performance and Diagnostic Metrics
[RFC 8250] 10
0x26
qs
Quick-Start
[RFC 4782][RFC Errata 2034] 6
0x63
rpl
Routing Protocol for Low-Power and Lossy Networks
[RFC 6553]
0x6D
mpl
Multicast Protocol for Low-Power and Lossy Networks
[RFC 7731]
0x8B
ilnp
Identifier-Locator Network Protocol Nonce
[RFC 6744]
0x8C
lio
Line-Identification Option
[RFC 6788]
0xC2
jumbo
Jumbo Payload
[RFC 2675]
0xC9
home
Home Address
[RFC 6275]
0xEE
ip_dff
Depth-First Forwarding
[RFC 6971]
- pcapkit.protocols.internet.ipv6_opts._IPv6_Opts_NULL: Dict[int, str]¶
IPv6-Opts unknown option descriptions.
Code
Description
Reference
0x1E
RFC3692-style Experiment
[RFC 4727]
0x3E
RFC3692-style Experiment
[RFC 4727]
0x4D
Deprecated
[RFC 7731]
0x5E
RFC3692-style Experiment
[RFC 4727]
0x7E
RFC3692-style Experiment
[RFC 4727]
0x8A
Endpoint Identification
DEPRECATED
0x9E
RFC3692-style Experiment
[RFC 4727]
0xBE
RFC3692-style Experiment
[RFC 4727]
0xDE
RFC3692-style Experiment
[RFC 4727]
0xFE
RFC3692-style Experiment
[RFC 4727]
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit
module.
- class pcapkit.protocols.internet.ipv6_opts.DataType_IPv6_Opts¶
- Bases
TypedDict
Structure of IPv6-Opts header [RFC 8200].
- next: pcapkit.const.reg.transtype.TransType¶
Next header.
- options: Tuple[pcapkit.const.ipv6.option.Option]¶
Array of option acronyms.
- class pcapkit.protocols.internet.ipv6_opts.DataType_Option¶
- Bases
TypedDict
IPv6_Opts option.
- type: DataType_IPv6_Opts_Option_Type¶
Option type.
For IPv6-Opts option type field as described in RFC 791, its structure is described as below:
Octets |
Bits |
Name |
Descriptions |
---|---|---|---|
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
For IPv6-Opts unassigned options as described in RFC 8200, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
Option Data |
Pad1
Option¶For IPv6-Opts Pad1
option as described in RFC 8200,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
PadN
Option¶For IPv6-Opts PadN
option as described in RFC 8200,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
Padding |
For IPv6-Opts Tunnel Encapsulation Limit option as described in RFC 2473, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
Tunnel Encapsulation Limit |
For IPv6-Opts Router Alert option as described in RFC 2711, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
Value |
CALIPSO
Option¶For IPv6-Opts CALIPSO
option as described in RFC 5570,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action (00) |
0 |
2 |
|
Change Flag (0) |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
CALIPSO Domain of Interpretation |
6 |
48 |
|
Cmpt Length |
7 |
56 |
|
Sens Level |
8 |
64 |
|
Checksum (CRC-16) |
9 |
72 |
|
Compartment Bitmap |
SMF_DPD
Option¶For IPv6 SMF_DPD
option header in I-DPD mode as described in RFC 5570,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
DPD Type ( |
2 |
17 |
|
TaggerID Type |
2 |
20 |
|
TaggerID Length |
3 |
24 |
|
TaggerID |
? |
? |
|
Identifier |
For IPv6 SMF_DPD
option header in H-DPD mode as described in RFC 5570,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
DPD Type ( |
2 |
17 |
|
Hash Assist Value |
PDM
Option¶For IPv6-Opts PDM
option as described in RFC 8250,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
Scale Delta Time Last Received |
3 |
24 |
|
Scale Delta Time Last Sent |
4 |
32 |
|
Packet Sequence Number This Packet |
6 |
48 |
|
Packet Sequence Number Last Received |
8 |
64 |
|
Delta Time Last Received |
10 |
80 |
|
Delta Time Last Sent |
- class pcapkit.protocols.internet.ipv6_opts.DataType_Dest_Opt_PDM¶
- Bases
DataType_Option
Structure of IPv6-Opts
PDM
option [RFC 8250].- scaledtlr: datetime.timedelta¶
Scale delta time last received.
- scaledtls: datetime.timedelta¶
Scale delta time last sent.
- deltatlr: datetime.timedelta¶
Delta time last received.
- deltatls: datetime.timedelta¶
Delta time last sent.
For IPv6-Opts Quick Start option as described in RFC 4782, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
Function ( |
2 |
20 |
|
Rate Request / Report (in Kbps) |
3 |
24 |
|
QS TTL / |
4 |
32 |
|
QS Nounce |
7 |
62 |
Reserved |
RPL
Option¶For IPv6-Opts RPL
option as described in RFC 6553,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
RPL Option Flags |
2 |
16 |
|
Down Flag |
2 |
17 |
|
Rank-Error Flag |
2 |
18 |
|
Forwarding-Error Flag |
3 |
24 |
|
RPL Instance ID |
4 |
32 |
|
SenderRank |
6 |
48 |
|
Sub-TLVs |
- class pcapkit.protocols.internet.ipv6_opts.DataType_Dest_Opt_RPL¶
- Bases
DataType_Option
Structure of IPv6-Opts
RPL
option [RFC 6553].- flags: DataType_RPL_Flags¶
RPL option flags.
MPL
Option¶For IPv6-Opts MPL
option as described in RFC 7731,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
Seed-ID Length |
2 |
18 |
|
MPL Option Flags |
2 |
18 |
|
Maximum SEQ Flag |
2 |
19 |
|
Verification Flag |
2 |
20 |
Reserved |
|
3 |
24 |
|
Sequence |
4 |
32 |
|
Seed-ID |
- class pcapkit.protocols.internet.ipv6_opts.DataType_Dest_Opt_MPL¶
- Bases
DataType_Option
Structure of IPv6-Opts
MPL
option [RFC 7731].- seed_len: pcapkit.const.ipv6.seed_id.SeedID¶
Seed-ID length.
- flags: DataType_MPL_Flags¶
MPL option flags.
ILNP
Nounce Option¶For IPv6-Opts ILNP
Nounce option as described in RFC 6744,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
Nonce Value |
For IPv6-Opts Line-Identification option as described in RFC 6788, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
Line ID Length |
3 |
24 |
|
Line ID |
For IPv6-Opts Jumbo Payload option as described in RFC 2675, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
Jumbo Payload Length |
For IPv6-Opts Home Address option as described in RFC 6275, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
Home Address |
- class pcapkit.protocols.internet.ipv6_opts.DataType_Dest_Opt_Home¶
- Bases
DataType_Option
Structure of IPv6-Opts Home Address option [RFC 6275].
- ip: ipaddress.IPv6Address¶
Home address.
IP_DFF
Option¶For IPv6-Opts IP_DFF
option as described in RFC 6971,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Option Type |
0 |
0 |
|
Option Number |
0 |
0 |
|
Action ( |
0 |
2 |
|
Change Flag ( |
1 |
8 |
|
Length of Option Data |
2 |
16 |
|
Version |
2 |
18 |
|
Flags |
2 |
18 |
|
|
2 |
19 |
|
|
2 |
20 |
Reserved |
|
3 |
24 |
|
Sequence Number |
- class pcapkit.protocols.internet.ipv6_opts.DataType_Dest_Opt_IP_DFF¶
- Bases
DataType_Option
Structure of IPv6-Opts
IP_DFF
option [RFC 6971].- flags: DataType_IP_DFF_Flags¶
Flags.
- class pcapkit.protocols.internet.ipv6_opts.DataType_IP_DFF_Flags¶
- Bases
TypedDict
Flags.
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 |
- pcapkit.protocols.internet.ipv6_route._ROUTE_PROC: Dict[int, str]¶
IPv6 routing processors.
Code
Processor
Note
0
_read_data_type_src()
[RFC 5095] DEPRECATED
2
_read_data_type_2()
[RFC 6275]
3
_read_data_type_rpl()
[RFC 6554]
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit
module.
- class pcapkit.protocols.internet.ipv6_route.DataType_IPv6_Route¶
Structure of IPv6-Route header [RFC 8200][RFC 5095].
- next: pcapkit.const.reg.transtype.TransType¶
Next header.
- type: pcapkit.const.ipv6.routing.Routing¶
Routing type.
For IPv6-Route unknown type data as described in RFC 8200 and RFC 5095, its 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 |
For IPv6-Route Source Route data as described in RFC 5095, its 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 |
Reserved |
|
8 |
64 |
|
Address |
- class pcapkit.protocols.internet.ipv6_route.DataType_IPv6_Route_Source¶
- Bases
TypedDict
Structure of IPv6-Route Source Route data [RFC 5095].
- ip: Tuple[ipaddress.IPv6Address]¶
Array of IPv6 addresses.
For IPv6-Route Type 2 data as described in RFC 6275, its 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 |
Reserved |
|
8 |
64 |
|
Home Address |
- class pcapkit.protocols.internet.ipv6_route.DataType_IPv6_Route_2¶
- Bases
TypedDict
Structure of IPv6-Route Type 2 data [RFC 6275].
- ip: ipaddress.IPv6Address¶
Home IPv6 addresses.
For IPv6-Route RPL Source data as described in RFC 6554, its 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 |
|
CmprI |
4 |
36 |
|
CmprE |
5 |
40 |
|
Pad Size |
5 |
44 |
Reserved |
|
8 |
64 |
|
Addresses |
- class pcapkit.protocols.internet.ipv6_route.DataType_IPv6_Route_RPL¶
- Bases
TypedDict
Structure of IPv6-Route RPL Source data [RFC 6554].
- ip: Tuple[Union[ipaddress.IPv4Address, ipaddress.IPv6Address]]¶
Array of IPv4 and/or IPv6 addresses.
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 |
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit
module.
- class DataType_IPv6¶
- Bases
TypedDict
Structure of IPv6 header [RFC 2460].
- version: Literal[6]¶
Version.
- next: pcapkit.const.reg.transtype.TransType¶
Next header.
- src: ipaddress.IPv6Address¶
Source address.
- dst: ipaddress.IPv6Address¶
Destination address.
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 |
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit
module.
- class DataType_IPX¶
- Bases
TypedDict
Structure of IPX header [RFC 1132].
- type: pcapkit.const.ipx.packet.Packet¶
Packet type.
- dst: DataType_IPX_Address¶
Destination address.
- src: DataType_IPX_Address¶
Source address.
For IPX address field, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Network Number |
4 |
32 |
|
Node Number |
10 |
80 |
|
Socket Number |
- class DataType_IPX_Address¶
- Bases
TypedDict
Structure of IPX address.
- socket: pcapkit.const.ipx.socket.Socket¶
Socket number.
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 |
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit
module.
- class DataType_MH¶
- Bases
TypedDict
- next: pcapkit.const.reg.transtype.TransType¶
Next header.
- type: pcapkit.const.mh.packet.Packet¶
Mobility header type.
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.
Transport Layer Protocols¶
pcapkit.protocols.transport
is collection of all protocols in
transport layer, with detailed implementation and methods.
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 |
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit
module.
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) |
- pcapkit.protocols.transport.tcp.TCP_OPT: DataType_TCP_OPT¶
TCP option
dict
parsing mapping.kind
length
type
process
comment
name
0
[RFC 793] End of Option List
1
[RFC 793] No-Operation
2
4
H
1
[RFC 793] Maximum Segment Size
3
3
B
1
[RFC 7323] Window Scale
4
2
?
[RFC 2018] SACK Permitted
5
?
P
0
2+8*N
[RFC 2018] SACK
6
6
P
0
7
6
P
0
8
10
II
2
[RFC 7323] Timestamps
9
2
?
10
3
??P
3
11
6
P
0
12
6
P
0
13
6
P
0
14
3
B
4
15
?
P
0
19
18
P
0
[RFC 2385] MD5 Signature Option
27
8
P
5
[RFC 4782] Quick-Start Response
28
4
P
6
[RFC 5482] User Timeout Option
29
?
P
7
[RFC 5925] TCP Authentication Option
30
?
P
8
[RFC 6824] Multipath TCP
34
?
P
0
[RFC 7413] Fast Open
- pcapkit.protocols.transport.tcp.process_opt: Dict[int, Callable[[pcapkit.protocols.transport.tcp.TCP, int, int], DataType_TCP_Opt]]¶
Process method for TCP options.
Code
Method
Description
0
_read_mode_donone()
do nothing
1
_read_mode_unpack()
unpack according to size
2
_read_mode_tsopt()
timestamps
3
_read_mode_pocsp()
POC service profile
4
_read_mode_acopt()
alternate checksum request
5
_read_mode_qsopt()
Quick-Start response
6
_read_mode_utopt()
user timeout option
7
_read_mode_tcpao()
TCP authentication option
8
_read_mode_mptcp()
multipath TCP
- pcapkit.protocols.transport.tcp.mptcp_opt: Dict[int, Callable[[pcapkit.protocols.transport.tcp.TCP, str, int, int], DataType_TCP_MP_Opt]]¶
Process method for multipath TCP options [RFC 6824].
Code
Method
Description
0
_read_mptcp_capable()
MP_CAPABLE
1
_read_mptcp_join()
MP_JOIN
2
_read_mptcp_dss()
DSS
3
_read_mptcp_add()
ADD_ADDR
4
_read_mptcp_remove()
REMOVE_ADDR
5
_read_mptcp_prio()
MP_PRIO
6
_read_mptcp_fail()
MP_FAIL
7
_read_mptcp_fastclose()
MP_FASTCLOSE
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit
module.
- class pcapkit.protocols.transport.tcp.DataType_TCP¶
- Bases
TypedDict
Structure of TCP header [RFC 793].
- flags: DataType_TCP_Flags¶
Flags.
- opt: Tuple[pcapkit.const.tcp.option.Option]¶
Array of TCP options.
- class pcapkit.protocols.transport.tcp.DataType_TCP_Flags¶
- Bases
TypedDict
Flags.
- class pcapkit.protocols.transport.tcp.DataType_TCP_Opt¶
- Bases
TypedDict
Structure of TCP options.
- class pcapkit.protocols.transport.tcp.DataType_TCP_OPT¶
- Bases
TypedDict
TCP option
dict
parsing mapping.
For TCP options require no process, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind |
1 |
8 |
|
Length |
2 |
16 |
|
Kind-specific Data |
For TCP options require unpack process, its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind |
1 |
8 |
|
Length |
2 |
16 |
|
Kind-specific Data |
For TCP Timestamps (TS
) option as described in RFC 7323,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind ( |
1 |
8 |
|
Length ( |
2 |
16 |
|
Timestamp Value |
6 |
48 |
|
Timestamps Echo Reply |
For TCP Partial Order Connection Service Profile (POC-SP
) option as described in RFC 1693 and RFC 6247,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind ( |
1 |
8 |
|
Length ( |
2 |
16 |
|
Start Flag |
2 |
17 |
|
End Flag |
2 |
18 |
|
Filler |
For TCP Alternate Checksum Request (CHKSUM-REQ
) option as described in RFC 1146 and RFC 6247,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind ( |
1 |
8 |
|
Length ( |
2 |
16 |
|
Checksum Algorithm |
For TCP Quick-Start Response (QS
) option as described in RFC 4782,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind ( |
1 |
8 |
|
Length ( |
2 |
16 |
Reserved (must be |
|
2 |
20 |
|
Request Rate |
3 |
24 |
|
TTL Difference |
4 |
32 |
|
QS Nounce |
7 |
62 |
Reserved (must be |
For TCP User Timeout (TIMEOUT
) option as described in RFC 5482,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind ( |
1 |
8 |
|
Length ( |
2 |
16 |
|
Granularity |
2 |
17 |
|
User Timeout |
- class pcapkit.protocols.transport.tcp.DataType_TCP_Opt_UTOPT¶
- Bases
DataType_TCP_Opt
Structure of TCP
TIMEOUT
[RFC 5482].- granularity: Literal['minutes', 'seconds']¶
Granularity.
- timeout: datetime.timedelta¶
User timeout.
For Authentication (AO
) option as described in RFC 5925,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind ( |
1 |
8 |
|
Length |
2 |
16 |
|
KeyID |
3 |
24 |
|
RNextKeyID |
4 |
32 |
|
Message Authentication Code |
For Multipath TCP (MP-TCP
) options as described in RFC 6824,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind ( |
1 |
8 |
|
Length |
2 |
16 |
|
Subtype |
2 |
20 |
|
Subtype-specific Data |
- class pcapkit.protocols.transport.tcp.DataType_TCP_Opt_MPTCP¶
- Bases
DataType_TCP_Opt
Structure of
MP-TCP
[RFC 6824].- subtype: pcapkit.const.tcp.mp_tcp_option.MPTCPOption¶
Subtype.
For Multipath Capable (MP_CAPABLE
) options as described in RFC 6824,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind ( |
1 |
8 |
|
Length ( |
2 |
16 |
|
Subtype ( |
2 |
20 |
|
Version |
3 |
24 |
|
Checksum Require Flag ( |
3 |
25 |
|
Extensibility Flag ( |
3 |
26 |
|
Unassigned ( |
3 |
31 |
|
HMAC-SHA1 Flag ( |
4 |
32 |
|
Option Sender’s Key |
12 |
96 |
|
Option Receiver’s Key
(only if option length is |
- class pcapkit.protocols.transport.tcp.DataType_TCP_Opt_MP_CAPABLE¶
- Bases
DataType_TCP_Opt_MPTCP
Structure of
MP_CAPABLE
[RFC 6824].- capable: DataType_TCP_Opt_MP_CAPABLE_Data¶
Subtype-specific data.
- class pcapkit.protocols.transport.tcp.DataType_TCP_Opt_MP_CAPABLE_Data¶
- Bases
TypedDict
Structure of
MP_CAPABLE
[RFC 6824].- flags: DataType_TCP_Opt_MP_CAPABLE_Flags¶
Flags.
For Join Connection (MP_JOIN
) options as described in RFC 6824,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind ( |
1 |
8 |
|
Length |
2 |
16 |
|
Subtype ( |
2 |
20 |
|
Handshake-specific Data |
- class pcapkit.protocols.transport.tcp.DataType_TCP_Opt_MP_JOIN¶
- Bases
DataType_TCP_Opt_MPTCP
Structure of
MP_JOIN
[RFC 6824].- connection: Optional[Literal['SYN/ACK', 'SYN', 'ACK']]¶
Join connection type.
- join: DataType_TCP_Opt_MP_JOIN_Data¶
Subtype-specific data.
- class pcapkit.protocols.transport.tcp.DataType_TCP_Opt_MP_JOIN_Data¶
- Bases
TypedDict
Structure of
MP_JOIN
[RFC 6824].
MP_JOIN-SYN
¶For Join Connection (MP_JOIN-SYN
) option for Initial SYN as described in RFC 6824,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind ( |
1 |
8 |
|
Length ( |
2 |
16 |
|
Subtype ( |
2 |
20 |
Reserved (must be |
|
2 |
23 |
|
Backup Path ( |
3 |
24 |
|
Address ID |
4 |
32 |
|
Receiver’s Token |
8 |
64 |
|
Sender’s Random Number |
- class pcapkit.protocols.transport.tcp.DataType_TCP_Opt_MP_JOIN_SYN¶
- Bases
DataType_TCP_Opt_MP_JOIN_Data
Structure of
MP_JOIN-SYN
[RFC 6824].- syn: DataType_TCP_Opt_MP_JOIN_SYN_Data¶
Subtype-specific data.
MP_JOIN-SYN/ACK
¶For Join Connection (MP_JOIN-SYN/ACK
) option for Responding SYN/ACK as described in RFC 6824,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind ( |
1 |
8 |
|
Length ( |
2 |
16 |
|
Subtype ( |
2 |
20 |
Reserved (must be |
|
2 |
23 |
|
Backup Path ( |
3 |
24 |
|
Address ID |
4 |
32 |
|
Sender’s Truncated HMAC |
12 |
96 |
|
Sender’s Random Number |
- class pcapkit.protocols.transport.tcp.DataType_TCP_Opt_MP_JOIN_SYNACK¶
- Bases
DataType_TCP_Opt_MP_JOIN_Data
Structure of
MP_JOIN-SYN/ACK
[RFC 6824].- syn: DataType_TCP_Opt_MP_JOIN_SYNACK_Data¶
Subtype-specific data.
MP_JOIN-ACK
¶For Join Connection (MP_JOIN-ACK
) option for Third ACK as described in RFC 6824,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind ( |
1 |
8 |
|
Length ( |
2 |
16 |
|
Subtype ( |
2 |
20 |
Reserved (must be |
|
4 |
32 |
|
Sender’s HMAC |
- class pcapkit.protocols.transport.tcp.DataType_TCP_Opt_MP_JOIN_ACK¶
- Bases
DataType_TCP_Opt_MP_JOIN_Data
Structure of
MP_JOIN-ACK
[RFC 6824].- syn: DataType_TCP_Opt_MP_JOIN_ACK_Data¶
Subtype-specific data.
For Data Sequence Signal (DSS
) options as described in RFC 6824,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind ( |
1 |
8 |
|
Length |
2 |
16 |
|
Subtype ( |
2 |
20 |
Reserved (must be |
|
3 |
27 |
|
DATA_FIN ( |
3 |
28 |
|
DSN Length ( |
3 |
29 |
|
DSN, SSN, Data-Level Length, CHKSUM Present ( |
3 |
30 |
|
ACK Length ( |
3 |
31 |
|
Data ACK Present ( |
4 |
32 |
|
Data ACK ( |
8/12 |
64/96 |
|
DSN ( |
12/20 |
48/160 |
|
Subflow Sequence Number |
16/24 |
128/192 |
|
Data-Level Length |
18/26 |
144/208 |
|
Checksum |
- class pcapkit.protocols.transport.tcp.DataType_TCP_Opt_DSS¶
- Bases
DataType_TCP_Opt_MPTCP
Structure of
DSS
[RFC 6824].- dss: DataType_TCP_Opt_DSS_Data¶
Subtype-specific data.
- class pcapkit.protocols.transport.tcp.DataType_TCP_Opt_DSS_Data¶
- Bases
TypedDict
Structure of
DSS
[RFC 6824].- flags: DataType_TCP_Opt_DSS_Flags¶
Flags.
For Add Address (ADD_ADDR
) options as described in RFC 6824,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind ( |
1 |
8 |
|
Length |
2 |
16 |
|
Subtype ( |
2 |
20 |
|
IP Version |
3 |
24 |
|
Address ID |
4 |
32 |
|
IP Address ( |
8/20 |
64/160 |
|
Port (optional) |
- class pcapkit.protocols.transport.tcp.DataType_TCP_Opt_ADD_ADDR¶
- Bases
DataType_TCP_Opt_MPTCP
Structure of
ADD_ADDR
[RFC 6824].- add_addr: DataType_TCP_Opt_ADD_ADDR_Data¶
Subtype-specific data.
- class pcapkit.protocols.transport.tcp.DataType_TCP_Opt_ADD_ADDR_Data¶
- Bases
TypedDict
Structure of
ADD_ADDR
[RFC 6824].- ip_ver: Literal[4, 6]¶
IP version.
- addr: Union[ipaddress.IPv4Address, ipaddress.IPv6Address]¶
IP address.
For Remove Address (REMOVE_ADDR
) options as described in RFC 6824,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind ( |
1 |
8 |
|
Length |
2 |
16 |
|
Subtype ( |
2 |
20 |
Reserved (must be |
|
3 |
24 |
|
Address ID (optional list) |
- class pcapkit.protocols.transport.tcp.DataType_TCP_Opt_REMOVE_ADDR¶
- Bases
DataType_TCP_Opt_MPTCP
Structure of
REMOVE_ADDR
[RFC 6824].- remove_addr: DataType_TCP_Opt_REMOVE_ADDR_Data¶
Subtype-specific data.
For Change Subflow Priority (MP_PRIO
) options as described in RFC 6824,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind ( |
1 |
8 |
|
Length |
2 |
16 |
|
Subtype ( |
2 |
23 |
|
Backup Path ( |
3 |
24 |
|
Address ID (optional) |
- class pcapkit.protocols.transport.tcp.DataType_TCP_Opt_MP_PRIO¶
- Bases
DataType_TCP_Opt_MPTCP
Structure of
MP_PRIO
[RFC 6824].- prio: DataType_TCP_Opt_MP_PRIO_Data¶
Subtype-specific data.
For Fallback (MP_FAIL
) options as described in RFC 6824,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind ( |
1 |
8 |
|
Length |
2 |
16 |
|
Subtype ( |
2 |
23 |
Reserved (must be |
|
4 |
32 |
|
Data Sequence Number |
- class pcapkit.protocols.transport.tcp.DataType_TCP_Opt_MP_FAIL¶
- Bases
DataType_TCP_Opt_MPTCP
Structure of
MP_FAIL
[RFC 6824].- fail: DataType_TCP_Opt_MP_FAIL_Data¶
Subtype-specific data.
For Fast Close (MP_FASTCLOSE
) options as described in RFC 6824,
its structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Kind ( |
1 |
8 |
|
Length |
2 |
16 |
|
Subtype ( |
2 |
23 |
Reserved (must be |
|
4 |
32 |
|
Option Receiver’s Key |
- class pcapkit.protocols.transport.tcp.DataType_TCP_Opt_MP_FASTCLOSE¶
- Bases
DataType_TCP_Opt_MPTCP
Structure of
MP_FASTCLOSE
[RFC 6824].- fastclose: DataType_TCP_Opt_MP_FASTCLOSE_Data¶
Subtype-specific data.
- class pcapkit.protocols.transport.tcp.DataType_TCP_Opt_MP_FASTCLOSE_Data¶
- Bases
TypedDict
Structure of
MP_FASTCLOSE
[RFC 6824].
Base Protocol¶
pcapkit.protocols.transport.transport
contains
Transport
,
which is a base class for transport layer protocols, eg.
TCP
and
UDP
.
Application Layer Protocols¶
pcapkit.protocols.application
is collection of all protocols in
application layer, with detailed implementation and methods.
FTP - File Transfer Protocol¶
pcapkit.protocols.application.ftp
contains
FTP
only,
which implements extractor for File Transfer Protocol
(FTP) *.
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit
module.
- class DataType_FTP_Request¶
- Bases
TypedDict
Structure of FTP request packet [RFC 959].
- type: Literal['request']¶
Packet type.
- command: pcapkit.corekit.infoclass.Info¶
FTP command.
- class DataType_FTP_Response¶
- Bases
TypedDict
Structure of FTP response packet [RFC 959].
- type: Literal['response']¶
Packet type.
- code: pcapkit.const.ftp.return_code.ReturnCode¶
FTP response code.
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
.
HTTP/1.* - Hypertext Transfer Protocol¶
pcapkit.protocols.application.httpv1
contains
HTTPv1
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)
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit
module.
- class DataType_HTTP¶
- Bases
TypedDict
Structure of HTTP/1.* packet [RFC 7230].
- receipt: Literal['request', 'response']¶
HTTP packet receipt.
- header: Union[DataType_HTTP_Request_Header, DataType_HTTP_Response_Header]¶
Parsed HTTP header data.
- raw: DataType_HTTP_Raw¶
Raw HTTP packet data.
- class DataType_HTTP_Raw¶
- Bases
TypedDict
Raw HTTP packet data.
- class DataType_HTTP_Request_Header¶
- Bases
TypedDict
HTTP request header.
- request: DataType_HTTP_Request_Header_Meta¶
Request metadata.
- class DataType_HTTP_Response_Header¶
- Bases
TypedDict
HTTP response header.
- response: DataType_HTTP_Response_Header_Meta¶
Response metadata.
- class DataType_HTTP_Request_Header_Meta¶
- Bases
TypedDict
Request metadata.
- version: Literal['0.9', '1.0', '1.1']¶
HTTP version string.
- class DataType_HTTP_Response_Header_Meta¶
- Bases
TypedDict
Response metadata.
- version: Literal['0.9', '1.0', '1.1']¶
HTTP version string.
HTTP/2 - Hypertext Transfer Protocol¶
pcapkit.protocols.application.httpv2
contains
HTTPv2
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 |
- pcapkit.protocols.application.httpv2._HTTP_FUNC: Dict[int, Callable[[pcapkit.protocols.application.httpv2.HTTPv2, int, int, str], DataType_HTTPv2_Frame]]¶
Process method for HTTP/2 packets.
Code
Method
Description
N/A
_read_http_none()
Unsigned
0x00
_read_http_data()
DATA
0x01
_read_http_headers()
HEADERS
0x02
_read_http_priority()
PRIORITY
0x03
_read_http_rst_stream()
RST_STREAM
0x04
_read_http_settings()
SETTINGS
0x05
_read_http_push_promise()
PUSH_PROMISE
0x06
_read_http_ping()
PING
0x07
_read_http_goaway()
GOAWAY
0x08
_read_http_window_update()
WINDOW_UPDATE
0x09
_read_http_continuation()
CONTINUATION
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit
module.
- class pcapkit.protocols.application.httpv2.DataType_HTTPv2¶
- Bases
TypedDict
Structure of HTTP/2 packet [RFC 7540].
- type: pcapkit.const.http.frame.Frame¶
Type.
- class pcapkit.protocols.application.httpv2.DataType_HTTPv2_Frame¶
- Bases
TypedDict
HTTP/2 packet data.
DATA
Frame¶For HTTP/2 DATA
frame as described in RFC 7540,
its 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 |
|
Pad Length (Optional) |
10 |
80 |
|
Data |
? |
? |
Padding (Optional) |
- class pcapkit.protocols.application.httpv2.DataType_HTTPv2_DATA¶
- Bases
DataType_HTTPv2_Frame
Structure of HTTP/2
DATA
frame [RFC 7540].- flags: DataType_HTTPv2_DATA_Flags¶
HTTP/2 packet flags.
HEADERS
Frame¶For HTTP/2 HEADERS
frame as described in RFC 7540,
its 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 |
|
Pad Length (Optional) |
10 |
80 |
|
Exclusive Flag |
10 |
81 |
|
Stream Dependency (Optional) |
14 |
112 |
|
Weight (Optional) |
15 |
120 |
|
Header Block Fragment |
? |
? |
Padding (Optional) |
- class pcapkit.protocols.application.httpv2.DataType_HTTPv2_HEADERS¶
- Bases
DataType_HTTPv2_Frame
Structure of HTTP/2
HEADERS
frame [RFC 7540].- flags: DataType_HTTPv2_HEADERS_Flags¶
HTTP/2 packet flags.
PRIORITY
Frame¶For HTTP/2 PRIORITY
frame as described in RFC 7540,
its 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 |
|
Exclusive Flag |
9 |
73 |
|
Stream Dependency |
13 |
104 |
|
Weight |
RST_STREAM
Frame¶For HTTP/2 RST_STREAM
frame as described in RFC 7540,
its 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 |
|
Error Code |
SETTINGS
Frame¶For HTTP/2 SETTINGS
frame as described in RFC 7540,
its 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 |
|
Settings |
9 |
72 |
|
Identifier |
10 |
80 |
|
Value |
- class pcapkit.protocols.application.httpv2.DataType_HTTPv2_SETTINGS¶
- Bases
DataType_HTTPv2_Frame
Structure of HTTP/2
SETTINGS
frame [RFC 7540].- flags: DataType_HTTPv2_SETTINGS_Flags¶
HTTP/2 packet flags.
- settings: Tuple[pcapkit.const.http.setting.Setting]¶
Array of HTTP/2 settings.
PUSH_PROMISE
Frame¶For HTTP/2 PUSH_PROMISE
frame as described in RFC 7540,
its 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 |
|
Pad Length (Optional) |
10 |
80 |
Reserved |
|
10 |
81 |
|
Promised Stream ID |
14 |
112 |
|
Header Block Fragment |
? |
? |
Padding (Optional) |
- class pcapkit.protocols.application.httpv2.DataType_HTTPv2_PUSH_PROMISE¶
- Bases
DataType_HTTPv2_Frame
Structure of HTTP/2
PUSH_PROMISE
frame [RFC 7540].- flags: DataType_HTTPv2_PUSH_PROMISE_Flags¶
HTTP/2 packet flags.
PING
Frame¶For HTTP/2 PING
frame as described in RFC 7540,
its 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 |
|
Opaque Data |
- class pcapkit.protocols.application.httpv2.DataType_HTTPv2_PING¶
- Bases
DataType_HTTPv2_Frame
Structure of HTTP/2
PING
frame [RFC 7540].- flags: DataType_HTTPv2_PING_Flags¶
HTTP/2 packet flags.
GOAWAY
Frame¶For HTTP/2 GOAWAY
frame as described in RFC 7540,
its 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 |
Reserved |
|
9 |
73 |
|
Last Stream ID |
13 |
104 |
|
Error Code |
17 |
136 |
|
Additional Debug Data (Optional) |
WINDOW_UPDATE
Frame¶For HTTP/2 WINDOW_UPDATE
frame as described in RFC 7540,
its 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 |
Reserved |
|
9 |
73 |
|
Window Size Increment |
CONTINUATION
Frame¶For HTTP/2 CONTINUATION
frame as described in RFC 7540,
its 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 |
73 |
|
Header Block Fragment |
- class pcapkit.protocols.application.httpv2.DataType_HTTPv2_CONTINUATION¶
- Bases
DataType_HTTPv2_Frame
Structure of HTTP/2
CONTINUATION
frame [RFC 7540].- flags: DataType_HTTPv2_CONTINUATION_Flags¶
HTTP/2 packet flags.
- class pcapkit.protocols.application.httpv2.DataType_HTTPv2_CONTINUATION_Flags¶
- Bases
TypedDict
HTTP/2 packet flags.
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.
Miscellaneous Protocols¶
Raw Packet Data¶
pcapkit.protocols.misc.raw
contains
Raw
only, which implements
extractor for unknown protocol, and constructs a
Protocol
like object.
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit
module.
No-Payload Packet¶
pcapkit.protocols.null
contains
NoPayload
only, which
implements a Protocol
like
object whose payload is recursively
NoPayload
itself.
Base Protocol¶
Reassembly Packets & Datagrams¶
pcapkit.reassembly
bases on algorithms described
in RFC 815, implements datagram reassembly of IP and
TCP packets.
Fragmented Packets Reassembly¶
pcapkit.foundation.reassembly.reassembly
contains
class:~pcapkit.foundation.reassembly.reassembly.Reassembly only,
which is an abstract base class for all reassembly classes,
bases on algorithms described in RFC 815, implements
datagram reassembly of IP and TCP packets.
IP Datagram Reassembly¶
pcapkit.foundation.reassembly.ip
contains
IP_Reassembly
only, which reconstructs fragmented IP packets back to
origin. 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.
Notation¶
|
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 |
Algorithm¶
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.
}
Implementation¶
IPv4 Datagram Reassembly¶
pcapkit.foundation.reassembly.ipv4
contains
IPv4_Reassembly
only, which reconstructs fragmented IPv4 packets back to
origin. Please refer to IP Datagram Reassembly for more information.
Data Structure¶
- ipv4.packet¶
Data structure for IPv4 datagram reassembly (
reassembly()
) is as following:- ipv4.datagram¶
Data structure for reassembled IPv4 datagram (element from
datagram
tuple) is as following:- ipv4.buffer¶
Data structure for internal buffering when performing reassembly algorithms (
_buffer
) is as following:(dict) buffer --> memory buffer for reassembly |--> (tuple) BUFID : (dict) | |--> ipv4.src | | |--> ipc6.dst | | |--> ipv4.label | | |--> ipv4_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' : (bytearray) header buffer | |--> 'datagram' : (bytearray) data buffer, holes set to b'\x00' |--> (tuple) BUFID ...
Implementation¶
IPv6 Datagram Reassembly¶
pcapkit.foundation.reassembly.ipv6
contains
IPv6_Reassembly
only, which reconstructs fragmented IPv6 packets back to
origin. Please refer to IP Datagram Reassembly for more information.
Data Structure¶
- ipv6.packet¶
Data structure for IPv6 datagram 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 bytearray 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
datagram
tuple) is as following:(tuple) datagram |--> (dict) data | |--> 'NotImplemented' : (bool) True --> implemented | |--> 'index' : (tuple) packet numbers | | |--> (int) original packet range number | |--> 'packet' : (Optional[bytes]) reassembled IPv6 packet |--> (dict) data | |--> 'NotImplemented' : (bool) False --> not implemented | |--> 'index' : (tuple) packet numbers | | |--> (int) original packet range number | |--> 'header' : (Optional[bytes]) IPv6 header | |--> 'payload' : (Optional[tuple]) partially reassembled IPv6 payload | |--> (Optional[bytes]) IPv4 payload fragment |--> (dict) data ...
- ipv6.buffer¶
Data structure for internal buffering when performing reassembly algorithms (
_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' : (bytearray) header buffer | |--> 'datagram' : (bytearray) data buffer, holes set to b'\x00' |--> (tuple) BUFID ...
Implementation¶
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.
Notation¶
|
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 |
Algorithm¶
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.
Data Structure¶
- tcp.packet¶
Data structure for TCP datagram reassembly (
reassembly()
) is as following:packet_dict = Info( bufid = tuple( ip.src, # source IP address ip.dst, # destination IP address tcp.srcport, # source port tcp.dstport, # destination port ), 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 payload = tcp.raw, # raw bytearray type payload )
- tcp.datagram¶
Data structure for reassembled TCP datagram (element from
datagram
tuple) is as following:(tuple) datagram |--> (Info) data | |--> 'NotImplemented' : (bool) True --> implemented | |--> 'id' : (Info) original packet identifier | | |--> 'src' --> (tuple) | | | |--> (str) ip.src | | | |--> (int) tcp.srcport | | |--> 'dst' --> (tuple) | | | |--> (str) ip.dst | | | |--> (int) tcp.dstport | | |--> 'ack' --> (int) original packet ACK number | |--> 'index' : (tuple) packet numbers | | |--> (int) original packet range number | |--> 'payload' : (Optional[bytes]) reassembled application layer data | |--> 'packets' : (Tuple[Analysis]) analysed payload |--> (Info) data | |--> 'NotImplemented' : (bool) False --> not implemented | |--> 'id' : (Info) original packet identifier | | |--> 'src' --> (tuple) | | | |--> (str) ip.src | | | |--> (int) tcp.srcport | | |--> 'dst' --> (tuple) | | | |--> (str) ip.dst | | | |--> (int) tcp.dstport | | |--> 'ack' --> (int) original packet ACK number | |--> 'ack' : (int) original packet ACK number | |--> 'index' : (tuple) packet numbers | | |--> (int) original packet range number | |--> 'payload' : (Optional[tuple]) partially reassembled payload | | |--> (Optional[bytes]) payload fragment | |--> 'packets' : (Tuple[Analysis]) analysed payloads |--> (Info) data ...
- tcp.buffer¶
Data structure for internal buffering when performing reassembly algorithms (
_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 | |--> (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 ...
Implementation¶
Core Utilities¶
pcapkit.corekit
is the collection of core utilities
for pcapkit
implementation, including dict
like
class Info
,
tuple
like class VersionInfo
,
and protocol collection class ProtoChain
.
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.
Protocol Chain¶
pcapkit.corekit.protochain
contains special protocol
collection class ProtoChain
.
Version Info¶
pcapkit.corekit.version
contains tuple
like class VersionInfo
,
which is originally designed alike sys.version_info
.
Dump Utilities¶
pcapkit.dumpkit
is the collection of dumpers for
pcapkit
implementation, which is alike those described
in dictdumper
.
PCAP Dumper¶
Undefined Dumper¶
Compatibility Tools¶
pcapkit.toolkit
provides several utility functions for
compatibility of multiple engine support.
Default (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.
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.
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.
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.
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 validations.
Decorator Functions¶
pcapkit.utilities.decorators
contains several useful
decorators, including seekset()
and beholder()
.
- @pcapkit.utilities.decorators.seekset[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)
See also
pcapkit.protocols.protocol.Protocol._read_packet()
- Parameters
func (Callable[Concatenate[Protocol, P], R]) –
- Return type
Callable[P, R]
- @pcapkit.utilities.decorators.beholder[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)
See also
pcapkit.protocols.protocol.Protocol._decode_next_layer()
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.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.BoolError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be
bool
type.- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.BytearrayError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be
bytearray
type.- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.BytesError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be
bytes
type.- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.CallableError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be callable.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.ComparisonError(*args, quiet=False, **kwargs)[source]¶
-
Rich comparison not supported between instances.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.ComplexError(*args, quiet=False, **kwargs)[source]¶
-
The function is not defined for complex instance.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.DictError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be
dict
type.- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.DigitError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be (a) number(s).
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.EndianError(*args, quiet=False, **kwargs)[source]¶
Bases:
BaseError
,ValueError
Invalid endian (byte order).
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.EnumError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be enumeration protocol type.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.FileError(*args, quiet=False, **kwargs)[source]¶
-
[Errno 5] Wrong file format.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.FileExists(*args, quiet=False, **kwargs)[source]¶
Bases:
BaseError
,FileExistsError
[Errno 17] File already exists.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.FileNotFound(*args, quiet=False, **kwargs)[source]¶
Bases:
BaseError
,FileNotFoundError
[Errno 2] File not found.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.FormatError(*args, quiet=False, **kwargs)[source]¶
Bases:
BaseError
,AttributeError
Unknown format(s).
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.FragmentError(*args, quiet=False, **kwargs)[source]¶
-
Invalid fragment dict.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.IOObjError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be file-like object.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.IPError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be IP address.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.IndexNotFound(*args, quiet=False, **kwargs)[source]¶
Bases:
BaseError
,ValueError
Protocol not in ProtoChain.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.InfoError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be
Info
instance.- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.IntError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be integral.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.IterableError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be iterable.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.KeyExists(*args, quiet=False, **kwargs)[source]¶
Bases:
BaseError
,ValueError
Key already exists.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.ListError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be
list
type.- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.MissingKeyError(*args, quiet=False, **kwargs)[source]¶
-
Key not found.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.ModuleNotFound(*args, quiet=False, **kwargs)[source]¶
Bases:
BaseError
,ModuleNotFoundError
Module not found.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.PacketError(*args, quiet=False, **kwargs)[source]¶
-
Invalid packet dict.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.ProtocolError(*args, quiet=False, **kwargs)[source]¶
Bases:
BaseError
,ValueError
Invalid protocol format.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.ProtocolNotFound(*args, quiet=False, **kwargs)[source]¶
Bases:
BaseError
,IndexError
Protocol not found in ProtoChain.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.ProtocolNotImplemented(*args, quiet=False, **kwargs)[source]¶
Bases:
BaseError
,NotImplementedError
Protocol not implemented.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.ProtocolUnbound(*args, quiet=False, **kwargs)[source]¶
-
Protocol slice unbound.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.RealError(*args, quiet=False, **kwargs)[source]¶
-
The function is not defined for real number.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.RegistryError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be registry type.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.StringError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be
str
type.- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.StructError(*args, eof=False, **kwargs)[source]¶
-
Unpack failed.
- Parameters
args (Any) –
eof (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.TupleError(*args, quiet=False, **kwargs)[source]¶
-
The argument(s) must be
tuple
type.- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.UnsupportedCall(*args, quiet=False, **kwargs)[source]¶
Bases:
BaseError
,AttributeError
Unsupported function or property call.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.VendorNotImplemented(*args, quiet=False, **kwargs)[source]¶
Bases:
BaseError
,NotImplementedError
Vendor not implemented.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.exceptions.VersionError(*args, quiet=False, **kwargs)[source]¶
Bases:
BaseError
,ValueError
Unknown IP version.
- Parameters
args (Any) –
quiet (bool) –
kwargs (Any) –
- Return type
None
- 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.- Returns
Stack level until internal stacks, i.e. contains
/pcapkit/
.- Return type
Logging System¶
pcapkit.utilities.logging
contains naïve integration
of the Python logging system, i.e. a logging.Logger
instance as logger
.
Validation Utilities¶
pcapkit.utilities.validations
contains functions to
validate arguments for functions and classes. It was first
used in PyNTLib as validators.
User Defined Warnings¶
pcapkit.warnings
refined built-in warnings.
- exception pcapkit.utilities.warnings.AttributeWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,RuntimeWarning
Unsupported attribute.
- Parameters
args (Any) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.warnings.BaseWarning(*args, **kwargs)[source]¶
Bases:
UserWarning
Base warning class of all kinds.
- Parameters
args (Any) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.warnings.DPKTWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,ResourceWarning
Warnings on DPKT usage.
- Parameters
args (Any) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.warnings.DevModeWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,RuntimeWarning
Run in development mode.
- Parameters
args (Any) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.warnings.EmojiWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,ResourceWarning
Warnings on Emoji usage.
- Parameters
args (Any) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.warnings.EngineWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,ImportWarning
Unsupported extraction engine.
- Parameters
args (Any) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.warnings.FileWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,RuntimeWarning
Warning on file(s).
- Parameters
args (Any) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.warnings.FormatWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,ImportWarning
Warning on unknown format(s).
- Parameters
args (Any) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.warnings.InvalidVendorWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,ImportWarning
Vendor CLI invalid updater.
- Parameters
args (Any) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.warnings.LayerWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,RuntimeWarning
Unrecognised layer.
- Parameters
args (Any) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.warnings.ProtocolWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,RuntimeWarning
Unrecognised protocol.
- Parameters
args (Any) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.warnings.PySharkWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,ResourceWarning
Warnings on PyShark usage.
- Parameters
args (Any) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.warnings.ScapyWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,ResourceWarning
Warnings on Scapy usage.
- Parameters
args (Any) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.warnings.VendorRequestWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,RuntimeWarning
Vendor request connection failed.
- Parameters
args (Any) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.warnings.VendorRuntimeWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,RuntimeWarning
Vendor failed during runtime.
- Parameters
args (Any) –
kwargs (Any) –
- Return type
None
- exception pcapkit.utilities.warnings.VendorWarning(*args, **kwargs)[source]¶
Bases:
BaseWarning
,ResourceWarning
Warnings on vendor usage.
- Parameters
args (Any) –
kwargs (Any) –
- Return type
None
Constant Enumerations¶
ARP Constant Enumerations¶
ARP Hardware Types *¶
- 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]
- AEthernet = 257¶
AEthernet [Geoffroy Gramaize]
- ARPSec = 30¶
ARPSec [Jerome Etienne]
- Amateur_Radio_AX_25 = 3¶
Amateur Radio AX.25 [Philip Koch]
- Asynchronous_Transmission_Mode_16 = 16¶
Asynchronous Transmission Mode (ATM) [JXB2]
- Asynchronous_Transmission_Mode_21 = 21¶
Asynchronous Transmission Mode (ATM) [Mike Burrows]
- Autonet_Short_Address = 10¶
Autonet Short Address [Mike Burrows]
- Chaos = 5¶
Chaos [Gill Pratt]
- EUI_64 = 27¶
EUI-64 [Kenji Fujisawa]
- Ethernet = 1¶
Ethernet (10Mb) [Jon Postel]
- Experimental_Ethernet = 2¶
Experimental Ethernet (3Mb) [Jon Postel]
- Frame_Relay = 15¶
Frame Relay [Andy Malis]
- HDLC = 17¶
HDLC [Jon Postel]
- HFI = 37¶
HFI [Tseng-Hui Lin]
- HIPARP = 28¶
HIPARP [Jean Michel Pittet]
- Hyperchannel = 8¶
Hyperchannel [Jon Postel]
- IEEE_1394_1995 = 24¶
IEEE 1394.1995 [Myron Hattig]
- IEEE_802_Networks = 6¶
IEEE 802 Networks [Jon Postel]
- IP_and_ARP_over_ISO_7816_3 = 29¶
IP and ARP over ISO 7816-3 [Scott Guthery]
- Lanstar = 9¶
Lanstar [Tom Unger]
- LocalNet = 12¶
LocalNet (IBM PCNet or SYTEK LocalNET) [Joseph Murdock]
- LocalTalk = 11¶
LocalTalk [Joyce K Reynolds]
- MIL_STD_188_220 = 22¶
MIL-STD-188-220 [Herb Jensen]
- Metricom = 23¶
Metricom [Jonathan Stone]
- Proteon_ProNET_Token_Ring = 4¶
Proteon ProNET Token Ring [Avri Doria]
- Pure_IP = 35¶
Pure IP [Inaky Perez-Gonzalez]
- SMDS = 14¶
SMDS [George Clapp]
- Serial_Line = 20¶
Serial Line [Jon Postel]
- 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]
- Twinaxial = 26¶
Twinaxial [Marion Pitts]
- Ultra_link = 13¶
Ultra link [Rajiv Dhingra]
- Wiegand_Interface = 34¶
Wiegand Interface [Scott Guthery 2]
Operation Codes †¶
- 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_Grouplist_Reply = 21¶
MARS-Grouplist-Reply [Grenville Armitage]
- MARS_Grouplist_Request = 20¶
MARS-Grouplist-Request [Grenville Armitage]
- MARS_Join = 14¶
MARS-Join [Grenville Armitage]
- MARS_Leave = 15¶
MARS-Leave [Grenville Armitage]
- MARS_MServ = 13¶
MARS-MServ [Grenville Armitage]
- MARS_Multi = 12¶
MARS-Multi [Grenville Armitage]
- MARS_NAK = 16¶
MARS-NAK [Grenville Armitage]
- MARS_Redirect_Map = 22¶
MARS-Redirect-Map [Grenville Armitage]
- MARS_Request = 11¶
MARS-Request [Grenville Armitage]
- MARS_SJoin = 18¶
MARS-SJoin [Grenville Armitage]
- MARS_SLeave = 19¶
MARS-SLeave [Grenville Armitage]
- MARS_Unserv = 17¶
MARS-Unserv [Grenville Armitage]
FTP Constant Enumerations¶
FTP Commands *¶
FTP Return Codes †¶
HIP Constant Enumerations¶
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 ID ♦¶
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
HTTP Constant Enumerations¶
HTTP/2 Error Code *¶
HTTP/2 Frame Type †¶
HTTP/2 Settings ‡¶
IPv4 Constant Enumerations¶
Classification Level Encodings¶
Option Classes¶
IP Option Numbers *¶
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 Constant Enumerations¶
IPv6 Extension Header Types *¶
Destination Options and Hop-by-Hop Options †¶
IPv6 QS Functions¶
IPv6 Router Alert Option Values ‡¶
Routing Types §¶
Seed-ID Types¶
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¶
IPX Packet Types *¶
IPX Socket Types †¶
MH Constant Enumerations¶
Mobility Header Types *¶
OSPF Constant Enumerations¶
Authentication Codes *¶
OSPF Packet Type †¶
Protocol Type Registry Constant Enumerations¶
LINK-LAYER HEADER TYPES *¶
- 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
- APPLE_IP_OVER_IEEE1394 = 138¶
[
DLT_APPLE_IP_OVER_IEEE1394
] Apple IP-over-IEEE 1394 cooked header.
- 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.
- 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.
- 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.
- 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.
- AX25 = 3¶
[
DLT_AX25
] AX.25 packet, with nothing preceding it.
- AX25_KISS = 202¶
[
DLT_AX25_KISS
] AX.25 packet, with a 1-byte KISS header containing a type indicator.
- 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.
- BLUETOOTH_BREDR_BB = 255¶
[
DLT_BLUETOOTH_BREDR_BB
] Bluetooth Basic Rate and Enhanced Data Rate baseband packets.
- 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.
- 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.
- 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.
- BLUETOOTH_LE_LL_WITH_PHDR = 256¶
[
DLT_BLUETOOTH_LE_LL_WITH_PHDR
] Bluetooth Low Energy link-layer packets.
- BLUETOOTH_LINUX_MONITOR = 254¶
[
DLT_BLUETOOTH_LINUX_MONITOR
] Bluetooth Linux Monitor encapsulation of traffic for the BlueZ stack.
- CAN_SOCKETCAN = 227¶
[
DLT_CAN_SOCKETCAN
] CAN (Controller Area Network) frames, with a pseudo- header followed by the frame payload.
- C_HDLC = 104¶
[
DLT_C_HDLC
] Cisco PPP with HDLC framing, as per section 4.3.1 of RFC 1547.
- 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”.
- 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.
- DISPLAYPORT_AUX = 275¶
[
DLT_DISPLAYPORT_AUX
] DisplayPort AUX channel monitoring data as specified by VESA DisplayPort (DP) Standard preceded by a pseudo-header.
- 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.
- DOCSIS31_XRA31 = 273¶
[
DLT_DOCSIS31_XRA31
] DOCSIS packets and bursts, preceded by a pseudo- header giving metadata about the packet.
- 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.
- 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.
- 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.
- EBHSCR = 279¶
[
DLT_EBHSCR
] Elektrobit High Speed Capture and Replay (EBHSCR) format.
- 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.
- 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.
- ERF = 197¶
[
DLT_ERF
] Various link-layer types, with a pseudo-header, for Endace DAG cards; encapsulates Endace ERF records.
- ETHERNET = 1¶
[
DLT_EN10MB
] IEEE 802.3 Ethernet (10Mb, 100Mb, 1000Mb, and up); the 10MB in the DLT_ name is historical.
- 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.
- ETW = 290¶
[
DLT_ETW
] Event Tracing for Windows messages, beginning with a pseudo- header.
- 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.
- FDDI = 10¶
[
DLT_FDDI
] FDDI, as specified by ANSI INCITS 239-1994.
- FLEXRAY = 210¶
[
DLT_FLEXRAY
] FlexRay automotive bus frames or symbols, preceded by a pseudo-header.
- 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.
- 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.
- GPF_F = 171¶
[
DLT_GPF_F
] Frame-mapped generic framing procedure, as specified by ITU-T Recommendation G.7041/Y.1303.
- GPF_T = 170¶
[
DLT_GPF_T
] Transparent-mapped generic framing procedure, as specified by ITU-T Recommendation G.7041/Y.1303.
- GPRS_LLC = 169¶
[
DLT_GPRS_LLC
] General Packet Radio Service Logical Link Control, as defined by 3GPP TS 04.64.
- IEEE802_11 = 105¶
[
DLT_IEEE802_11
] IEEE 802.11 wireless LAN.
- IEEE802_11_AVS = 163¶
[
DLT_IEEE802_11_RADIO_AVS
] AVS monitor mode information followed by an 802.11 header.
- IEEE802_11_PRISM = 119¶
[
DLT_PRISM_HEADER
] Prism monitor mode information followed by an 802.11 header.
- IEEE802_11_RADIOTAP = 127¶
[
DLT_IEEE802_11_RADIO
] Radiotap link-layer information followed by an 802.11 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.
- 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).
- 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.
- 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.
- IEEE802_5 = 6¶
[
DLT_IEEE802
] IEEE 802.5 Token Ring; the IEEE802, without _5, in the DLT_ name is historical.
- 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.
- IPMB_LINUX = 209¶
[
DLT_IPMB_LINUX
] IPMB over an I2C circuit, with a Linux-specific pseudo- header.
- 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.
- IPNET = 226¶
[
DLT_IPNET
] Solaris ipnet pseudo-header, followed by an IPv4 or IPv6 datagram.
- IPOIB = 242¶
[
DLT_IPOIB
] IP-over-InfiniBand, as specified by RFC 4391 section 6.
- 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.
- 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.
- 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.
- 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).
- 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.
- LIN = 212¶
[
DLT_LIN
] Local Interconnect Network (LIN) automotive bus, preceded by a pseudo-header.
- 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.
- 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.
- LINUX_SLL = 113¶
[
DLT_LINUX_SLL
] Linux “cooked” capture encapsulation.
- LINUX_SLL2 = 276¶
[
DLT_LINUX_SLL2
] Linux “cooked” capture encapsulation v2.
- 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.
- LORATAP = 270¶
[
DLT_LORATAP
] LoRaTap pseudo-header, followed by the payload, which is typically the PHYPayload from the LoRaWan specification.
- 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.
- MFR = 182¶
[
DLT_MFR
] FRF.16.1 Multi-Link Frame Relay frames, beginning with an FRF.12 Interface fragmentation format fragmentation header.
- 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”).
- MTP2 = 140¶
[
DLT_MTP2
] Signaling System 7 Message Transfer Part Level 2, as specified by ITU-T Recommendation Q.703.
- 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.
- 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.
- MUX27010 = 236¶
[
DLT_MUX27010
] Variant of 3GPP TS 27.010 multiplexing protocol (similar to, but not the same as, 27.010).
- 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.
- NETLINK = 253¶
[
DLT_NETLINK
] Linux Netlink capture encapsulation.
- 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.
- NFLOG = 239¶
[
DLT_NFLOG
] Linux netlink NETLINK NFLOG socket log messages.
- 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.
- NORDIC_BLE = 272¶
[
DLT_NORDIC_BLE
] Messages to and from a Nordic Semiconductor nRF Sniffer for Bluetooth LE packets, beginning with a pseudo-header.
- 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.
- OPENVIZSLA = 278¶
[
DLT_OPENVIZSLA
] Openvizsla FPGA-based USB sniffer.
- 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.)
- PKTAP = 258¶
[
DLT_PKTAP
] Apple PKTAP capture encapsulation.
- 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.
- 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.
- PPP_ETHER = 51¶
[
DLT_PPP_ETHER
] PPPoE; the packet begins with a PPPoE header, as per RFC 2516.
- 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_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.
- 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.
- 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.
- 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.
- RDS = 265¶
[
DLT_RDS
] Radio data system (RDS) groups, as per IEC 62106, encapsulated in this form.
- 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.
- 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.
- SCTP = 248¶
[
DLT_SCTP
] SCTP packets, as defined by RFC 4960, with no lower-level protocols such as IPv4 or IPv6.
- 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.
- SITA = 196¶
[
DLT_SITA
] Various link-layer types, with a pseudo-header, for SITA.
- SLIP = 8¶
[
DLT_SLIP
] SLIP, encapsulated with a LINKTYPE_SLIP header.
- 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.
- SUNATM = 123¶
[
DLT_SUNATM
] ATM traffic, encapsulated as per the scheme used by SunATM devices.
- USBPCAP = 249¶
[
DLT_USBPCAP
] USB packets, beginning with a USBPcap header.
- 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.
- USB_DARWIN = 266¶
[
DLT_USB_DARWIN
] USB packets, beginning with a Darwin (macOS, etc.) USB header.
- 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.
- 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.
- USER0 = 147¶
[
DLT_USER0
] Reserved for private use; see above.
- USER1 = 148¶
[
DLT_USER1
] 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.
- 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.
- 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
- VSOCK = 271¶
[
DLT_VSOCK
] Protocol for communication between host and guest machines in VMware and KVM hypervisors.
- WATTSTOPPER_DLM = 263¶
[
DLT_WATTSTOPPER_DLM
] Formats for WattStopper Digital Lighting Management (DLM) and Legrand Nitoo Open protocol common packet structure captures.
- 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.
- 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.
- 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.
ETHER TYPES †¶
- 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
- ARAI_Bunkichi = 33188¶
ARAI Bunkichi [Neil Sembower]
- ATOMIC = 34527¶
ATOMIC [Joe Touch]
- AT_T_0x8008 = 32776¶
AT&T [Neil Sembower]
- AT_T_0x8046 = 32838¶
AT&T [Neil Sembower]
- AT_T_0x8047 = 32839¶
AT&T [Neil Sembower]
- AT_T_0x8069 = 32873¶
AT&T [Neil Sembower]
- Aeonic_Systems = 32822¶
Aeonic Systems [Neil Sembower]
- Alpha_Micro = 33098¶
Alpha Micro [Neil Sembower]
- Apollo_Computer = 33015¶
Apollo Computer [Neil Sembower]
- Apollo_Domain = 32793¶
Apollo Domain [Neil Sembower]
- AppleTalk_AARP = 33011¶
AppleTalk AARP (Kinetics) [Neil Sembower]
- Appletalk = 32923¶
Appletalk [Neil Sembower]
- Applitek_Corporation = 32967¶
Applitek Corporation [Neil Sembower]
- Autophon = 32874¶
Autophon [Neil Sembower]
- BBN_Simnet = 21000¶
BBN Simnet [Neil Sembower]
- BBN_VITAL_LanBridge_cache = 65280¶
BBN VITAL-LanBridge cache [Neil Sembower]
- BIIN_0x814D = 33101¶
BIIN [Neil Sembower]
- BIIN_0x814E = 33102¶
BIIN [Neil Sembower]
- Banyan_Systems_0x80C4 = 32964¶
Banyan Systems [Neil Sembower]
- Banyan_Systems_0x80C5 = 32965¶
Banyan Systems [Neil Sembower]
- Banyan_VINES = 2989¶
Banyan VINES [Neil Sembower]
- Berkeley_Trailer_nego = 4096¶
Berkeley Trailer nego [Neil Sembower]
- Cabletron = 28724¶
Cabletron [Neil Sembower]
- Chaosnet = 2052¶
Chaosnet [Neil Sembower]
- ComDesign = 32876¶
ComDesign [Neil Sembower]
- Computgraphic_Corp = 32877¶
Computgraphic Corp. [Neil Sembower]
- Counterpoint_Computers = 32866¶
Counterpoint Computers [Neil Sembower]
- Customer_VLAN_Tag_Type = 33024¶
Customer VLAN Tag Type (C-Tag, formerly called the Q-Tag) (initially Wellfleet) [RFC 7042]
- DEC_Customer_Protocol = 24582¶
DEC Customer Protocol [Neil Sembower]
- DEC_DECNET_Phase_IV_Route = 24579¶
DEC DECNET Phase IV Route [Neil Sembower]
- DEC_Diagnostic_Protocol = 24581¶
DEC Diagnostic Protocol [Neil Sembower]
- DEC_Ethernet_Encryption = 32829¶
DEC Ethernet Encryption [Neil Sembower]
- DEC_LANBridge = 32824¶
DEC LANBridge [Neil Sembower]
- DEC_LAN_Traffic_Monitor = 32831¶
DEC LAN Traffic Monitor [Neil Sembower]
- DEC_LAT = 24580¶
DEC LAT [Neil Sembower]
- DEC_LAVC_SCA = 24583¶
DEC LAVC, SCA [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_Unassigned_0x6000 = 24576¶
DEC Unassigned (Exp.) [Neil Sembower]
- DEC_Unassigned_0x803E = 32830¶
DEC Unassigned [Neil Sembower]
- DLOG_0x0660 = 1632¶
DLOG [Neil Sembower]
- DLOG_0x0661 = 1633¶
DLOG [Neil Sembower]
- Dansk_Data_Elektronik = 32891¶
Dansk Data Elektronik [Neil Sembower]
- Delta_Controls = 34526¶
Delta Controls [Neil Sembower]
- ECMA_Internet = 2051¶
ECMA Internet [Neil Sembower]
- EtherType_3Com_TCP_IP_Sys = 36866¶
3Com(Bridge) TCP-IP Sys [Neil Sembower]
- EtherType_3Com_XNS_Sys_Mgmt = 36865¶
3Com(Bridge) XNS Sys Mgmt [Neil Sembower]
- EtherType_3Com_loop_detect = 36867¶
3Com(Bridge) loop detect [Neil Sembower]
- Ethernet_NIC_hardware_and_software_testing = 34850¶
Ethernet NIC hardware and software testing [Wind River]
- Evans_Sutherland = 32861¶
Evans & Sutherland [Neil Sembower]
- Excelan = 32784¶
Excelan [Neil Sembower]
- ExperData = 32841¶
ExperData [Neil Sembower]
- General_Dynamics = 32872¶
General Dynamics [Neil Sembower]
- GeoNetworking_as_defined_in_ETSI_EN_302_636_4_1 = 35143¶
GeoNetworking as defined in ETSI EN 302 636-4-1 [IEEE]
- HIPPI_FP_encapsulation = 33152¶
HIPPI-FP encapsulation [Neil Sembower]
- HP_Probe = 32773¶
HP Probe [Neil Sembower]
- Hayes_Microcomputers = 33072¶
Hayes Microcomputers [Neil Sembower]
- IBM_SNA_Service_on_Ether = 32981¶
IBM SNA Service on Ether [Neil Sembower]
- IEEE_Std_802_11_Fast_Roaming_Remote_Request = 35085¶
IEEE Std 802.11 - Fast Roaming Remote Request (802.11r) [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]
- IEEE_Std_802_1Q_Multiple_Multicast_Registration_Protocol = 35062¶
IEEE Std 802.1Q - Multiple Multicast Registration Protocol (MMRP) [IEEE]
- IEEE_Std_802_1Q_Multiple_VLAN_Registration_Protocol = 35061¶
IEEE Std 802.1Q - Multiple VLAN Registration Protocol (MVRP) [IEEE]
- IEEE_Std_802_1Q_Service_VLAN_tag_identifier = 34984¶
IEEE Std 802.1Q - Service VLAN tag identifier (S-Tag) [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]
- IEEE_Std_802_1X_Port_based_network_access_control = 34958¶
IEEE Std 802.1X - Port-based network access control [IEEE]
- IEEE_Std_802_21_Media_Independent_Handover_Protocol = 35095¶
IEEE Std 802.21 - Media Independent Handover Protocol [IEEE]
- IEEE_Std_802_3_Ethernet_Passive_Optical_Network = 34824¶
IEEE Std 802.3 - Ethernet Passive Optical Network (EPON) [EPON][RFC 7042]
- 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]
- Little_Machines = 32864¶
Little Machines [Neil Sembower]
- Logicraft = 33096¶
Logicraft [Neil Sembower]
- Loopback = 36864¶
Loopback [Neil Sembower]
- Matra = 32890¶
Matra [Neil Sembower]
- Merit_Internodal = 32892¶
Merit Internodal [Hans Werner Braun]
- Motorola_Computer = 33165¶
Motorola Computer [Neil Sembower]
- Multicast_Channel_Allocation_Protocol = 34913¶
Multicast Channel Allocation Protocol (MCAP) [RFC 7042]
- NBS_Internet = 2050¶
NBS Internet [Neil Sembower]
- Nestar = 32774¶
Nestar [Neil Sembower]
- Network_Computing_Devices = 33097¶
Network Computing Devices [Neil Sembower]
- Nixdorf = 1024¶
Nixdorf [Neil Sembower]
- Nixdorf_Computers = 32931¶
Nixdorf Computers [Neil Sembower]
- PCS_Basic_Block_Protocol = 16962¶
PCS Basic Block Protocol [Neil Sembower]
- PPP_over_Ethernet_Session_Stage = 34916¶
PPP over Ethernet (PPPoE) Session Stage [RFC 2516][RFC 8822]
- PUP_Addr_Trans_0x0201 = 513¶
PUP Addr Trans (see 0A01) [Neil Sembower]
- PUP_Addr_Trans_0x0A01 = 2561¶
PUP Addr Trans [Neil Sembower]
- Pacer_Software = 32966¶
Pacer Software [Neil Sembower]
- Planning_Research_Corp = 32836¶
Planning Research Corp. [Neil Sembower]
- Proteon = 28720¶
Proteon [Neil Sembower]
- Provider_Backbone_Bridging_Instance_tag = 35047¶
Provider Backbone Bridging Instance tag [IEEE Std 802.1Q-2014]
- Rational_Corp = 33104¶
Rational Corp [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]
- Retix = 33010¶
Retix [Neil Sembower]
- Reverse_Address_Resolution_Protocol = 32821¶
Reverse Address Resolution Protocol (RARP) [RFC 903][Joseph Murdock]
- SECTRA = 34523¶
SECTRA [Neil Sembower]
- SGI_Time_Warner_prop = 33150¶
SGI/Time Warner prop. [Neil Sembower]
- SGI_bounce_server = 32790¶
SGI bounce server [Andrew Cherenson]
- SGI_diagnostics = 32787¶
SGI diagnostics [Andrew Cherenson]
- SGI_network_games = 32788¶
SGI network games [Andrew Cherenson]
- SGI_reserved = 32789¶
SGI reserved [Andrew Cherenson]
- SNMP = 33100¶
SNMP [Joyce K Reynolds]
- STP_HIPPI_ST = 33153¶
STP, HIPPI-ST [Neil Sembower]
- Slow_Protocols = 34825¶
Slow Protocols (Link Aggregation, OAM, etc.) [IEEE]
- Spider_Systems_Ltd = 32927¶
Spider Systems Ltd. [Neil Sembower]
- Stanford_V_Kernel_exp = 32859¶
Stanford V Kernel exp. [Neil Sembower]
- Stanford_V_Kernel_prod = 32860¶
Stanford V Kernel prod. [Neil Sembower]
- Symbolics_Private = 2076¶
Symbolics Private [David Plummer]
- Technically_Elite_Concept = 33103¶
Technically Elite Concept [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]
- Tigan_Inc = 32815¶
Tigan, Inc. [Neil Sembower]
Tymshare [Neil Sembower]
- Ungermann_Bass_dia_loop = 28674¶
Ungermann-Bass dia/loop [Neil Sembower]
- Ungermann_Bass_download = 28672¶
Ungermann-Bass download [Neil Sembower]
- Ungermann_Bass_net_debugr = 2304¶
Ungermann-Bass net debugr [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]
- VG_Laboratory_Systems = 33073¶
VG Laboratory Systems [Neil Sembower]
- Valid_Systems = 5632¶
Valid Systems [Neil Sembower]
- Varian_Associates = 32989¶
Varian Associates [Neil Sembower]
- Veeco_Integrated_Auto = 32871¶
Veeco Integrated Auto. [Neil Sembower]
- Vitalink_TransLAN_III = 32896¶
Vitalink TransLAN III [Neil Sembower]
- Wellfleet_Communications = 33023¶
Wellfleet Communications [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
- 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]
- XNS_Compatability = 2055¶
XNS Compatability [Neil Sembower]
- XTP = 33149¶
XTP [Neil Sembower]
- X_25_Level_3 = 2053¶
X.25 Level 3 [Neil Sembower]
- X_75_Internet = 2049¶
X.75 Internet [Neil Sembower]
- Xerox_IEEE802_3_PUP = 2560¶
Xerox IEEE802.3 PUP [Neil Sembower]
Assigned Internet Protocol Numbers ‡¶
- 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
- ARGUS = 13¶
ARGUS (deprecated)) [Robert W Scheifler]
- ARIS = 104¶
ARIS [Nancy Feldman]
- AX_25 = 93¶
AX.25 Frames [Brian Kantor]
- A_N = 107¶
Active Networks [Bob Braden]
- BBN_RCC_MON = 10¶
BBN RCC Monitoring [Steve Chipman]
- BNA = 49¶
BNA [Gary Salamon]
- BR_SAT_MON = 76¶
Backroom SATNET Monitoring [Steven Blumenthal]
- CBT = 7¶
CBT [Tony Ballardie]
- CFTP = 62¶
CFTP [Forsdick, H., “CFTP”, Network Message, Bolt Beranek and Newman, January 1982.][Harry Forsdick]
- CHAOS = 16¶
Chaos [J Noel Chiappa]
- CPHB = 73¶
Computer Protocol Heart Beat [David Mittnacht]
- CPNX = 72¶
Computer Protocol Network Executive [David Mittnacht]
- CRTP = 126¶
Combat Radio Transport Protocol [Robert Sautter]
- CRUDP = 127¶
Combat Radio User Datagram [Robert Sautter]
- Compaq_Peer = 110¶
Compaq Peer Protocol [Victor Volpe]
- DCN_MEAS = 19¶
DCN Measurement Subsystems [David Mills]
- DDP = 37¶
Datagram Delivery Protocol [Wesley Craig]
- DDX = 116¶
D-II Data Exchange (DDX) [John Worley]
- DGP = 86¶
Dissimilar Gateway Protocol [M/A-COM Government Systems, “Dissimilar Gateway Protocol Specification, Draft Version”, Contract no. CS901145, November 16, 1987.][Mike Little]
- EMCON = 14¶
EMCON [<mystery contact>]
- FIRE = 125¶
[Criag Partridge]
- GMTP = 100¶
GMTP [RXB5]
- IATP = 117¶
Interactive Agent Transfer Protocol [John Murphy]
- IDPR = 35¶
Inter-Domain Policy Routing Protocol [Martha Steenstrup]
- IDPR_CMTP = 38¶
IDPR Control Message Transport Proto [Martha Steenstrup]
- IDRP = 45¶
Inter-Domain Routing Protocol [Sue Hares]
- IFMP = 101¶
Ipsilon Flow Management Protocol [Bob Hinden][November 1995, 1997.]
- IGP = 9¶
any private interior gateway (used by Cisco for their IGRP) [Internet Assigned Numbers Authority]
- IL = 40¶
IL Transport Protocol [Dave Presotto]
- IPCV = 71¶
Internet Packet Core Utility [Steven Blumenthal]
- IPIP = 94¶
IP-within-IP Encapsulation Protocol [John Ioannidis]
- IPLT = 129¶
[Hollbach]
- IPPC = 67¶
Internet Pluribus Packet Core [Steven Blumenthal]
- IPTM = 84¶
Internet Protocol Traffic Manager [Jim Stevens]
- IPX_in_IP = 111¶
IPX in IP [CJ Lee]
- IPv6_Frag = 44¶
Fragment Header for IPv6 [Steve Deering]
- IPv6_Route = 43¶
Routing Header for IPv6 [Steve Deering]
- ISIS_over_IPv4 = 124¶
[Tony Przygienda]
- ISO_IP = 80¶
ISO Internet Protocol [Marshall T Rose]
- I_NLSP = 52¶
Integrated Net Layer Security TUBA [K Robert Glenn]
- KRYPTOLAN = 65¶
Kryptolan [Paul Liu]
- LARP = 91¶
Locus Address Resolution Protocol [Brian Horn]
- LEAF_1 = 25¶
Leaf-1 [Barry Boehm]
- LEAF_2 = 26¶
Leaf-2 [Barry Boehm]
- MERIT_INP = 32¶
MERIT Internodal Protocol [Hans Werner Braun]
- 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]
- MICP = 95¶
Mobile Internetworking Control Pro. (deprecated)) [John Ioannidis]
- MOBILE = 55¶
IP Mobility [Charlie Perkins]
- MTP = 92¶
Multicast Transport Protocol [Susie Armstrong]
- MUX = 18¶
Multiplexing [Cohen, D. and J. Postel, “Multiplexing Protocol”, IEN 90, USC/Information Sciences Institute, May 1979.][Jon Postel]
- NSFNET_IGP = 85¶
NSFNET-IGP [Hans Werner Braun]
- PGM = 113¶
PGM Reliable Transport Protocol [Tony Speakman]
- PIPE = 131¶
Private IP Encapsulation within IP [Bernhard Petri]
- PNNI = 102¶
PNNI over IP [Ross Callon]
- PRM = 21¶
Packet Radio Measurement [Zaw Sing Su]
- PTP = 123¶
Performance Transparency Protocol [Michael Welzl]
- 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
- PVP = 75¶
Packet Video Protocol [Steve Casner]
- QNX = 106¶
QNX [Michael Hunter]
- RVD = 66¶
MIT Remote Virtual Disk Protocol [Michael Greenwald]
- Reserved_255 = 255¶
[Internet Assigned Numbers Authority]
- SAT_EXPAK = 64¶
SATNET and Backroom EXPAK [Steven Blumenthal]
- SAT_MON = 69¶
SATNET Monitoring [Steven Blumenthal]
- SCC_SP = 96¶
Semaphore Communications Sec. Pro. [Howard Hart]
- SCPS = 105¶
SCPS [Robert Durst]
- SCTP = 132¶
Stream Control Transmission Protocol [Randall R Stewart]
- SDRP = 42¶
Source Demand Routing Protocol [Deborah Estrin]
- SECURE_VMTP = 82¶
SECURE-VMTP [Dave Cheriton]
- SKIP = 57¶
SKIP [Tom Markson]
- SM = 122¶
Simple Multicast Protocol (deprecated)) [Jon Crowcroft][draft-perlman- simple-multicast]
- SMP = 121¶
Simple Message Protocol [Leif Ekblad]
- SNP = 109¶
Sitara Networks Protocol [Manickam R Sridhar]
- SPS = 130¶
Secure Packet Shield [Bill McIntosh]
- SRP = 119¶
SpectraLink Radio Protocol [Mark Hamilton]
- SSCOPMCE = 128¶
[Kurt Waber]
- STP = 118¶
Schedule Transfer Protocol [Jean Michel Pittet]
- SUN_ND = 77¶
SUN ND PROTOCOL-Temporary [William Melohn]
- SWIPE = 53¶
IP with Encryption (deprecated)) [John Ioannidis]
- 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]
- TCF = 87¶
TCF [Guillermo A Loyola]
- TCP = 6¶
Transmission Control [RFC-ietf-tcpm-rfc793bis-28]
- TLSP = 56¶
Transport Layer Security Protocol using Kryptonet key management [Christer Oberg]
- TP = 39¶
TP++ Transport Protocol [Dirk Fromhein]
- TRUNK_1 = 23¶
Trunk-1 [Barry Boehm]
- TRUNK_2 = 24¶
Trunk-2 [Barry Boehm]
- TTP = 84¶
Transaction Transport Protocol [Jim Stevens]
- TransType_3PC = 34¶
Third Party Connect Protocol [Stuart A Friedberg]
- UTI = 120¶
UTI [Peter Lothberg]
- VINES = 83¶
VINES [Brian Horn]
- VISA = 70¶
VISA Protocol [Gene Tsudik]
- VMTP = 81¶
VMTP [Dave Cheriton]
- WB_EXPAK = 79¶
WIDEBAND EXPAK [Steven Blumenthal]
- WB_MON = 78¶
WIDEBAND Monitoring [Steven Blumenthal]
- WSN = 74¶
Wang Span Network [Victor Dafoulas]
- XNET = 15¶
Cross Net Debugger [Haverty, J., “XNET Formats for Internet Protocol Version 4”, IEN 158, October 1980.][Jack Haverty]
- 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
- XTP = 36¶
XTP [Greg Chesson]
- any_0_hop_protocol = 114¶
any 0-hop protocol [Internet Assigned Numbers Authority]
- any_distributed_file_system = 68¶
any distributed file system [Internet Assigned Numbers Authority]
- any_host_internal_protocol = 61¶
any host internal protocol [Internet Assigned Numbers Authority]
- any_local_network = 63¶
any local network [Internet Assigned Numbers Authority]
- any_private_encryption_scheme = 99¶
any private encryption scheme [Internet Assigned Numbers Authority]
TCP Constant Enumerations¶
TCP Checksum *¶
TCP Option Kind Numbers †¶
VLAN Constant Enumerations¶
Priority Levels *¶
Web Crawlers for Constant Enumerations¶
ARP Vendor Crawlers¶
ARP Hardware Types *¶
Operation Codes †¶
FTP Vendor Crawlers¶
FTP Commands *¶
FTP Return Codes †¶
HIP Vendor Crawler¶
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 ID ♦¶
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
HTTP Vendor Crawler¶
HTTP/2 Error Code *¶
HTTP/2 Frame Type †¶
HTTP/2 Settings ‡¶
IPv4 Vendor Crawler¶
Classification Level Encodings¶
Option Classes¶
IP Option Numbers *¶
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 Crawler¶
IPv6 Extension Header Types *¶
Destination Options and Hop-by-Hop Options †¶
IPv6 QS Functions¶
IPv6 Router Alert Option Values ‡¶
Routing Types §¶
Seed-ID Types¶
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 Vendor Crawler¶
IPX Packet Types *¶
IPX Socket Types †¶
MH Vendor Crawler¶
Mobility Header Types *¶
OSPF Vendor Crawler¶
Authentication Codes *¶
OSPF Packet Type †¶
Protocol Type Registry Vendor Crawlers¶
LINK-LAYER HEADER TYPES *¶
ETHER TYPES †¶
Assigned Internet Protocol Numbers ‡¶
TCP Vendor Crawler¶
TCP Checksum *¶
TCP Option Kind Numbers †¶
VLAN Vendor Crawler¶
Priority Levels *¶
Base Generator¶
Command Line Tool¶
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
In pcapkit
, all files can be described as following eight
different components.
Interface (
pcapkit.interface
)user interface for the
pcapkit
library, which standardise and simplify the usage of this libraryFoundation (
pcapkit.foundation
)synthesise file I/O and protocol analysis, coordinate information exchange in all network layers
Reassembly (
pcapkit.reassembly
)base on algorithms described in RFC 815, implement datagram reassembly of IP and TCP packets
Protocols (
pcapkit.protocols
)collection of all protocol family, with detailed implementation and methods
Utilities (
pcapkit.utilities
)collection of utility functions and classes
CoreKit (
pcapkit.corekit
)core utilities for
pcapkit
implementationToolKit (
pcapkit.toolkit
)utility tools for
pcapkit
implementationDumpKit (
pcapkit.dumpkit
)dump utilities for
pcapkit
implementation
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
.
Command Line Interface¶
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.
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 but now *DEPRECATED*.
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 standardise and simplify the usage of this library.Foundation (
pcapkit.foundation
)Synthesise file I/O and protocol analysis, coordinate information exchange in all network layers.
Reassembly (
pcapkit.reassembly
)Based on algorithms described in RFC 815, implement datagram reassembly of IP and TCP packets.
Protocols (
pcapkit.protocols
)Collection of all protocol family, with detail implementation and methods, as well as constructors.
CoreKit (
pcapkit.corekit
)Core utilities for
pcapkit
implementation.TookKit (
pcapkit.toolkit
)Compatibility tools for
pcapkit
implementation.DumpKit (
pcapkit.dumpkit
Dump utilities for
pcapkit
implementation.Utilities (
pcapkit.utilities
)Collection of four utility functions and classes.
Engine Comparison¶
Besides, due to complexity of pcapkit
, its extraction procedure takes
around 0.0009 seconds per packet, which is not ideal enough. Thus
pcapkit
introduced alternative extractionengines to accelerate this
procedure. By now pcapkit
supports Scapy, DPKT, and PyShark.
Plus, pcapkit
supports two strategies of multiprocessing (server
&
pipeline
). For more information, please refer to the documentation.
Test Environment¶
Operating System |
macOS Mojave |
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.00017389218012491862 |
|
0.00036091208457946774 |
|
0.0009537641207377116 |
|
0.0009694552421569824 |
|
0.018088217973709107 |
|
0.04200994372367859 |
Installation¶
Note
pcapkit
supports Python versions since 3.4.
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
Samples¶
Usage Samples¶
As described above, :mo:d`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)
import pcapkit # dump to a PLIST file with no frame storage (property frame disabled) plist = pcapkit.extract(fin='in.pcap', fout='out.plist', format='plist', store=False) # dump to a JSON file with no extension auto-complete json = pcapkit.extract(fin='in.cap', fout='out.json', format='json', extension=False) # dump to a folder with each tree-view text file per frame tree = pcapkit.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)
>>> import pcapkit >>> extraction = pcapkit.extract(fin='in.pcap', nofile=True) >>> frame0 = extraction.frame[0] # check if IP in this frame, otherwise ProtocolNotFound will be raised >>> flag = pcapkit.IP in frame0 >>> tcp = frame0[pcapkit.IP] if flag else None
extract a PCAP file and reassemble TCP payload (with no output file nor frame storage)
import pcapkit # set strict to make sure full reassembly extraction = pcapkit.extract(fin='in.pcap', store=False, nofile=True, tcp=True, strict=True) # print extracted packet if HTTP in reassembled payloads for packet in extraction.reassembly.tcp: for reassembly in packet.packets: if pcapkit.HTTP in reassembly.protochain: print(reassembly.info)
CLI Samples¶
The CLI (command line interface) of pcapkit
has two different access.
through console scripts
Use command name
pcapkit [...]
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 in --format plist --verbose 🚨Loading file 'in.pcap' - Frame 1: Ethernet:IPv6:ICMPv6 - Frame 2: Ethernet:IPv6:ICMPv6 - Frame 3: Ethernet:IPv4:TCP - Frame 4: Ethernet:IPv4:TCP - Frame 5: Ethernet:IPv4:TCP - Frame 6: Ethernet:IPv4:UDP 🍺Report file stored in 'out.plist'
export to a JSON file (with no format specified)
$ pcapkit in --output out.json --verbose 🚨Loading file 'in.pcap' - Frame 1: Ethernet:IPv6:ICMPv6 - Frame 2: Ethernet:IPv6:ICMPv6 - Frame 3: Ethernet:IPv4:TCP - Frame 4: Ethernet:IPv4:TCP - Frame 5: Ethernet:IPv4:TCP - Frame 6: Ethernet:IPv4:UDP 🍺Report file stored in 'out.json'
export to a text tree view file (without extension autocorrect)
$ pcapkit in --output out --format tree --verbose 🚨Loading file 'in.pcap' - Frame 1: Ethernet:IPv6:ICMPv6 - Frame 2: Ethernet:IPv6:ICMPv6 - Frame 3: Ethernet:IPv4:TCP - Frame 4: Ethernet:IPv4:TCP - Frame 5: Ethernet:IPv4:TCP - Frame 6: Ethernet:IPv4:UDP 🍺Report file stored in 'out'