DigitalSecurity / btlejuice

BtleJuice Bluetooth Smart (LE) Man-in-the-Middle framework
721 stars 124 forks source link

Issues with acquiring target on macOS #45

Open danvass opened 5 years ago

danvass commented 5 years ago

I've tried installing it on two macbook (macbook pro 2017 and macbook air 2015) and when running the proxy on one and the app on the other it seems to be able to scan for devices just fine. However, when I try to 'acquire target' it throws the following error:

[info] Server listening on port 8000
[info] Client connected
[i] Stopping current proxy.
Configuring proxy ...
[status] Acquiring target 38:89:2c:ae:ac:23
/Users/daniel/.nvm/versions/node/v8.7.0/lib/node_modules/btlejuice/proxy.js:196
    noble._bindings._gap._hci.on(
                         ^

TypeError: Cannot read property '_hci' of undefined
    at Proxy.acquireTarget (/Users/daniel/.nvm/versions/node/v8.7.0/lib/node_modules/btlejuice/proxy.js:196:26)
    at Proxy.configure (/Users/daniel/.nvm/versions/node/v8.7.0/lib/node_modules/btlejuice/proxy.js:169:10)
    at Proxy.<anonymous> (/Users/daniel/.nvm/versions/node/v8.7.0/lib/node_modules/btlejuice/proxy.js:93:12)
    at emitOne (events.js:115:13)
    at Socket.emit (events.js:210:7)
    at /Users/daniel/.nvm/versions/node/v8.7.0/lib/node_modules/btlejuice/node_modules/socket.io/lib/socket.js:503:12
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)

Any ideas on why this may be happening? I saw that _bindings doesn't seem to have _gap or _gatts so it errors in other place if I remove that.

danvass commented 5 years ago

@virtualabs would you happen to know? Thanks

virtualabs commented 5 years ago

Yes, I've already experienced this behavior: it is usually caused by an onboard Bluetooth adapter that is not compatible with noble such as a 'recent' BLE 4.2 adapter. Just use a compatible 4.0 BLE USB adapter (e.g. CSR 4.0) and everything should work as expected.

danvass commented 5 years ago

Thanks, the MacBook Air is running 4.0 but also gave the same error. I tried looking through noble issues about it but couldn’t find much. It only supports external adapters?

What’s the purpose of using noble._bindings? I couldn’t find much in their documentation either about using it like that. Thanks @virtualabs