I was gonna go to the hackspace and finish my hat, then bodies happened.

Instead, I'm doing some light Sunday reading.

I have a pair of chinese rave glasses that can display scrolling text, bitmaps, or animations. They also make you look way too cool for school.

They speak Bluetooth to a shady APK, I've put it on a disconnected phone and I'm reverse engineering the protocol. queer.af/media/kPpwoBGP0l_uV41

The protocol looks simple enough; it exposes a GATT service:

/org/bluez/hci0/dev_FF_FF_2A_00_52_DF/service0001/char0002/desc0004

char0002 has flags: read, write-without-response and notify, the device has no manufacturer info, and all the UUIDs are generic

By the way, this is from Cyberdog, if anybody wants a pair: cyberdog.net/products/rave-gla

I also have one of these collars, which is next once I finish this: cyberdog.net/collections/acces

Here's the catch: the GATT collection only includes a single descriptor (0004), and it's not writable.

Wireshark shows that the app, when you toggle them off and on, sends a GATT Command write (0x52) to handle 0x0003, with value: 01 00 02 06 09 02 05 03.

I'm not sure how to coerce BlueZ to let me do this.

Currently trying to figure out how to capture Bluetooth data with Wireshark, my bluetooth adapter isn't showing up as a capture source :(

What I can figure out of Bluetooth semantics right now: you can ask it eg. "what services do you have?", the response has UUIDs for what kind of service this is, and "handles" for referring to it.

These are global, shared between all types of objects, and what you use to execute commands.

The dump I have starts with an exchange of:

- what services do you have?
- handle 1 is an fff0 service
- include declarations(?)?
- none
- characteristics?
- handle 2 is a fff1 one, handle 3 is its value(I think?)
- what about handle 4
- it's an attribute

I've been informed that this is not, in fact, Bluetooth, but Bluetooth Low Energy, which actually has very little to do with Bluetooth

That does explain a thing or two

@embr bluepy is somewhat unstable but I had success with it talking to BLE devices

@uint8_t My current problem is honestly how I have no idea how to reproduce these two packets in BlueZ, or sniff my bluetooth bus to compare what I'm actually sending o_O

Follow

@embr @uint8_t oooh ble I did that once upon a time! Wireshark should be able to do a capture (I know it works on Linux, hcidump or sudo wireshark, suspect it works on macos and maaaaybe on Windows too? You can capture in another app and load in Wireshark for analysis anyways.)
It's possible that your Android ble stack is caching stuff that it retrieved when the device first paired, so you might get more handle descriptors if you can get it to forget that cache and capture the initial handshake. It's also possible/likely that the sketchy apk just has handles hardcoded.
You can probably poke at struct internals to force bluepy or the C BlueZ bindings to send writes to the handles you already figured out even if the GATT server doesn't provide a valid query response describing them.
I am not finding any of my old source code to refer to alas ... Will dig a little bit more.

Also, I now want a pair of those glasses.:)

Sign in to participate in the conversation
Aleph

Generalistic Mastodon instance for open-minded people. Instance Mastodon généraliste pour personnes ouvertes d'esprit.