hexway / apple_bleee

Apple BLE research
GNU General Public License v3.0
2.09k stars 302 forks source link

Running on Mac OS X Mojave? #4

Closed PaulMest closed 5 years ago

PaulMest commented 5 years ago

Thanks for the demos. I find this really interesting!

I tried getting this to run on my Mac, but couldn't. The things that helped me were to install pybluez directly from their GitHub repo instead of from their old release on PyPI.

I've left some instructions here on how to do that here: https://stackoverflow.com/a/57210242/872328

Basically:

$ pip install git+https://github.com/pybluez/pybluez.git

And then you can just:

# import bluetooth._bluetooth
import bluetooth

However, then I ran into this issue:

$ python ble_read_state.py
Traceback (most recent call last):
  File "ble_read_state.py", line 60, in <module>
    toggle_device(dev_id, True)
  File "/code/open-source/apple_bleee/utils/bluetooth_utils.py", line 88, in toggle_device
    hci_sock = socket.socket(socket.AF_BLUETOOTH,
AttributeError: module 'socket' has no attribute 'AF_BLUETOOTH'

This is where I gave up. I'm hoping someone else can figure out if it's possible or if there is a critical missing dependency on Mac that hasn't been ported over from Linux yet.

nikhiljha commented 5 years ago

Looks like AF_BLUETOOTH is something that needs to be built in during python compile time. Anaconda doesn't support it, and it's either very difficult or impossible to get it to work on Mac (I found many threads with people asking for help to get it to work, and 0 possible replies).

It might still be doable, but difficult.

hexway commented 5 years ago

We didn't test these scripts on Mac. Please use VM

bruno-cassina commented 9 months ago

I'm running kali on WSL and get the same error


  File "/mnt/c/Users/someone/Desktop/apple_bleee/ble_read_state.py", line 65, in <module>
    toggle_device(dev_id, True)
  File "/mnt/c/Users/someone/Desktop/apple_bleee/utils/bluetooth_utils.py", line 88, in toggle_device
    hci_sock = socket.socket(socket.AF_BLUETOOTH,
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/socket.py", line 232, in __init__
    _socket.socket.__init__(self, family, type, proto, fileno)
OSError: [Errno 97] Address family not supported by protocol```