Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

numap-emulate -C mass_storage fails to emulate #12

Open
keesj opened this issue May 21, 2021 · 3 comments
Open

numap-emulate -C mass_storage fails to emulate #12

keesj opened this issue May 21, 2021 · 3 comments
Labels
technical support request for technical support

Comments

@keesj
Copy link

keesj commented May 21, 2021

numap-emulate -C mass_storage

numap-emulate -C mass_storage fails with s = self.strings[num - 1].encode('utf-16') AttributeError: 'bytes' object has no attribute 'encode'

The main reason is that the serial number in the descriptor is actually a byte array

DEBUG:numap:[MassStorageDevice] get_string_descriptor: 0x3 (0x4)
[ERROR ] Traceback (most recent call last):

"Fixed" this issue by converting the byte array to a string e.g.

diff --git a/numap/dev/mass_storage.py b/numap/dev/mass_storage.py
index 1db061c..577ed0f 100644
--- a/numap/dev/mass_storage.py
+++ b/numap/dev/mass_storage.py
@@ -528,7 +528,7 @@ class USBMassStorageDevice(USBDevice):
             device_rev=rev,
             manufacturer_string='PNY',
             product_string='USB 2.0 FD',
-            serial_number_string=b'4731020ef1914da9',
+            serial_number_string='4731020ef1914da9',
             configurations=[
                 USBConfiguration(
                     app=app,
ERROR:numap:Traceback (most recent call last):
  File "/home/pentest/projects/nu-map/numap/apps/emulate.py", line 42, in run
    self.dev.run()
  File "/home/pentest/projects/Facedancer/facedancer/USBDevice.py", line 165, in run
    self.scheduler.run()
  File "/home/pentest/projects/Facedancer/facedancer/core.py", line 509, in run
    task()
  File "/home/pentest/projects/Facedancer/facedancer/USBDevice.py", line 83, in <lambda>
    self.scheduler.add_task(lambda : self.maxusb_app.service_irqs())
  File "/home/pentest/projects/Facedancer/facedancer/backends/greatdancer.py", line 765, in service_irqs
    self._handle_setup_events()
  File "/home/pentest/projects/Facedancer/facedancer/backends/greatdancer.py", line 368, in _handle_setup_events
    self._handle_setup_event_on_endpoint(i)
  File "/home/pentest/projects/Facedancer/facedancer/backends/greatdancer.py", line 402, in _handle_setup_event_on_endpoint
    self.connected_device.handle_request(request)
  File "/home/pentest/projects/Facedancer/facedancer/USBDevice.py", line 251, in handle_request
    handler(req)
  File "/home/pentest/projects/Facedancer/facedancer/USBDevice.py", line 326, in handle_get_descriptor_request
    response = response(dindex)
  File "/home/pentest/projects/nu-map/numap/core/usb_device.py", line 290, in handle_get_string_descriptor_request
    return self.get_string_descriptor(num)
  File "/home/pentest/projects/nu-map/numap/fuzz/helpers.py", line 81, in wrapper
    raise e
  File "/home/pentest/projects/nu-map/numap/fuzz/helpers.py", line 77, in wrapper
    response = func(self, *args, **kwargs)
  File "/home/pentest/projects/nu-map/numap/core/usb_device.py", line 269, in get_string_descriptor
    s = self.strings[num - 1].encode('utf-16')
AttributeError: 'bytes' object has no attribute 'encode'
@straithe straithe added the technical support request for technical support label Nov 4, 2021
@straithe
Copy link
Member

Are you still experiencing this issue, @keesj ?

@straithe straithe self-assigned this Nov 15, 2021
@keesj
Copy link
Author

keesj commented Nov 30, 2021

I just updated the software (nu-map and Facedancer) and yes the issue is still there
log.txt

@straithe
Copy link
Member

Thank you for the update! I don't have the skills to assist you yet, and my team is spread pretty thin at the moment, but I'll make sure we get to this as soon as we can.

@straithe straithe removed their assignment Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
technical support request for technical support
Projects
None yet
Development

No branches or pull requests

2 participants