ARP/InARP - (Inverse) Address Resolution Protocol¶
pcapkit.protocols.link.arp
contains
ARP
only,
which implements extractor for (Inverse) Address Resolution
Protocol (ARP/InARP) [*], whose structure is described as
below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Hardware Type |
2 |
16 |
|
Protocol Type |
4 |
32 |
|
Hardware Address Length |
5 |
40 |
|
Protocol Address Length |
6 |
48 |
|
Operation |
8 |
64 |
|
Sender Hardware Address |
14 |
112 |
|
Sender Protocol Address |
18 |
144 |
|
Target Hardware Address |
24 |
192 |
|
Target Protocol Address |
- class pcapkit.protocols.link.arp.ARP(file=None, length=None, **kwargs)[source]¶
-
This class implements all protocols in ARP family.
- property name: Literal['Dynamic Reverse Address Resolution Protocol', 'Inverse Address Resolution Protocol', 'Reverse Address Resolution Protocol', 'Address Resolution Protocol']¶
Name of current protocol.
- read(length=None, **kwargs)[source]¶
Read Address Resolution Protocol.
Data structure of ARP Request header [RFC 826]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Hdr Type | Proto Type | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Hdr Len | Proto Len | Operation | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \ Sender Hdr Addr \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \ Sender Proto Addr \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \ Target Hdr Addr \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \ Target Proto Addr \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- make(*, htype=<Hardware.Ethernet: 1>, htype_default=None, htype_namespace=None, htype_reversed=False, ptype=<EtherType.Internet_Protocol_version_4: 2048>, ptype_default=None, ptype_namespace=None, ptype_reversed=False, hlen=6, plen=4, oper=<Operation.REQUEST: 1>, oper_default=None, oper_namespace=None, oper_reversed=False, sha='00:00:00:00:00:00', spa='0.0.0.0', tha='00:00:00:00:00:00', tpa='0.0.0.0', payload=b'', **kwargs)[source]¶
Make (construct) packet data.
- Parameters:
htype (
Hardware
|IntEnum
|IntEnum
|str
|int
) – Hardware type.htype_default (
Optional
[int
]) – Default value of hardware type.htype_namespace (
Union
[dict
[str
,int
],dict
[int
,str
],Type
[IntEnum
],Type
[IntEnum
],None
]) – Namespace of hardware type.htype_reversed (
bool
) – Reversed flag of hardware type.ptype (
EtherType
|IntEnum
|IntEnum
|str
|int
) – Protocol type.ptype_default (
Optional
[int
]) – Default value of protocol type.ptype_namespace (
Union
[dict
[str
,int
],dict
[int
,str
],Type
[IntEnum
],Type
[IntEnum
],None
]) – Namespace of protocol type.ptype_reversed (
bool
) – Reversed flag of protocol type.hlen (
int
) – Hardware address length.plen (
int
) – Protocol address length.oper (
Operation
|IntEnum
|IntEnum
|str
|int
) – Operation.oper_namespace (
Union
[dict
[str
,int
],dict
[int
,str
],Type
[IntEnum
],Type
[IntEnum
],None
]) – Namespace of operation.oper_reversed (
bool
) – Reversed flag of operation.spa (
IPv4Address
|IPv6Address
|str
|bytes
|bytearray
) – Sender protocol address.tpa (
IPv4Address
|IPv6Address
|str
|bytes
|bytearray
) – Target protocol address.payload (
bytes
|ProtocolBase
|Schema
) – Payload.**kwargs (
Any
) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed packet data.
- class pcapkit.protocols.link.arp.InARP(file=None, length=None, **kwargs)[source]¶
Bases:
ARP
This class implements Inverse Address Resolution Protocol.
Header Schemas¶
Data Models¶
- class pcapkit.protocols.data.link.arp.ARP(*args: VT, **kwargs: VT)[source]¶
Bases:
Protocol
Data model for ARP packet.
- htype: Hardware¶
Hardware type.
- ptype: EtherType¶
Protocol type.
- hlen: int¶
Hardware address length.
- plen: int¶
Protocol address length.
- oper: Operation¶
Operation code.
- sha: str¶
Sender hardware address.
- spa: str | IPv4Address | IPv6Address¶
Sender protocol address.
- tha: str¶
Target hardware address.
- tpa: str | IPv4Address | IPv6Address¶
Target protocol address.
- len: int¶
Header length.
- class pcapkit.protocols.data.link.arp.Address(*args: VT, **kwargs: VT)[source]¶
Bases:
Data
Data model for ARP addresses.
- hardware: str¶
Hardware address.
- protocol: str | IPv4Address | IPv6Address¶
Protocol address.
- class pcapkit.protocols.data.link.arp.Type(*args: VT, **kwargs: VT)[source]¶
Bases:
Data
Data model for ARP type.
- hardware: Hardware¶
Hardware type.
- protocol: EtherType | str¶
Protocol type.
Footnotes