fO-000 / bluing

An intelligence gathering tool for hacking Bluetooth
GNU General Public License v3.0
763 stars 105 forks source link

Struct error #9

Closed project-jj closed 3 years ago

project-jj commented 3 years ago

I got an error as below.

스크린샷 2021-01-19 오후 10 50 13

Could you please let me know how to solve this error?

fO-000 commented 3 years ago

Please provide the following two pieces of information:

It looks like you are directly executing a bluescan internal module. Generally, bluescan cannot be used in this way. Please refer to the "Usage" section in README for some examples.

project-jj commented 3 years ago

The version of the bluescan is 0.4.1.

I have tried to run the command as below.

sudo bluescan -m br

I got the same error as before.

스크린샷 2021-01-21 오후 10 34 05
fO-000 commented 3 years ago

Oh, I see.

All I encountered were HCI_Extended_Inquiry_Result events. So even though I wrote the code to parse HCI_Inquiry_Result events, it hasn't had a chance to be actually tested.

The correct code should be <6sBH3sH, not <6sBB3sH. Because the reserved parameter in HCI_Inquiry_Result events is 2 octets, instead of 1 octet in HCI_Extended_Inquiry_Result events.

There are two ways to solve this problem:

  1. Modify the following code:

    # br_scan.py
    def pp_inquiry_result(self, params):
       ... ...
       # struct.unpack('<6sBB3sH', params[1:])
       struct.unpack('<6sBH3sH', params[1:])
       ... ...
       # print('Reserved: 0x%02x'% reserved)
       print('Reserved: 0x%04x' % reserved)
       ... ...
  2. Waiting for the next version of bluescan.
project-jj commented 3 years ago

Thank you for your help.