scapy.dadict

Direct Access dictionary.

class scapy.dadict.DADict(_name: str = 'DADict', **kargs: Any)[源代码]

基类:Generic[_K, _V]

Direct Access Dictionary

This acts like a dict, but it provides a direct attribute access to its keys through its values. This is used to store protocols, manuf...

For instance, scapy fields will use a DADict as an enum:

ETHER_TYPES[2048] -> IPv4

Whereas humans can access:

ETHER_TYPES.IPv4 -> 2048
ident(v: _V) str[源代码]

Return value that is used as key for the direct access

iterkeys() Iterator[_K][源代码]
itervalues() Iterator[_V][源代码]
keys() List[_K][源代码]
update(*args: Dict[str, _V], **kwargs: Dict[str, _V]) None[源代码]
values() List[_V][源代码]
exception scapy.dadict.DADict_Exception[源代码]

基类:Scapy_Exception

scapy.dadict.fixname(x: bytes | str) str[源代码]

Modifies a string to make sure it can be used as an attribute name.