fortrace.utility.usb_spoofing package
Submodules
fortrace.utility.usb_spoofing.pi_usb_spoofing module
- class fortrace.utility.usb_spoofing.pi_usb_spoofing.USBGadget(gadget_name: str, keep_backing_store: bool = False, **kwargs)[source]
Bases:
object- active = <unlocked _thread.lock object>
- class fortrace.utility.usb_spoofing.pi_usb_spoofing.USBSpoofer(usb_host: dict)[source]
Bases:
object- activate(gadget_name: str)[source]
Implements the contextmanager for device activation.
- Parameters:
gadget_name – name of the gadget to activate.
Example
- with usb_spoofing.activate(gadget_name) as gadget:
domain.attach_usb_device(gadget.device.vendor_id, gadget.device.product_id)
- activate_device(gadget_name: str)[source]
Activate a pre-configured gadget.
- Parameters:
gadget_name – name of the gadget to be activated
- deactivate_device(gadget_name: str)[source]
Deactivate a previously activated gadget.
- Parameters:
gadget_name – name of the gadget to be activated
- get_device(gadget_name: str) USBGadget | None[source]
Get a spoofed USB device, based on its name.
- Parameters:
gadget_name – name of the gadget
- Returns:
USBGadget or None
- serve_backing_store(device: USBGadget)[source]
Implements the contextmanager for mounting the backing store.
- Parameters:
device – USBGaget to mount (must not be activated)
fortrace.utility.usb_spoofing.usb_device module
- class fortrace.utility.usb_spoofing.usb_device.USBDevice(vendor_id: str, product_id: str, product_name: str, manufacturer: str = None, serial_number: str = None, file_system: str = None, size: str = None, label: str = None)[source]
Bases:
object- file_system: str = None
- label: str = None
- manufacturer: str = None
- product_id: str
- product_name: str
- serial_number: str = None
- size: str = None
- vendor_id: str
- fortrace.utility.usb_spoofing.usb_device.generate(args: Namespace) None[source]
Generate a USB device from a list of devices.
- Parameters:
args – the parsed command line arguments
- fortrace.utility.usb_spoofing.usb_device.generate_usb(device: USBDevice) USBDevice[source]
Generate a USB device from a list of devices.
- Parameters:
device – USBDevice as extracted with parse_usb_ids()
- Returns:
a single USBDevice with values for all attributes
- fortrace.utility.usb_spoofing.usb_device.parse_usb_ids() list[USBDevice][source]
Parse the list of USB IDs.
- Returns:
list of USBDevices, representing all possible combinations of USB IDs.
- fortrace.utility.usb_spoofing.usb_device.search_devices(devices: list[USBDevice], key: Literal['vendor_id', 'manufacturer', 'product_id', 'product_name'], value: str) list[USBDevice][source]
Search for specific devices in the list of USBDevices
- Parameters:
devices – the list of USBDevices as returned by parse_usb_ids()
key – which attribute of USBDevice to search for
value – the value to search for. IDs have to be specified fully, names can be provided partially
- Returns:
list of USBDevices that match the searched value