BOOTP - Bootstrap Protocol¶
pcapkit.protocols.application.bootp.protocol holds
BOOTP, the extractor for
Bootstrap Protocol (BOOTP) messages [RFC 951, RFC 1542], laid out as
protocol gives. Its last field,
vend, holds the vendor extensions of RFC 1497 and RFC 2132 sections 3
to 8 where the magic cookie opens it, and is vendor-specific octets otherwise.
Added in version 1.10.0.
- class pcapkit.protocols.application.bootp.protocol.BOOTP(file, length=None, /, *, layer=None, protocol=None, context=None)[source]¶
-
This class implements the Bootstrap Protocol.
A message whose options carry the DHCP Message Type option is a DHCP one, which
DHCPv4reads, so this class refuses it, on both paths. Its vendor extensions decode asDHCPgives, for the codes ofVENDOR_EXTENSIONSalone; thesnameandfilefields are text, which no Option Overload option overloads here. A vendor extension the area ends inside, as a capture cut leaves one, keeps its octets as the padding, and the cut is recorded asDHCPv4records it.Added in version 1.10.0.
Properties
Methods
- read(length=None, **kwargs)[source]¶
Read Bootstrap Protocol.
Structure of a BOOTP message [RFC 951 Section 3]:
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 +---------------+---------------+---------------+---------------+ | op (1) | htype (1) | hlen (1) | hops (1) | +---------------+---------------+---------------+---------------+ | xid (4) | +-------------------------------+-------------------------------+ | secs (2) | flags (2) | +-------------------------------+-------------------------------+ | ciaddr (4) | +---------------------------------------------------------------+ | yiaddr (4) | +---------------------------------------------------------------+ | siaddr (4) | +---------------------------------------------------------------+ | giaddr (4) | +---------------------------------------------------------------+ | chaddr (16) | +---------------------------------------------------------------+ | sname (64) | +---------------------------------------------------------------+ | file (128) | +---------------------------------------------------------------+ | vend (64) | +---------------------------------------------------------------+
- Parameters:
- Return type:
- Returns:
Parsed packet data.
- Raises:
ProtocolError – If the options carry the DHCP Message Type option.
- make(*, op=Opcode.BOOTREQUEST, htype=Hardware.Ethernet, hlen=None, hops=0, xid=0, secs=0, flags=0, ciaddr='0.0.0.0', yiaddr='0.0.0.0', siaddr='0.0.0.0', giaddr='0.0.0.0', chaddr=b'', chaddr_padding=None, sname=b'', file=b'', vend=(), padding=b'', payload=b'', **kwargs)[source]¶
Make (construct) packet data.
- Parameters:
hlen (
int|None) – Hardware address length; that ofchaddrifNone.hops (
int) – Hops.xid (
int) – Transaction ID.secs (
int) – Seconds elapsed since the client began.flags (
Mapping[str,Any] |int) – Flags, as their data model or a mapping of its keys, or the two octets as an integer.ciaddr (
IPv4Address|str|bytes|int) – Client IP address.yiaddr (
IPv4Address|str|bytes|int) – Your (client) IP address.siaddr (
IPv4Address|str|bytes|int) – Server IP address.giaddr (
IPv4Address|str|bytes|int) – Gateway IP address.chaddr (
str|bytes) – Client hardware address: a MAC address for an Ethernet or IEEE 802 type, or its octets.chaddr_padding (
bytes|None) – Octets ofchaddrafter the address; zeros filling the field ifNone.sname (
bytes) – Server host name, which NULs fill out.file (
bytes) – Boot file name, which NULs fill out.vend (
Iterable[Mapping[str,Any]] |bytes) – Vendor area: its vendor extensions, each a mapping asOptionholds it, written after the magic cookie, or its raw octets.padding (
bytes) – Octets after the End option, or with none, the vendor extension the area ends inside; given with vendor extensions.payload (
bytes|ProtocolBase|Schema) – Octets after the message.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed packet data.
- Raises:
ProtocolError – If a field does not fit its width; if an option is malformed or builds a code outside the vendor extensions from fields; or if the vendor extensions carry the DHCP Message Type option, which makes a DHCP message.
Utilities
Data Models¶
- class pcapkit.protocols.application.bootp.data.BOOTP(op, htype, hlen, hops, xid, secs, flags, ciaddr, yiaddr, siaddr, giaddr, chaddr, chaddr_padding, sname, file, magic_cookie, vend, padding)[source]¶
Bases:
ProtocolData model for a BOOTP message (RFC 951 Section 3, RFC 1542).
- ciaddr: IPv4Address¶
Client IP address.
- yiaddr: IPv4Address¶
Your (client) IP address.
- siaddr: IPv4Address¶
Server IP address.
- giaddr: IPv4Address¶
Gateway IP address.
- chaddr: str | bytes¶
Client hardware address, its first
hlenoctets; a MAC address for an Ethernet or IEEE 802 type of six octets.
- magic_cookie: bytes | None¶
The magic cookie opening
vend, orNonewhere it holds no vendor extensions.
Constants¶
- pcapkit.protocols.application.bootp.const.VENDOR_EXTENSIONS = frozenset({0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 64, 65, 68, 69, 70, 71, 72, 73, 74, 75, 76, 255})¶
Codes of the vendor extensions a BOOTP message carries, which its option parsers decode: those of RFC 2132 sections 3 to 8, the RFC 1497 extensions and their successors. Section 9 and every later option are DHCP’s.