def __init__(self, vendor_id, product_id, additional_filters=None): """ Creates a new USBProxy instance that captures all passed packets to ViewSB. Args: vendor_id -- The vendor ID of the device to be proxied. product_id -- The product ID of the device to be proxied. additional_filters -- A list of any additional filters to be installed in the proxy stack. """ # Create the backend USBProxy instance that will perform our captures... facedancer_app = FacedancerUSBApp() self.proxy = USBProxyDevice(facedancer_app, idVendor=vendor_id, idProduct=product_id) # ... add the necessary filters to perform our magic... self.proxy.add_filter(ViewSBProxyObserver(self)) self.proxy.add_filter(USBProxySetupFilters(self.proxy)) # ... and add any other filters passed in. if additional_filters: for additional_filter in additional_filters: self.proxy.add_filter(additional_filter) # Set up our connection to the device-to-be-proxied. self.proxy.connect()
def main(): """ Core code for this script. This creates our USBProxy instance and runs it, proxying data back and forth. """ # Create a new USBProxy object, proying the device with our target VID/PID. u = FacedancerUSBApp(verbose=1) d = USBProxyDevice(u, idVendor=TARGET_DEVICE_VID, idProduct=TARGET_DEVICE_PID, verbose=2) # Apply the standard filters that make USBProork. d.add_filter(USBProxySetupFilters(d, verbose=2)) # Add in the MITM filter we defined above -- this gives us control # over all USB packets. d.add_filter(TrainingExampleFilter()) # Add in a filter that prints all packets as they fly by. # This is nice to see what's happening. d.add_filter(USBProxyPrettyPrintFilter(verbose=5)) # Connect to the target device... d.connect() # And proxy until the user presses CTRL+c. try: d.run() except KeyboardInterrupt: d.disconnect()
def main(): # Create a new proxy/MITM connection for the Switch Wired Pro Controller. u = FacedancerUSBApp(verbose=1) d = USBProxyDevice(u, idVendor=0x0f0d, idProduct=0x00c1, verbose=2) # Apply the standard filters that make USBProork. d.add_filter(USBProxySetupFilters(d, verbose=2)) d.add_filter(SwitchControllerInvertXFilter()) d.add_filter(USBProxyPrettyPrintFilter(verbose=5)) d.connect() try: d.run() # SIGINT raises KeyboardInterrupt except KeyboardInterrupt: d.disconnect()
def main(): # TODO: Accept arguments that specify a list of filters to apply, # from the local directory or the filters directory. parser = argparse.ArgumentParser(description="FaceDancer USB Proxy") parser.add_argument('-v', dest='vendorid', metavar='<VendorID>', type=vid_pid, help="Vendor ID of device", required=True) parser.add_argument('-p', dest='productid', metavar='<ProductID>', type=vid_pid, help="Product ID of device", required=True) args = parser.parse_args() quirks = [] # Create a new USBProxy device. u = FacedancerUSBApp(verbose=1) d = USBProxyDevice(u, idVendor=args.vendorid, idProduct=args.productid, verbose=2, quirks=quirks) # Add our standard filters. # TODO: Make the PrettyPrintFilter switchable? d.add_filter(USBProxyPrettyPrintFilter(verbose=5)) d.add_filter(USBProxySetupFilters(d, verbose=2)) # TODO: Figure these out from the command line! d.connect() try: d.run() # SIGINT raises KeyboardInterrupt except KeyboardInterrupt: d.disconnect()
def main(): # Create a new proxy/MITM connection for the Switch Wired Pro Controller. u = FacedancerUSBApp(verbose=1) d = USBProxyDevice(u, idVendor=0x0f0d, idProduct=0x00c1, verbose=2) # Apply our filter before the standard filters so we impact configuration # of the target device. d.add_filter(SwitchControllerWorkWithFacedancer21Filter()) d.add_filter(USBProxySetupFilters(d, verbose=2)) d.add_filter(SwitchControllerInvertXFilter()) d.add_filter(USBProxyPrettyPrintFilter(verbose=5)) d.connect() try: d.run() # SIGINT raises KeyboardInterrupt except KeyboardInterrupt: d.disconnect()