facedancer.filters.hid module

class facedancer.filters.hid.HIDReportType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

HID_TYPE_FEATURE = 3
HID_TYPE_INPUT = 1
HID_TYPE_OUTPUT = 2
class facedancer.filters.hid.USBProxyHIDFilter(device: USBBaseDevice, verbose=1)[source]

Bases: USBProxyFilter

Print HID packets

If verbose > 2 - print all fields

filter_control_in(req: USBControlRequest | None, data, stalled)[source]

Filters the data response from the proxied device during an IN control request. This allows us to modify the data returned from the proxied device during a setup stage.

Parameters:
  • request – The request that was issued to the target host.

  • data – The data being proxied during the data stage.

  • stalled – True if the proxied device (or a previous filter) stalled the request.

Returns:

Modified versions of the arguments. Note that modifying request will _only_ modify the request as seen by future filters, as the SETUP stage has already passed and the request has already been sent to the device.

filter_control_out(req, data)[source]

Filters handling of an OUT control request, which contains both a request and (optional) data stage.

Parameters:
  • request – The request issued by the target host.

  • data – The data sent by the target host with the request.

Returns:

Modified versions of the arguments. Returning a request of None will absorb the packet silently and not proxy it to the device.

filter_in(ep_num, data)[source]

Filters the response to an IN token (the data packet received in response to the host issuing an IN token).

Parameters:
  • ep_num – The endpoint number associated with the data packet.

  • data – The data packet received from the proxied device.

Returns:

A modified version of the arguments. If data is set to none, the packet will be absorbed, and a NAK will be issued instead of responding to the IN request with data.

facedancer.filters.hid.dump(raw: bytes)[source]