scapy.contrib.coap

RFC 7252 - Constrained Application Protocol (CoAP) layer for Scapy

scapy.contrib.coap.CF_APP_JSON = b'2'

CoAP options (RFC 7252 @ section-5.10)

scapy.contrib.coap.COAP_REQ_CODES = [1, 2, 3, 4]

CoAP message response codes (RFC 7252 @ section-12.1.2)

scapy.contrib.coap.CONTENT_FORMAT = 12

CoAP message type

class scapy.contrib.coap.CoAP(_pkt, /, *, ver=1, type=0, tkl=None, code=0, msg_id=0, token=b'', options=[], paymark=b'')[source]

Bases: Packet

aliastypes = [<class 'scapy.contrib.coap.CoAP'>, <class 'scapy.packet.Packet'>]
answers(other: Packet) int[source]

DEV: true if self is an answer from other Any response that is inside coap_codes that is not a request is valid. i.e.: do not answer a request with a request.

content_format
fields_desc: ClassVar[List[Field[Any, Any] | _FieldContainer]] = [<BitField (CoAP).ver>, <BitEnumField (CoAP).type>, <BitFieldLenField (CoAP).tkl>, <ByteEnumField (CoAP).code>, <ShortField (CoAP).msg_id>, <StrLenField (CoAP).token>, <_CoAPOptsField (CoAP).options>, <_CoAPPaymark (CoAP).paymark>]
getfieldval(attr)[source]
hashret()[source]
post_dissect(pay)[source]
scapy.contrib.coap.NOT_IMPLEMENTED_501 = 161

CoAP content type (RFC 7252 @ section-12.3)