nccgroup / umap2

Umap2 is the second revision of NCC Group's python based USB host security assessment tool.
GNU Affero General Public License v3.0
252 stars 70 forks source link

Type Error #32

Open paulsonmathew21 opened 3 years ago

paulsonmathew21 commented 3 years ago

Continuous Type error exceptions are occurred whilst executing the tool as shown below.

[INFO ] [Interface] Calling get_descriptor (stage: "interface_descriptor") [ERROR ] Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/umap2/fuzz/helpers.py", line 76, in wrapper response = func(self, *args, **kwargs) File "/usr/local/lib/python3.9/dist-packages/umap2/core/usb_interface.py", line 130, in get_descriptor d += e.get_descriptor(usb_type, valid) File "/usr/local/lib/python3.9/dist-packages/umap2/core/usb_cs_interface.py", line 63, in get_descriptor response = struct.pack('BB', length & 0xff, descriptor_type) + self.cs_config TypeError: can't concat str to bytes

[ERROR ] File "/usr/local/bin/umap2scan", line 8, in sys.exit(main()) File "/usr/local/lib/python3.9/dist-packages/umap2/apps/scan.py", line 80, in main app.run() File "/usr/local/lib/python3.9/dist-packages/umap2/apps/scan.py", line 50, in run device.run() File "/usr/local/lib/python3.9/dist-packages/umap2/core/usb_device.py", line 144, in run self.phy.run() File "/usr/local/lib/python3.9/dist-packages/umap2/phy/facedancer/max342x_phy.py", line 194, in run self.service_irqs() File "/usr/local/lib/python3.9/dist-packages/umap2/phy/facedancer/max342x_phy.py", line 217, in service_irqs self.connected_device.handle_request(b) File "/usr/local/lib/python3.9/dist-packages/umap2/core/usb_device.py", line 250, in handle_request handler(req) File "/usr/local/lib/python3.9/dist-packages/umap2/core/usb_device.py", line 322, in handle_get_descriptor_request response = response(dindex) File "/usr/local/lib/python3.9/dist-packages/umap2/core/usb_device.py", line 337, in get_configuration_descriptor return self.configurations[num].get_descriptor() File "/usr/local/lib/python3.9/dist-packages/umap2/fuzz/helpers.py", line 76, in wrapper response = func(self, *args, *kwargs) File "/usr/local/lib/python3.9/dist-packages/umap2/core/usb_configuration.py", line 97, in get_descriptor interface_descriptors += i.get_descriptor(usb_type, valid) File "/usr/local/lib/python3.9/dist-packages/umap2/fuzz/helpers.py", line 76, in wrapper response = func(self, args, **kwargs) File "/usr/local/lib/python3.9/dist-packages/umap2/dev/audio.py", line 173, in get_descriptor return super(USBAudioControlInterface, self).get_descriptor(usb_type, valid) File "/usr/local/lib/python3.9/dist-packages/umap2/fuzz/helpers.py", line 79, in wrapper self.logger.error(''.join(traceback.format_stack()))

[ERROR ] Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/umap2/fuzz/helpers.py", line 76, in wrapper response = func(self, *args, *kwargs) File "/usr/local/lib/python3.9/dist-packages/umap2/dev/audio.py", line 173, in get_descriptor return super(USBAudioControlInterface, self).get_descriptor(usb_type, valid) File "/usr/local/lib/python3.9/dist-packages/umap2/fuzz/helpers.py", line 80, in wrapper raise e File "/usr/local/lib/python3.9/dist-packages/umap2/fuzz/helpers.py", line 76, in wrapper response = func(self, args, **kwargs) File "/usr/local/lib/python3.9/dist-packages/umap2/core/usb_interface.py", line 130, in get_descriptor d += e.get_descriptor(usb_type, valid) File "/usr/local/lib/python3.9/dist-packages/umap2/core/usb_cs_interface.py", line 63, in get_descriptor response = struct.pack('BB', length & 0xff, descriptor_type) + self.cs_config TypeError: can't concat str to bytes

[ERROR ] File "/usr/local/bin/umap2scan", line 8, in sys.exit(main()) File "/usr/local/lib/python3.9/dist-packages/umap2/apps/scan.py", line 80, in main

zackcheema commented 2 years ago

I fixed this issue by using python2.7. You'll need to specify the path for the command. This can be found using the whereis command as so "whereis umap2scan". Make sure you're installing the package for python2.7. When installing packages use the target parameter like so "pip install --target=/usr/lib/python2.7/dist-packages/". Here is an example of running the scanning command "python2.7 /usr/local/bin/umap2scan –P fd:/dev/ttyUSB0".