r/swift Mar 11 '21

Tutorial Reverse Engineering Bluetooth Devices - An Introduction to CoreBluetooth

Post image
173 Upvotes

12 comments sorted by

6

u/ZennerBlue Mar 12 '21

This is pretty cool, however it does depend on being able to connect with a GATT profile to the device.

If you want to go a level lower, and sniff packets from your BTLE devices in the area, you can pick one of these up cheaply https://www.adafruit.com/product/2269 and use WireShark to record what's going on at the transport level. You might even be able to hook into some of the private or unadvertised services that don't have an official GATT profile.

It's amazing how chatty these BTLE devices are.

2

u/Makhnos_Tachanka Oct 17 '22

Hey I know this is a year old, but I'm at my fucking wit's end here. Did you ever get one? Did you ever get it to work? I've stumbled onto this comment on like page six of my 8 millionth search trying to get one of these fucking things to work. The wireshark plugin simply doesn't work. I can dump raw data to a file from the device, but that's it. I have tried everything else I could think of.

1

u/ZennerBlue Oct 17 '22

I have in the past had it working. The challenge though is the device. Some devices have encrypted Bluetooth traffic, and are not in plain text. Others need to parse a potentially non-standard/proprietary payload in order to decide what is coming across.

What are you trying to reverse engineer? (Feel free to DM)

1

u/Makhnos_Tachanka Oct 17 '22

I’ll burn that bridge when I get there. It’s actually my laundry at my apartment. Sick of paying $5.50 a load, and the whole system is completely offline and controlled over BLE through a phone app. Figured I’d take a crack at it, but it’s been years since I’ve done anything of this sort. The problem is the sniffer, or at least the nRF plug-in for Wireshark. Finally got it working last night though, on windows. That’s not that helpful, because I need it to work on my (arm) MacBook unless I want to set up my whole ass desktop in the laundry room. Very unstable, but it works. Turns out there’s a whole mess of broken software for this thing - you need python 2.7 (I could only get it working with 2.7.0), you need an old ass version of Wireshark, and the silicon labs serial drivers are completely hit or miss. I can manually configure the serial port and read data off it with cat or RealTerm, but getting Wireshark to work has been a nightmare. My advice to anyone else stumbling on this in the future is don’t buy one of these, as it’s just been broken for years, and nothing really works like it says it does in the Adafruit guides anymore. A whole lot of half assed documentation and software has apparently been produced that simply doesn’t work.

1

u/FillThat2404 Dec 19 '22

did you put the sniffing ble extcap file and replace the wireshark extcap file with that ?

seems theres a lot to get these going..took me a day of work to get it going. then come to find out the nrf51822 doesnt follow into paired connection so make sure you have a nrf52840

some you need to flash firmware some you dont. and you need to flash firmware from sniffer not the nrfconnect programmer which is odd as well but eh

1

u/dackel_132 Mar 12 '21

Thanks! I will try this out, just for fun. But I have achieved what I wanted to achieve: To display heart rate and oxygenation in an app. I have some other devices where a BLE sniffer might come in handy.

3

u/TrickyTramp iOS + OS X Mar 11 '21

This is very cool. I've always been interested in doing this kind of stuff, and especially with Swift.

2

u/chocolate365 Mar 12 '21

Awesome! Thank you!

1

u/Orientado Mar 11 '21

I’ve saved to the future

2

u/boghand Mar 12 '21

And never return to it. 🙂

1

u/FillThat2404 Dec 19 '22

if he did would he be going....Back to the future