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

Class Dot15d4AuxSecurityHeader

scapy/layers/dot15d4.py:195–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193
194
195class Dot15d4AuxSecurityHeader(Packet):
196 name = "802.15.4 Auxiliary Security Header"
197 fields_desc = [
198 BitField("sec_sc_reserved", 0, 3),
199 # Key Identifier Mode
200 # 0: Key is determined implicitly from the originator and recipient(s) of the frame # noqa: E501
201 # 1: Key is determined explicitly from the the 1-octet Key Index subfield of the Key Identifier field # noqa: E501
202 # 2: Key is determined explicitly from the 4-octet Key Source and the 1-octet Key Index # noqa: E501
203 # 3: Key is determined explicitly from the 8-octet Key Source and the 1-octet Key Index # noqa: E501
204 BitEnumField("sec_sc_keyidmode", 0, 2, {
205 0: "Implicit", 1: "1oKeyIndex", 2: "4o-KeySource-1oKeyIndex", 3: "8o-KeySource-1oKeyIndex"} # noqa: E501
206 ),
207 BitEnumField("sec_sc_seclevel", 0, 3, {0: "None", 1: "MIC-32", 2: "MIC-64", 3: "MIC-128", 4: "ENC", 5: "ENC-MIC-32", 6: "ENC-MIC-64", 7: "ENC-MIC-128"}), # noqa: E501
208 XLEIntField("sec_framecounter", 0x00000000), # 4 octets
209 # Key Identifier (variable length): identifies the key that is used for cryptographic protection # noqa: E501
210 # Key Source : length of sec_keyid_keysource varies btwn 0, 4, and 8 bytes depending on sec_sc_keyidmode # noqa: E501
211 MultipleTypeField([
212 # 4 octets when sec_sc_keyidmode == 2
213 (XLEIntField("sec_keyid_keysource", 0x00000000),
214 lambda pkt: pkt.getfieldval("sec_sc_keyidmode") == 2),
215 # 8 octets when sec_sc_keyidmode == 3
216 (LELongField("sec_keyid_keysource", 0x0000000000000000),
217 lambda pkt: pkt.getfieldval("sec_sc_keyidmode") == 3),
218 ], StrFixedLenField("sec_keyid_keysource", "", length=0)),
219 # Key Index (1 octet): allows unique identification of different keys with the same originator # noqa: E501
220 ConditionalField(XByteField("sec_keyid_keyindex", 0xFF),
221 lambda pkt: pkt.getfieldval("sec_sc_keyidmode") != 0),
222 ]
223
224
225class Dot15d4Data(Packet):

Callers 3

Dot15d4DataClass · 0.85
Dot15d4BeaconClass · 0.85
Dot15d4CmdClass · 0.85

Calls 9

BitFieldClass · 0.90
BitEnumFieldClass · 0.90
XLEIntFieldClass · 0.90
MultipleTypeFieldClass · 0.90
LELongFieldClass · 0.90
StrFixedLenFieldClass · 0.90
ConditionalFieldClass · 0.90
XByteFieldClass · 0.90
getfieldvalMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…