Commit Graph
67 Commits
Author SHA1 Message Date
iceman1001 669319b690 update desfire dumpformat to support verison HW,SW,PROD 2026-09-14 19:39:42 +02:00
iceman1001andClaude Opus 5 (1M context) 8fd9bcbebc hf mfdes: dump a whole card to json, and view it back
'hf mfdes dump' walked one application and printed it. It now walks
every application on the PICC, keeps what it reads, and saves a
'hf-mfdes-<UID>-dump.json' card image. '--aid' / '--isoid' / '--dfname'
still narrow it to one application, '--ns' skips the save.

The format is 'mfdes v1', written and read in fileutils.c and documented
in doc/mfdes_dump_format.md. Two decisions worth stating:

 - The PICC level is application 000000, so every key in the file says
   which AID it opens. Key version and key value are separate: a version
   with no key is the normal shape for a key that was found but never
   recovered, and a missing key never means the key is zero.

 - Every file carries a 'Read' flag. A file whose contents could not be
   fetched is recorded as unread with no data at all, rather than as a
   run of zeros. A simulator built on this must not confuse '8 bytes of
   00' with 'we could not read 8 bytes'.

'hf mfdes view -f <fn>' prints such a file with no device attached.

With no '--keys', the dump looks for 'hf-mfdes-<UID>-keys.json' by
itself, so a 'hf mfdes chk -j' run is picked up on the next dump without
naming the file again.

Two fixes fell out of testing against a DESFire EV2:

 - DesfireSetKey() calls DesfireClearContext(), which wipes command set,
   comm mode, KDF and UID, not just the key. Swapping in a per-application
   key that way left the context at 'Communication mode: n/a' and
   DesfireFillFileList() then returned junk file ids. Use
   DesfireSetKeyNoClear().

 - GetVersion and the originality signature are answered unauthenticated.
   Asking for them from inside the authenticated session produced a
   'Wrong communication mode' warning and a run of MAC mismatches.

hex_to_buffer() treats hex_max_len as a byte count while every sprint_hex*
caller passes sizeof(buf) - 1, a character count, so it writes two or
three times the buffer size. Measured, sprint_hex_inrow overflowed at
4098 input bytes. Doubling UTIL_BUFFER_SIZE_SPRINT to 16384 moves that to
8192; the mixed semantics still need auditing across ~30 call sites.

Co-Authored-By: Claude Opus 5 (1M context)
2026-09-14 09:11:38 +02:00
iceman1001andClaude Opus 5 (1M context) 2cd5285cb2 hf mfdes chk: track found keys per application
foundKeys was indexed [keytype][keyno] with no AID dimension and was
never reset between applications, so a key number recovered on one AID
was skipped without a single auth attempt on every later AID.  On a card
with AES key 00 set on two apps, only the first one was ever reported.

Give every application its own desfire_app_keys_t and hand that to the
checker.  Saving to json now uses a new 'mfdes v2' format keyed by AID,
with a loader that round-trips it; v1 is kept for existing files.

Also in the same path:
 - one auth error below 7 broke out of the key number loop, abandoning
   every remaining key number for the AID.  Only an algo mismatch (4, 50,
   51) skips the key type now; an invalid key number (3) skips just that
   key number, and a transmit error retries after a reselect
 - 3TDEA keys were stored 16 bytes wide and written out as 24
 - -k with a 24 byte key was rejected by the parser, making the 24 byte
   branch unreachable
 - DesfireGetAIDList() wrote unbounded into a 78 byte app_ids buffer

Co-Authored-By: Claude Opus 5 (1M context)
2026-09-11 10:38:57 +02:00
iceman1001 08a31f01db client now supports tilde sign '~/´ in paths 2026-09-03 14:59:37 +02:00
iceman1001 a1053ad70d New individual json dump file formats for ht1, ht2, htS, htU. '.bin' / binary format for hitag has been deprecated 2026-08-29 20:58:59 +02:00
iceman1001 2677ee541e added support for flipper iso15693 .nfc dump files. Thanks Claude 2026-08-29 12:33:05 +02:00
iceman1001 0ae01a5331 new ISO15693 dump file format with converters added. Needed since 0x100 pages and 8 byte blocks is possible 2026-08-29 11:19:39 +02:00
kormax 1167bd9701 Decompose utils from duox-related code 2026-05-05 18:27:19 +03:00
iceman1001 aa3e6611b5 added support to read bruce dump files. Only changes the file extension (.rfid) compared to the Flipper Zero (.nfc) formats 2025-11-05 16:32:05 +01:00
iceman1001 d3627920cd fix some cppchecker warnings, missing null checks, consts 2025-09-02 22:27:45 +02:00
iceman1001 2597c7576e style 2025-07-10 11:52:39 +02:00
iceman1001 c7cf62fcf1 Added support for sending and receiving MQTT messages. It enables end user to quickly upload or share JSON files between them. Given the nature of MQTT, I also worked with @KevTheHermit who has proxdump.com site, where you can upload pm3 dump files and browse. He added support for MQTT uploads, so the process to share a file and it gets also uploaded to proxdump.com is very smooth. Feel free to improve this functionality with TLS etc. For now it looks quite promising. 2025-07-08 21:15:09 +02:00
iceman1001 5de4dd68e5 text 2025-06-22 20:34:54 +02:00
iceman1001 65607fc727 added Ultralight-C simulation. hf mfu sim -t 13. Use eload first. Also added support to upload UL-C dictionaries and UL-AES to spiffs memory. A lot of textual reworked across client. Unifiy texts and a bit more color ;) 2025-06-19 17:26:20 +02:00
iceman1001 778ede25e7 renamed lua scripts. minor adaptations 2025-02-17 21:24:09 +01:00
Philippe Teuwen 02f0b1bcdd Make sure MFC dumps & keys are saved in the dump user pref path 2024-10-14 22:53:00 +02:00
Philippe Teuwen 0961b01950 add option --json to pref show 2024-10-14 21:49:40 +02:00
Philippe Teuwen 4dea606468 saveFileJSONex: reuse saveFileJSONrootEx 2024-10-14 21:48:35 +02:00
Philippe Teuwen e38f8e2d82 split saveFileJSONex 2024-10-14 20:22:55 +02:00
iceman1001 8293b81217 style 2024-10-12 13:56:17 +02:00
Philippe Teuwen 080ddc1595 fm11rf08s_nonces_with_data: save in JSON file 2024-10-06 23:14:30 +02:00
iceman1001 5f580e34ca better filehandling and memory handling in "lf em 410x brute" 2024-10-04 10:41:15 +02:00
iceman1001 3461b6f803 fixed type confusing error when trying to load none supported .picopass files. Thanks to Jump for the suggested fixes 2024-07-12 15:06:08 +02:00
iceman1001 5107b7ce04 fix fct names mismatch, const params, 2024-05-14 12:29:33 +02:00
iceman1001 1045392c73 missing header 2024-03-03 19:20:25 +01:00
Yann GASCUEL ddaba93d32 client: fileutils: iso15sim: add jfs15_v4 JSON format to fit eml fmt 2024-01-24 13:59:13 +01:00
iceman1001 a79b2bb725 fix the too long filename bug when using a smaller width param. also added some extra text for output length of binary strings in decode. One tend to not see if its 25 or 26 bits sometimes :) 2024-01-15 12:58:23 +01:00
iceman1001 9c1644cd73 support loading of flipper zero .picopass files. Also adapted to naive detect if PACS w variable length encoded is present 2023-11-05 01:50:32 +01:00
iceman1001 ae6ba395b4 added support for loading flipper MFC/MFU dump files.\nFixed NFC DECODE to identify and handle MFU dump files properly 2023-11-01 02:43:10 +01:00
iceman1001 75a70cbf53 updating json format for mfc 2023-10-30 22:22:22 +01:00
iceman1001 4f96d3eb46 style 2023-10-03 17:10:39 +02:00
iceman1001 89db5d3875 text 2023-10-02 20:59:01 +02:00
iceman1001 fb23d2047f reworked the JSON format for 14a, 14b, 15, cryptorf, lto, NDEF.\nDeprecated EML format. Pm3 client do not save EML files any more.nPm3 client will continue to load EML files. 2023-10-02 20:11:23 +02:00
iceman1001 fe31bd4064 cleaning out memory unsafe functions for loading files. Also made the loading of files to honor the preference dump/trace settings. Experimental support, which will need more love. I have been using it for some months now but there are still other save/load file operations scattered in the PM3 client which will not benefit from this yet. They need to be adapted too 2023-04-23 11:32:32 +02:00
iceman1001 039937e28a added the possibility to load .MCT dump files in the client. MCT format is a textual one like EML but with extra descriptive lines of text before each sector 2023-04-23 11:27:12 +02:00
iceman1001 dab3171ba6 added loadbinarykeys fct which takes fn and loads binary MFC keys into two arrays KeyA, KeyB. 2023-03-30 22:38:03 +02:00
iceman1001 53808f2c7f sanity checks and style 2022-12-31 23:07:54 +01:00
iceman1001 62980b5038 refactored topaz commands. It still uses a global var with dynamic memory. Added rdbl, wrbl, view, dump commands to match rest of client 2022-08-05 22:46:59 +02:00
iceman1001 e17fc29e41 added the skeleton for fudan card support 2022-07-09 12:25:03 +02:00
iceman1001 2c61530cba minors stuff, added some blowfish decrypt 2022-06-06 12:59:09 +02:00
iceman1001 d4c3082741 refactoring loading dump files 2022-05-15 23:06:46 +02:00
Philippe Teuwen 30aa7aa7d1 Adapting license headers, WIP 2022-01-08 00:40:52 +01:00
iceman1001 81c6918ac5 cppcheck 2022-01-06 23:25:25 +01:00
Philippe Teuwen 232843477c typos 2021-10-16 23:44:53 +02:00
Philippe Teuwen dd3b63ae32 rename global session 2021-08-21 20:31:05 +02:00
merlokk c83c62855b add saveFileJSONrootEx with overwrite function 2021-05-28 14:33:22 +03:00
iceman1001 358bdb7022 dynamic loading and freeing 2021-05-08 19:49:14 +02:00
iceman1001 cbf045dddb refactor fido2 commands to use load and save fcts from fileutils.c. They will now load from /client/resources and save a new file in working dir 2021-05-08 14:59:40 +02:00
iceman1001 52494a6456 added a load json root fct 2021-05-08 10:47:59 +02:00
iceman1001 b3064c4888 style 2021-02-17 08:59:20 +01:00