seemoo-lab / openhaystack

Build your own 'AirTags' 🏷 today! Framework for tracking personal Bluetooth devices via Apple's massive Find My network.
https://owlink.org
GNU Affero General Public License v3.0
8.62k stars 464 forks source link

Address report decryption failure #239

Open rkreutz opened 8 months ago

rkreutz commented 8 months ago

Noticed that on some instances a single report from the results payload might fail to decrypt for reasons I'm not sure why, that is not handled by FindMyController which meant that a failing report would actually show as a random location at the Atlantic Ocean (lat 0, long 0).

This PR changes that, so the controller keeps track of whatever indexes failed to be decrypted and remove them from the array of results.

danhuanggt commented 8 months ago

I've experienced the same issue with one of my tags and traced the weird timestamp and location to line 207 where the FindMyLocationReport's are being generated with defaults values:

var decryptedReports = [FindMyLocationReport](repeating: FindMyLocationReport(lat: 0, lng: 0, acc: 0, dP: Date(), t: Date(), c: 0), count: reports.count)

Because Date() gets the current time, with each "refresh", a failing report would place the device at coordinates 0,0 with the time of the "refresh".

Thanks you for the fix @rkreutz!