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

Class OptionalAuth

scapy/contrib/bfd.py:66–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64
65
66class OptionalAuth(Packet):
67 name = "Optional Auth"
68 fields_desc = [
69 ByteEnumField("auth_type", 1, _authentification_type),
70 FieldLenField(
71 "auth_len",
72 None,
73 fmt="B",
74 length_of="auth_key",
75 adjust=lambda pkt, x: x + 3 if pkt.auth_type <= 1 else x + 8,
76 ),
77 ByteField("auth_keyid", 1),
78 ConditionalField(
79 XByteField("reserved", 0),
80 lambda pkt: pkt.auth_type > 1,
81 ),
82 ConditionalField(
83 IntField("sequence_number", 0),
84 lambda pkt: pkt.auth_type > 1,
85 ),
86 MultipleTypeField(
87 [
88 (
89 StrFixedLenField(
90 "auth_key", "", length_from=lambda pkt: pkt.auth_len
91 ),
92 lambda pkt: pkt.auth_type == 0,
93 ),
94 (
95 XNBytesField("auth_key", 0x5F4DCC3B5AA765D61D8327DEB882CF99, 16),
96 lambda pkt: pkt.auth_type == 2 or pkt.auth_type == 3,
97 ),
98 (
99 XNBytesField(
100 "auth_key", 0x5BAA61E4C9B93F3F0682250B6CF8331B7EE68FD8, 20
101 ),
102 lambda pkt: pkt.auth_type == 4 or pkt.auth_type == 5,
103 ),
104 ],
105 StrFixedLenField(
106 "auth_key", "password", length_from=lambda pkt: pkt.auth_len
107 ),
108 ),
109 ]
110
111
112class BFD(Packet):

Callers

nothing calls this directly

Calls 9

ByteEnumFieldClass · 0.90
FieldLenFieldClass · 0.90
ByteFieldClass · 0.90
ConditionalFieldClass · 0.90
XByteFieldClass · 0.90
IntFieldClass · 0.90
MultipleTypeFieldClass · 0.90
StrFixedLenFieldClass · 0.90
XNBytesFieldClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…