Last active
May 29, 2022 22:02
-
-
Save jtmcdole/382a84cc05c14c7782a071348fa8e732 to your computer and use it in GitHub Desktop.
Flipper Zero Dolphin state decode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:typed_data'; | |
| import 'dart:convert'; | |
| main() { | |
| final foo = Uint8List.fromList(data); | |
| final checksum = Uint8List(1); | |
| for (int i = 8; i < foo.length; i++) { | |
| checksum[0] += foo[i]; | |
| } | |
| print('checksum: $checksum -> 0x${checksum[0].toRadixString(16)}'); | |
| printData(foo); | |
| printData(Uint8List.fromList(data2)); | |
| } | |
| printData(Uint8List data) { | |
| final b = data.buffer.asByteData(); | |
| final map = { | |
| 'magic': b.getUint8(0), | |
| 'version': b.getUint8(1), | |
| 'checksum': b.getUint8(2), | |
| 'flags': b.getUint8(3), | |
| 'timestamp': b.getUint32(4), | |
| 'dailyLimits': { | |
| 'subGhz': b.getUint8(8), | |
| 'rfid': b.getUint8(9), | |
| 'nfc': b.getUint8(10), | |
| 'ir': b.getUint8(11), | |
| 'iButton': b.getUint8(12), | |
| 'badUsb': b.getUint8(13), | |
| 'u2f': b.getUint8(14), | |
| 'butthurt': b.getUint8(15), | |
| }, | |
| 'flags32': b.getUint32(16, Endian.little), | |
| 'iCounter32': b.getUint32(20, Endian.little), | |
| 'butthurt32': b.getInt32(24, Endian.little), | |
| 'timestamp64': ((BigInt.from(b.getUint32(28, Endian.little)) << 32) | | |
| BigInt.from(b.getUint32(32, Endian.little))) | |
| .toString(), | |
| }; | |
| print(JsonEncoder.withIndent(' ').convert(map)); | |
| } | |
| final data = [ | |
| 0xD0, // magic - begin header | |
| 0x01, // version | |
| 0x1D, // checksum (all bytes of data added together) | |
| 0x00, // flags (0) | |
| 0x00, // timestamp | |
| 0x00, // " | |
| 0x00, // " | |
| 0x00, // " - end of header | |
| // Daily Limits | |
| 0x0F, // SubGhz | |
| 0x02, // Rfid | |
| 0x0F, // Nfc | |
| 0x00, // Ir | |
| 0x00, // Ibutton | |
| 0x00, // BadUsb | |
| 0x00, // U2F | |
| /// | |
| 0x20, // butthurt Daily limit? | |
| 0x00, // flags32 | |
| 0x00, // " | |
| 0x00, // " | |
| 0x00, // " | |
| 0x45, // icounter32 | |
| 0x02, // " | |
| 0x00, // " | |
| 0x00, // " | |
| 0x00, // butthurt i32 | |
| 0x00, // " | |
| 0x00, // " | |
| 0x00, // " | |
| 0x00, // timestamp64 | |
| 0x00, // " | |
| 0x00, // " | |
| 0x00, // " | |
| 0x38, // " | |
| 0x78, // " | |
| 0x86, // " | |
| 0x62, // " | |
| 0x00, // dirty (bool) | |
| 0x00, // ? | |
| 0x00, // ? | |
| 0x00, // ? | |
| ]; | |
| final data2 = [ | |
| 0xD0, | |
| 0x01, | |
| 0x90, | |
| 0x00, | |
| 0x00, | |
| 0x00, | |
| 0x00, | |
| 0x00, | |
| 0x09, | |
| 0x00, | |
| 0x0F, | |
| 0x05, | |
| 0x00, | |
| 0x0F, | |
| 0x09, | |
| 0x2E, | |
| 0x00, | |
| 0x00, | |
| 0x00, | |
| 0x00, | |
| 0xE0, | |
| 0x02, | |
| 0x00, | |
| 0x00, | |
| 0x00, | |
| 0x00, | |
| 0x00, | |
| 0x00, | |
| 0x00, | |
| 0x00, | |
| 0x00, | |
| 0x00, | |
| 0xD2, | |
| 0x84, | |
| 0x93, | |
| 0x62, | |
| 0x00, | |
| 0x00, | |
| 0x00, | |
| 0x00, | |
| ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| checksum: [31] -> 0x1f | |
| { | |
| "magic": 208, | |
| "version": 1, | |
| "checksum": 29, | |
| "flags": 0, | |
| "timestamp": 0, | |
| "dailyLimits": { | |
| "subGhz": 15, | |
| "rfid": 2, | |
| "nfc": 15, | |
| "ir": 0, | |
| "iButton": 0, | |
| "badUsb": 0, | |
| "u2f": 0, | |
| "butthurt": 32 | |
| }, | |
| "flags32": 0, | |
| "iCounter32": 581, | |
| "butthurt32": 0, | |
| "timestamp64": "1652979768" | |
| } | |
| { | |
| "magic": 208, | |
| "version": 1, | |
| "checksum": 144, | |
| "flags": 0, | |
| "timestamp": 0, | |
| "dailyLimits": { | |
| "subGhz": 9, | |
| "rfid": 0, | |
| "nfc": 15, | |
| "ir": 5, | |
| "iButton": 0, | |
| "badUsb": 15, | |
| "u2f": 9, | |
| "butthurt": 46 | |
| }, | |
| "flags32": 0, | |
| "iCounter32": 736, | |
| "butthurt32": 0, | |
| "timestamp64": "1653834962" | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Flashing my own version of the firmware erased my data; I had a saved state from last week, but I knew about where the "xp" bar was - so this is how you do it...