facedancer.descriptor module
Functionality for working with objects with associated USB descriptors.
- class facedancer.descriptor.StringDescriptorManager[source]
Bases:
objectManager class that collects active string descriptors.
- add_string(string, index=None)[source]
Add a Python string as a new string descriptor, and return an index.
The specified index is used for the new string descriptor, overwriting any previous descriptor with the same index. If an index is not specified, a new, unique, incrementing index is allocated.
- class facedancer.descriptor.StringRef(index: int = None, string: str = None)[source]
Bases:
objectClass representing a reference to a USB string descriptor.
- class facedancer.descriptor.USBClassDescriptor(*, raw: bytes, type_number: int = None, number: int = None, parent: USBDescribable = None, include_in_config: bool = True)[source]
Bases:
USBDescriptorClass for arbitrary USB Class descriptors.
- include_in_config: bool = True
- raw: bytes
The bDescriptorType of the descriptor.
- class facedancer.descriptor.USBDescribable[source]
Bases:
objectAbstract base class for objects that can be created from USB descriptors.
- DESCRIPTOR_TYPE_NUMBER = None
- class facedancer.descriptor.USBDescriptor(*, raw: bytes, type_number: int = None, number: int = None, parent: USBDescribable = None, include_in_config: bool = False)[source]
Bases:
USBDescribable,AutoInstantiableClass for arbitrary USB descriptors; minimal concrete implementation of USBDescribable.
- classmethod from_binary_descriptor(data, strings={})[source]
Attempts to create a USBDescriptor subclass from the given raw descriptor data.
- get_identifier()[source]
Returns a unique integer identifier for this object.
This is usually the index or address of the relevant USB object.
- include_in_config: bool = False
- number: int = None
Parent object which this descriptor is associated with.
- parent: USBDescribable = None
Whether this descriptor should be included in a GET_CONFIGURATION response.
- raw: bytes
The bDescriptorType of the descriptor.
- type_number: int = None
Number to request this descriptor with a GET_DESCRIPTOR request.
- class facedancer.descriptor.USBDescriptorTypeNumber(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
IntEnum- CONFIGURATION = 2
- DEVICE = 1
- DEVICE_QUALIFIER = 6
- ENDPOINT = 5
- HID = 33
- INTERFACE = 4
- INTERFACE_POWER = 8
- OTHER_SPEED_CONFIGURATION = 7
- REPORT = 34
- STRING = 3
- class facedancer.descriptor.USBStringDescriptor(*, raw: bytes, type_number: int = None, number: int = None, parent: USBDescribable = None, include_in_config: bool = False, python_string: str = None)[source]
Bases:
USBDescriptorClass representing a USB string descriptor.
- DESCRIPTOR_TYPE_NUMBER = 3
- python_string: str = None