facedancer.devices.umass.umass module

Emulation of a USB Mass storage device.

class facedancer.devices.umass.umass.CommandBlockWrapper(bytestring)[source]

Bases: object

class facedancer.devices.umass.umass.ScsiCommandHandler(device, disk_image, verbose=0, vendor='GoodFET ')[source]

Bases: object

STATUS_FAILURE = 2
STATUS_INCOMPLETE = -1
STATUS_OKAY = 0
continue_write(cbw, data)[source]
handle_data_received(data)[source]
handle_get_format_capacity(cbw)[source]
handle_get_read_capacity(cbw)[source]
handle_get_read_capacity_16(cbw)[source]
handle_ignored_event(cbw)[source]

Handles SCSI events that we can safely ignore.

handle_inquiry(cbw)[source]
handle_mode_sense_10(cbw)[source]
handle_mode_sense_6(cbw)[source]
handle_read(cbw)[source]
handle_read_16(cbw)[source]
handle_scsi_command(cbw)[source]

Handles an SCSI command.

handle_sense(cbw)[source]

Handles SCSI sense requests.

handle_service_action_in(cbw)[source]
handle_unknown_command(cbw)[source]

Handles unsupported SCSI commands.

handle_write(cbw)[source]
handle_write_16(cbw)[source]
name: str = 'SCSI Command Handler'
class facedancer.devices.umass.umass.USBMassStorageDevice(disk_image, name='USB mass storage interface', vendor_id=33031, product_id=20561, device_revision=3, manufacturer_string='Facedancer', product_string='USB Mass Storage emulation', max_packet_size_ep0=64, serial_number_string=None, vendor='LifeScan')[source]

Bases: USBDevice

Class implementing an emulated USB Mass Storage device.

connect()[source]

Connects this device to the host; e.g. turning on our presence-detect pull up.

disconnect()[source]

Disconnects this device from the host.

handle_bulk_only_mass_storage_reset_request = <ControlRequestHandler wrapping USBMassStorageDevice.handle_bulk_only_mass_storage_reset_request at 0x7f80a7ea4c20
handle_data_received(endpoint, data)[source]

Handler for receipt of non-control request data.

Typically, this method will delegate any data received to the appropriate configuration/interface/endpoint. If overridden, the overriding function will receive all data.

Parameters:
  • endpoint_number – The endpoint number on which the data was received.

  • data – The raw bytes received on the relevant endpoint.

handle_get_max_lun_request = <ControlRequestHandler wrapping USBMassStorageDevice.handle_get_max_lun_request at 0x7f80a7eebe60
async wait_for_host()[source]

Waits until the host connects by TODO.

facedancer.devices.umass.umass.bytes_as_hex(b, delim=' ')[source]