MCPcopy Create free account
hub / github.com/secdev/scapy / Dot15d4Data

Class Dot15d4Data

scapy/layers/dot15d4.py:225–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223
224
225class Dot15d4Data(Packet):
226 name = "802.15.4 Data"
227 fields_desc = [
228 XLEShortField("dest_panid", 0xFFFF),
229 dot15d4AddressField("dest_addr", 0xFFFF, length_of="fcf_destaddrmode"),
230 ConditionalField(XLEShortField("src_panid", 0x0),
231 lambda pkt:util_srcpanid_present(pkt)),
232 ConditionalField(dot15d4AddressField("src_addr", None, length_of="fcf_srcaddrmode"), # noqa: E501
233 lambda pkt:pkt.underlayer.getfieldval("fcf_srcaddrmode") != 0), # noqa: E501
234 # Security field present if fcf_security == True
235 ConditionalField(PacketField("aux_sec_header", Dot15d4AuxSecurityHeader(), Dot15d4AuxSecurityHeader), # noqa: E501
236 lambda pkt:pkt.underlayer.getfieldval("fcf_security") is True), # noqa: E501
237 ]
238
239 def guess_payload_class(self, payload):
240 # TODO: See how it's done in wireshark:
241 # https://github.com/wireshark/wireshark/blob/93c60b3b7c801dddd11d8c7f2a0ea4b7d02d700a/epan/dissectors/packet-ieee802154.c#L2061 # noqa: E501
242 # it's too magic to me
243 from scapy.layers.sixlowpan import SixLoWPAN
244 from scapy.layers.zigbee import ZigbeeNWK
245 if conf.dot15d4_protocol == "sixlowpan":
246 return SixLoWPAN
247 elif conf.dot15d4_protocol == "zigbee":
248 return ZigbeeNWK
249 else:
250 if conf.dot15d4_protocol is None:
251 _msg = "Please set conf.dot15d4_protocol to select a " + \
252 "802.15.4 protocol. Values must be in the list: "
253 else:
254 _msg = "Unknown conf.dot15d4_protocol value: must be in "
255 warning(_msg +
256 "['sixlowpan', 'zigbee']" +
257 " Defaulting to SixLoWPAN")
258 return SixLoWPAN
259
260 def mysummary(self):
261 return self.sprintf("802.15.4 Data ( %Dot15d4Data.src_panid%:%Dot15d4Data.src_addr% -> %Dot15d4Data.dest_panid%:%Dot15d4Data.dest_addr% )") # noqa: E501
262
263
264class Dot15d4Beacon(Packet):

Callers

nothing calls this directly

Calls 7

XLEShortFieldClass · 0.90
ConditionalFieldClass · 0.90
PacketFieldClass · 0.90
dot15d4AddressFieldClass · 0.85
util_srcpanid_presentFunction · 0.85
getfieldvalMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…