Merge branch 'RfidResearchGroup:master' into BWM-work

This commit is contained in:
Niel Nielsen authored and GitHub committed 2026-09-03 12:50:56 +02:00
commit 24e4181907
10 files changed
+802 -179

No files matched your search

+7
View File
@@ -64,6 +64,12 @@ test):
- If your change adds/changes a client command, run `make commands` to
regenerate `doc/commands.md` and `doc/commands.json` — don't hand-edit
those generated files.
- **Keep comments short and direct.** This codebase comments in brief fragments,
usually one line. Match the surrounding file. No walls of text. A comment earns
its place by saying something the code cannot e.g. a return contract, where a
magic number came from, or why something is deliberately absent. Do not restate
the code or place commit message content, reasoning, or justification into the
source. Anything longer than 3-4 lines usually belongs in the PR instead.
- **Preserve existing comments** in code you touch or move. Don't drop,
"clean up", or silently reword neighboring comments as a side effect of an
unrelated change.
@@ -107,6 +113,7 @@ Structure the PR description in these sections:
- [ ] Platform-sensitive code reasoned about / tested on Linux, Windows
(ProxSpace/WSL), and macOS (if applicable) — state which were tested
- [ ] Existing comments in touched files preserved
- [ ] New comments short and direct, no restated code or PR prose
- [ ] `doc/commands.md` / `doc/commands.json` regenerated if commands changed
## Commit attribution
+1
View File
@@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
## [unreleased][unreleased]
- Added `hf_legic_rdv4` - Standalone mode for managing 7 persistent legic dumps (@digitalhoax)
- Fixed `lf t55xx detect` - dropped the psk3 candidates, which run the same demodulation as the psk2 one beside them and so can never match a psk3 tag, only fire on demodulation errors (@mfcarroll)
- Fixed `lf t55xx detect` - a psk3 tag read back as psk2 with a block 0 one bit out, and a freshly wiped psk2 tag was reported as psk3 on no evidence; the two are now reported as ambiguous where the waveform cannot separate them, and block 0 is narrowed using the subcarrier, the broadcast period and whether password mode is in use (@mfcarroll)
- Added doc/md/PM5_Start_Here/Getting_Started_With_PM5.md now exists as a starting point for those who have their PM5 (@innocentbystanderproxmark)
+3 -2
View File
@@ -75,11 +75,12 @@ The last hardware generation is called Proxmark5. It has
- TypeC Extended Port (CEP)
- BLE / Wifi / Battery Addon, via a ESp32c2
- Swappable antennas (LF, HF, UHF)
- 125, 134, 250, 375, 500 KHz Low Frequency Antenna (LF
- 125, 134, 250, 375, 500 KHz Low Frequency Antenna (LF)
- 13.56 MHz High Frequency Antenna (HF)
- as a addon: 860-960 MHz Ultra High Frequency Antenna (UHF), ** not developed yet **
See the instruction links in the tables above to build, flash and run for your Proxmark5 device.
At the moment, Proxmark5-specific instructions are all grouped in [a single Getting Started guide](doc/md/PM5_Start_Here/Getting_Started_With_PM5.md).
Read it to build, flash and run your Proxmark5 device. See the instruction links in the tables above to get the compilation environment.
- ⚠ The firmware is not stable at the moment and is actively being developed at.
- ⚠ Don't install the BWM addon board for now.
+5 -2
View File
@@ -110,6 +110,9 @@ define KNOWN_STANDALONE_DEFINITIONS
| HF_LEGIC | Read/simulate Legic Prime tags |
| | storing in flashmem |
+-----------------------------------------------------------+
| HF_LEGIC_RDV4 | Read/simulate Legic Prime tags |
| | storing in 7 persistent mem slots(RDV4)|
+-----------------------------------------------------------+
| HF_LEGICSIM | Simulate Legic Prime tags |
| (RDV4 only) | stored on flashmem |
+-----------------------------------------------------------+
@@ -151,11 +154,11 @@ endef
STANDALONE_MODES := LF_SKELETON
STANDALONE_MODES += LF_EM4100EMUL LF_EM4100RSWB LF_EM4100RSWW LF_EM4100RWC LF_HIDBRUTE LF_HIDFCBRUTE LF_ICEHID LF_MULTIHID LF_NEDAP_SIM LF_NEXID LF_PROXBRUTE LF_PROX2BRUTE LF_SAMYRUN LF_THAREXDE
STANDALONE_MODES += HF_14ASNIFF HF_14BSNIFF HF_15SNIFF HF_15SIM HF_AVEFUL HF_BOG HF_CARDHOPPER HF_COLIN HF_CRAFTBYTE HF_DOEGOX_AUTH0 HF_DOEGOX_COMMIT HF_ICECLASS HF_LEGIC HF_LEGICSIM HF_MATTYRUN HF_MFCSIM HF_MSDSAL HF_REBLAY HF_ST25_TEAROFF HF_TCPRST HF_TMUDFORD HF_UNISNIFF HF_YOUNG HF_EMVPNG
STANDALONE_MODES += HF_14ASNIFF HF_14BSNIFF HF_15SNIFF HF_15SIM HF_AVEFUL HF_BOG HF_CARDHOPPER HF_COLIN HF_CRAFTBYTE HF_DOEGOX_AUTH0 HF_DOEGOX_COMMIT HF_ICECLASS HF_LEGIC HF_LEGIC_RDV4 HF_LEGICSIM HF_MATTYRUN HF_MFCSIM HF_MSDSAL HF_REBLAY HF_ST25_TEAROFF HF_TCPRST HF_TMUDFORD HF_UNISNIFF HF_YOUNG HF_EMVPNG
STANDALONE_MODES += DANKARMULTI
STANDALONE_MODES_REQ_BT := HF_CARDHOPPER HF_REBLAY
STANDALONE_MODES_REQ_SMARTCARD :=
STANDALONE_MODES_REQ_FLASH := LF_HIDFCBRUTE LF_ICEHID LF_NEXID LF_THAREXDE HF_BOG HF_COLIN HF_ICECLASS HF_LEGICSIM HF_MFCSIM HF_ST25_TEAROFF
STANDALONE_MODES_REQ_FLASH := LF_HIDFCBRUTE LF_ICEHID LF_NEXID LF_THAREXDE HF_BOG HF_COLIN HF_ICECLASS HF_LEGIC_RDV4 HF_LEGICSIM HF_MFCSIM HF_ST25_TEAROFF
ifneq ($(filter $(STANDALONE),$(STANDALONE_MODES)),)
STANDALONE_PLATFORM_DEFS += -DWITH_STANDALONE_$(STANDALONE)
ifneq ($(filter $(STANDALONE),$(STANDALONE_MODES_REQ_SMARTCARD)),)
+4
View File
@@ -129,6 +129,10 @@ endif
ifneq (,$(findstring WITH_STANDALONE_HF_LEGIC,$(APP_CFLAGS)))
SRC_STANDALONE = hf_legic.c
endif
# WITH_STANDALONE_HF_LEGIC_RDV4
ifneq (,$(findstring WITH_STANDALONE_HF_LEGIC_RDV4,$(APP_CFLAGS)))
SRC_STANDALONE = hf_legic_rdv4.c
endif
# WITH_STANDALONE_HF_LEGICSIM
ifneq (,$(findstring WITH_STANDALONE_HF_LEGICSIM,$(APP_CFLAGS)))
SRC_STANDALONE = hf_legicsim.c
+2 -2
View File
@@ -136,7 +136,7 @@ set(STANDALONE_MODES
LF_PROXBRUTE LF_PROX2BRUTE LF_SAMYRUN LF_THAREXDE
HF_14ASNIFF HF_14BSNIFF HF_15SNIFF HF_15SIM
HF_AVEFUL HF_BOG HF_CARDHOPPER HF_COLIN HF_CRAFTBYTE HF_ICECLASS
HF_LEGIC HF_LEGICSIM HF_MATTYRUN HF_MFCSIM HF_MSDSAL HF_REBLAY
HF_LEGIC HF_LEGIC_RDV4 HF_LEGICSIM HF_MATTYRUN HF_MFCSIM HF_MSDSAL HF_REBLAY
HF_ST25_TEAROFF HF_TCPRST HF_TMUDFORD HF_UNISNIFF HF_YOUNG HF_EMVPNG DANKARMULTI)
# List of modes that require bluetooth
set(STANDALONE_MODES_REQ_BT HF_CARDHOPPER HF_REBLAY)
@@ -145,7 +145,7 @@ set(STANDALONE_MODES_REQ_SMARTCARD)
# List of modes that require flash
set(STANDALONE_MODES_REQ_FLASH
LF_HIDFCBRUTE LF_ICEHID LF_NEXID LF_THAREXDE HF_BOG HF_COLIN
HF_ICECLASS HF_LEGICSIM HF_MFCSIM)
HF_ICECLASS HF_LEGIC_RDV4 HF_LEGICSIM HF_MFCSIM)
message(STATUS "STANDALONE = ${STANDALONE}")
message(STATUS "STANDALONE_MODES = ${STANDALONE_MODES}")
+4
View File
@@ -112,6 +112,10 @@ if ("${APP_CFLAGS}" MATCHES "WITH_STANDALONE_HF_LEGIC")
set(SRC_STANDALONE "${DIR_STANDALONE}/hf_legic.c")
endif ()
if ("${APP_CFLAGS}" MATCHES "WITH_STANDALONE_HF_LEGIC_RDV4")
set(SRC_STANDALONE "${DIR_STANDALONE}/hf_legic_rdv4.c")
endif ()
if ("${APP_CFLAGS}" MATCHES "WITH_STANDALONE_HF_LEGICSIM")
set(SRC_STANDALONE "${DIR_STANDALONE}/hf_legicsim.c")
endif ()
+447
View File
@@ -0,0 +1,447 @@
//-----------------------------------------------------------------------------
// Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// See LICENSE.txt for the text of the license.
//-----------------------------------------------------------------------------
// main code for Legic Prime 7-slot persistent read/sim (RDV4)
//-----------------------------------------------------------------------------
#include "standalone.h"
#include "proxmark3_arm.h"
#include "BigBuf.h"
#include "appmain.h"
#include "fpga_apis.h"
#include "fpga_loader.h"
#include "util.h"
#include "dbprint.h"
#include "ticks_apis.h"
#include "legicrf.h"
#include "legicrfsim.h"
#include "legic.h" // legic_card_select_t struct
#include "spiffs.h" // flashmem
#include "string.h"
#include <inttypes.h>
#define LEGIC_SLOT_COUNT 7
#define LEGIC_DUMP_FILENAME_FORMAT "hf-legic-slot-%u.bin"
typedef enum {
MODE_SCAN = 0,
MODE_EMULATE = 1
} legic_mode_t;
typedef struct {
bool populated;
uint16_t cardsize;
uint8_t tagtype; // ct: 0=MIM22, 1=MIM256, 2=MIM1024
uint8_t uid[4];
} legic_slot_t;
// Static module-level storage to minimize stack frame pressure
static legic_slot_t s_slots[LEGIC_SLOT_COUNT];
static char s_filename[32];
static uint8_t get_slot_led_mask(uint8_t slot_1_to_7) {
uint8_t mask = 0;
if (slot_1_to_7 & 1) mask |= LED_B;
if (slot_1_to_7 & 2) mask |= LED_C;
if (slot_1_to_7 & 4) mask |= LED_D;
return mask;
}
static const char *get_tagtype_name(uint8_t tagtype) {
switch (tagtype) {
case 0: return "MIM22";
case 1: return "MIM256";
case 2: return "MIM1024";
default: return "Unknown";
}
}
static bool save_slot_from_emulator(uint8_t slot, uint16_t cardsize) {
#ifdef WITH_FLASH
if (slot >= LEGIC_SLOT_COUNT) return false;
sprintf(s_filename, LEGIC_DUMP_FILENAME_FORMAT, (unsigned int)(slot + 1));
uint8_t *mem = BigBuf_get_EM_addr();
if (!mem) return false;
if (cardsize == 0 || cardsize > 1024) cardsize = 1024;
rdv40_spiffs_write(s_filename, mem, cardsize, RDV40_SPIFFS_SAFETY_SAFE);
return true;
#else
return false;
#endif
}
static bool load_slot_to_emulator(uint8_t slot, uint16_t *out_cardsize, uint8_t *out_tagtype) {
#ifdef WITH_FLASH
if (slot >= LEGIC_SLOT_COUNT) return false;
sprintf(s_filename, LEGIC_DUMP_FILENAME_FORMAT, (unsigned int)(slot + 1));
if (!exists_in_spiffs(s_filename)) {
return false;
}
uint32_t size = size_in_spiffs(s_filename);
if (size == 0) {
return false;
}
if (size > 1024) size = 1024;
uint8_t *emCARD = BigBuf_get_EM_addr();
if (!emCARD) return false;
memset(emCARD, 0, 1024);
rdv40_spiffs_read_as_filetype(s_filename, emCARD, size, RDV40_SPIFFS_SAFETY_SAFE);
if (out_cardsize) *out_cardsize = (uint16_t)size;
if (out_tagtype) {
if (size <= 22) *out_tagtype = 0;
else if (size <= 256) *out_tagtype = 1;
else *out_tagtype = 2;
}
return true;
#else
return false;
#endif
}
static bool save_scanned_card(uint8_t slot, const legic_card_select_t *p_card) {
#ifdef WITH_FLASH
if (slot >= LEGIC_SLOT_COUNT || !p_card) return false;
sprintf(s_filename, LEGIC_DUMP_FILENAME_FORMAT, (unsigned int)(slot + 1));
uint8_t *mem = BigBuf_get_EM_addr();
if (!mem) return false;
uint16_t size = p_card->cardsize;
if (size == 0 || size > 1024) size = 1024;
rdv40_spiffs_write(s_filename, mem, size, RDV40_SPIFFS_SAFETY_SAFE);
return true;
#else
return false;
#endif
}
static void wait_button_release(void) {
while (BUTTON_PRESS()) {
WDT_HIT();
SpinDelay(10);
}
SpinDelay(20);
}
static int get_button_event(void) {
uint32_t press_start = GetTickCount();
// 1. Measure the first press duration
while (BUTTON_PRESS()) {
WDT_HIT();
if (data_available()) return BUTTON_HOLD;
if (GetTickCount() - press_start >= 1000) {
wait_button_release();
return BUTTON_HOLD;
}
SpinDelay(10);
}
SpinDelay(20);
// 2. Wait up to 350ms for a second click
uint32_t release_time = GetTickCount();
while (GetTickCount() - release_time < 350) {
WDT_HIT();
if (data_available()) return BUTTON_HOLD;
if (BUTTON_PRESS()) {
uint32_t second_press_start = GetTickCount();
while (BUTTON_PRESS()) {
WDT_HIT();
if (data_available()) return BUTTON_HOLD;
if (GetTickCount() - second_press_start >= 1000) {
wait_button_release();
return BUTTON_HOLD;
}
SpinDelay(10);
}
wait_button_release();
return BUTTON_DOUBLE_CLICK;
}
SpinDelay(10);
}
return BUTTON_SINGLE_CLICK;
}
static int wait_and_poll_button(uint32_t delay_ms) {
uint32_t start = GetTickCount();
while (GetTickCount() - start < delay_ms) {
WDT_HIT();
if (data_available()) {
return BUTTON_HOLD;
}
if (BUTTON_PRESS()) {
return get_button_event();
}
SpinDelay(10);
}
return BUTTON_NO_CLICK;
}
static int check_button_after_sim(void) {
if (BUTTON_PRESS()) {
return get_button_event();
}
// Button was released during sim exit (click 1 finished).
// Wait up to 350ms for click 2.
uint32_t release_time = GetTickCount();
while (GetTickCount() - release_time < 350) {
WDT_HIT();
if (data_available()) return BUTTON_HOLD;
if (BUTTON_PRESS()) {
uint32_t second_press_start = GetTickCount();
while (BUTTON_PRESS()) {
WDT_HIT();
if (data_available()) return BUTTON_HOLD;
if (GetTickCount() - second_press_start >= 1000) {
wait_button_release();
return BUTTON_HOLD;
}
SpinDelay(10);
}
wait_button_release();
return BUTTON_DOUBLE_CLICK;
}
SpinDelay(10);
}
return BUTTON_SINGLE_CLICK;
}
void ModInfo(void) {
DbpString(" HF Legic Prime 7-slot RDV4 standalone");
}
void RunMod(void) {
StandAloneMode();
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
BigBuf_Clear_ext(false);
BigBuf_get_EM_addr();
#ifdef WITH_FLASH
rdv40_spiffs_lazy_mount();
#endif
Dbprintf("[=] =========================================================");
Dbprintf("[=] Proxmark3 RDV4: Legic Prime 7-Slot Standalone Mode ");
Dbprintf("[=] =========================================================");
Dbprintf("[=] Controls:");
Dbprintf("[=] - Single Click : Cycle to next slot (1 -> 2 -> ... -> 7)");
Dbprintf("[=] - Double Click : Toggle between Scan and Emulation mode");
Dbprintf("[=] - Long Hold : Exit standalone mode (1 second hold)");
Dbprintf("[=] LED Signaling:");
Dbprintf("[=] - LEDs B, C, D : Binary slot number (1 to 7)");
Dbprintf("[=] - Blinking : Scan Mode (searching for Legic tags)");
Dbprintf("[=] - Solid + LED A: Emulation Mode (tag simulated on HF)");
Dbprintf("[=] ---------------------------------------------------------");
memset(s_slots, 0, sizeof(s_slots));
Dbprintf("[=] Checking SPIFFS memory slots (1 to 7)...");
for (uint8_t i = 0; i < LEGIC_SLOT_COUNT; i++) {
sprintf(s_filename, LEGIC_DUMP_FILENAME_FORMAT, (unsigned int)(i + 1));
#ifdef WITH_FLASH
if (exists_in_spiffs(s_filename)) {
uint32_t sz = size_in_spiffs(s_filename);
if (sz > 0) {
s_slots[i].populated = true;
s_slots[i].cardsize = (uint16_t)sz;
if (sz <= 22) s_slots[i].tagtype = 0;
else if (sz <= 256) s_slots[i].tagtype = 1;
else s_slots[i].tagtype = 2;
rdv40_spiffs_read_as_filetype(s_filename, s_slots[i].uid, sizeof(s_slots[i].uid), RDV40_SPIFFS_SAFETY_SAFE);
Dbprintf("[=] Slot %u: [LOADED] %s (%s, %u bytes, UID: %02X %02X %02X %02X)",
(unsigned int)(i + 1), s_filename, get_tagtype_name(s_slots[i].tagtype), (unsigned int)sz,
s_slots[i].uid[0], s_slots[i].uid[1], s_slots[i].uid[2], s_slots[i].uid[3]);
continue;
}
}
#endif
Dbprintf("[=] Slot %u: [ EMPTY ] (%s not found)", (unsigned int)(i + 1), s_filename);
}
Dbprintf("[=] ---------------------------------------------------------");
uint8_t current_slot = 0;
legic_mode_t current_mode = s_slots[0].populated ? MODE_EMULATE : MODE_SCAN;
if (current_mode == MODE_EMULATE) {
Dbprintf("[=] Slot 1 has stored card data -> Starting in EMULATION MODE");
} else {
Dbprintf("[=] Slot 1 is empty -> Starting in SCAN MODE");
}
for (;;) {
WDT_HIT();
if (data_available()) break;
// ====================================================================
// SCAN MODE (Searching for Legic tags)
// ====================================================================
if (current_mode == MODE_SCAN) {
uint8_t slot_leds = get_slot_led_mask(current_slot + 1);
// Phase 1: Slot LEDs ON (250ms)
LEDsoff();
LED(slot_leds, 0);
int btn = wait_and_poll_button(250);
if (btn == BUTTON_HOLD) {
DbpString("[=] Long hold detected. Exiting standalone mode...");
break;
}
if (btn == BUTTON_SINGLE_CLICK) {
current_slot = (current_slot + 1) % LEGIC_SLOT_COUNT;
Dbprintf("[=] Advanced to Slot %u", (unsigned int)(current_slot + 1));
if (s_slots[current_slot].populated) {
current_mode = MODE_EMULATE;
Dbprintf("[=] Slot %u has card data -> Switched to EMULATION MODE", (unsigned int)(current_slot + 1));
}
continue;
}
if (btn == BUTTON_DOUBLE_CLICK) {
if (s_slots[current_slot].populated) {
current_mode = MODE_EMULATE;
Dbprintf("[=] Double click -> Switched Slot %u to EMULATION MODE", (unsigned int)(current_slot + 1));
} else {
Dbprintf("[!] Double click ignored: Slot %u is empty", (unsigned int)(current_slot + 1));
}
continue;
}
// Phase 2: Slot LEDs OFF (250ms)
LEDsoff();
btn = wait_and_poll_button(250);
if (btn == BUTTON_HOLD) {
DbpString("[=] Long hold detected. Exiting standalone mode...");
break;
}
if (btn == BUTTON_SINGLE_CLICK) {
current_slot = (current_slot + 1) % LEGIC_SLOT_COUNT;
Dbprintf("[=] Advanced to Slot %u", (unsigned int)(current_slot + 1));
if (s_slots[current_slot].populated) {
current_mode = MODE_EMULATE;
Dbprintf("[=] Slot %u has card data -> Switched to EMULATION MODE", (unsigned int)(current_slot + 1));
}
continue;
}
if (btn == BUTTON_DOUBLE_CLICK) {
if (s_slots[current_slot].populated) {
current_mode = MODE_EMULATE;
Dbprintf("[=] Double click -> Switched Slot %u to EMULATION MODE", (unsigned int)(current_slot + 1));
} else {
Dbprintf("[!] Double click ignored: Slot %u is empty", (unsigned int)(current_slot + 1));
}
continue;
}
// RF Reader poll attempt (identical to hf_legic.c)
int read_success = LegicRfReaderEx(0, 1024, 0x55);
if (read_success != PM3_ESOFT) {
legic_card_select_t *p_card = getLegicCardInfo();
if (p_card && p_card->cardsize > 0) {
uint8_t ct = 2;
switch (p_card->tagtype) {
case 0x0D: ct = 0; break;
case 0x1D: ct = 1; break;
case 0x3D: ct = 2; break;
default: ct = 2; break;
}
Dbprintf(_GREEN_("[+] [TAG DETECTED] Read successful on Slot %u!"), (unsigned int)(current_slot + 1));
Dbprintf("[+] UID : %02X %02X %02X %02X", p_card->uid[0], p_card->uid[1], p_card->uid[2], p_card->uid[3]);
Dbprintf("[+] Type: %s (0x%02X), Size: %u bytes",
get_tagtype_name(ct), (unsigned int)p_card->tagtype, (unsigned int)p_card->cardsize);
// Signal successful read with rapid all-LED blink
SpinErr(LED_A | LED_B | LED_C | LED_D, 80, 4);
if (save_scanned_card(current_slot, p_card)) {
s_slots[current_slot].populated = true;
s_slots[current_slot].cardsize = p_card->cardsize;
s_slots[current_slot].tagtype = ct;
memcpy(s_slots[current_slot].uid, p_card->uid, 4);
Dbprintf(_GREEN_("[+] Card dump saved to Slot %u! Switching to EMULATION MODE."), (unsigned int)(current_slot + 1));
current_mode = MODE_EMULATE;
} else {
DbpString(_RED_("[!] Failed to save card dump to flash memory."));
}
}
}
}
// ====================================================================
// EMULATION MODE (Emulating Legic card on HF)
// ====================================================================
else if (current_mode == MODE_EMULATE) {
uint16_t cardsize = 1024;
uint8_t tagtype = 2;
if (!load_slot_to_emulator(current_slot, &cardsize, &tagtype)) {
Dbprintf("[!] Slot %u data could not be loaded from flash. Switching to SCAN MODE.", (unsigned int)(current_slot + 1));
s_slots[current_slot].populated = false;
current_mode = MODE_SCAN;
continue;
}
uint8_t slot_leds = get_slot_led_mask(current_slot + 1);
LEDsoff();
LED(LED_A | slot_leds, 0);
Dbprintf("[=] >>> Slot %u EMULATION ACTIVE (%s, %u bytes, UID: %02X %02X %02X %02X) <<<",
(unsigned int)(current_slot + 1), get_tagtype_name(tagtype), (unsigned int)cardsize,
s_slots[current_slot].uid[0], s_slots[current_slot].uid[1],
s_slots[current_slot].uid[2], s_slots[current_slot].uid[3]);
// Run native simulation (blocks until button pressed or USB command received)
LegicRfSimulate(tagtype, false);
// Persist any reader writes back to flash
save_slot_from_emulator(current_slot, cardsize);
if (data_available()) {
break;
}
int btn = check_button_after_sim();
if (btn == BUTTON_HOLD) {
DbpString("[=] Long hold detected. Exiting standalone mode...");
break;
}
if (btn == BUTTON_DOUBLE_CLICK) {
Dbprintf("[=] Double click -> Switched Slot %u to SCAN MODE (ready to overwrite)", (unsigned int)(current_slot + 1));
current_mode = MODE_SCAN;
} else if (btn == BUTTON_SINGLE_CLICK) {
current_slot = (current_slot + 1) % LEGIC_SLOT_COUNT;
Dbprintf("[=] Single click -> Advanced to Slot %u", (unsigned int)(current_slot + 1));
if (s_slots[current_slot].populated) {
current_mode = MODE_EMULATE;
} else {
Dbprintf("[=] Slot %u is empty -> Switched to SCAN MODE", (unsigned int)(current_slot + 1));
current_mode = MODE_SCAN;
}
}
}
}
BigBuf_free_keep_EM();
LEDsoff();
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
DbpString("[=] Standalone mode exited.");
}
+328 -173
View File
@@ -610,7 +610,7 @@ static const ndef_wifi_type_t wifi_crypt_types[] = {
{"AES/TKIP", {0x00, 0x0C}}
};
static const char *ndef_wifi_crypt_lookup(uint8_t *d) {
static const char *ndef_wifi_crypt_lookup(const uint8_t *d) {
for (int i = 0; i < ARRAYLEN(wifi_crypt_types); ++i) {
if (memcmp(d, wifi_crypt_types[i].bytes, 2) == 0) {
return wifi_crypt_types[i].description;
@@ -629,7 +629,7 @@ static const ndef_wifi_type_t wifi_auth_types[] = {
{"WPA/WPA2 PERSONAL", {0x00, 0x22}}
};
static const char *ndef_wifi_auth_lookup(uint8_t *d) {
static const char *ndef_wifi_auth_lookup(const uint8_t *d) {
for (int i = 0; i < ARRAYLEN(wifi_auth_types); ++i) {
if (memcmp(d, wifi_auth_types[i].bytes, 2) == 0) {
return wifi_auth_types[i].description;
@@ -638,6 +638,331 @@ static const char *ndef_wifi_auth_lookup(uint8_t *d) {
return "";
}
static bool ndef_wifi_print_attribute_length(const char *name, size_t len, size_t min_len, size_t max_len, size_t multiple) {
bool valid = len >= min_len && len <= max_len;
if (multiple > 1) {
valid = valid && (len % multiple == 0);
}
if (valid) {
return true;
}
if (min_len == max_len) {
PrintAndLogEx(WARNING, "%s has invalid length %zu (expected %zu bytes)", name, len, min_len);
} else if (multiple > 1) {
PrintAndLogEx(WARNING, "%s has invalid length %zu (expected %zu-%zu bytes in multiples of %zu)",
name, len, min_len, max_len, multiple);
} else {
PrintAndLogEx(WARNING, "%s has invalid length %zu (expected %zu-%zu bytes)", name, len, min_len, max_len);
}
return false;
}
static void ndef_wifi_print_string(const char *label, const uint8_t *value, size_t len) {
while (len > 0 && value[len - 1] == 0) {
len--;
}
PrintAndLogEx(INFO, "%s %s", label, sprint_hex_ascii(value, len));
}
static void ndef_wifi_print_device_type(const uint8_t *value) {
PrintAndLogEx(INFO, " Category...... %u", (unsigned)MemBeToUint2byte(value));
PrintAndLogEx(INFO, " OUI........... %s", sprint_hex(value + 2, 4));
PrintAndLogEx(INFO, " Sub-category.. %u", (unsigned)MemBeToUint2byte(value + 6));
}
static void ndef_wifi_decode_oob_password(const uint8_t *value, size_t len) {
if (len < 22) {
ndef_wifi_print_attribute_length("OOB Device Password", len, 22, 54, 1);
PrintAndLogEx(INFO, "OOB Password.... %s", sprint_hex(value, len));
return;
}
uint16_t password_id = MemBeToUint2byte(value + 20);
size_t password_len = len - 22;
if (password_id == 0x0007) {
if (password_len != 0) {
PrintAndLogEx(WARNING, "OOB Device Password ID 0x0007 requires a zero-length password");
}
} else if (password_len < 16 || password_len > 32) {
PrintAndLogEx(WARNING, "OOB Device Password has invalid password length %zu (expected 16-32 bytes)", password_len);
}
PrintAndLogEx(INFO, "OOB Password");
PrintAndLogEx(INFO, " Public key hash %s", sprint_hex(value, 20));
PrintAndLogEx(INFO, " Password ID... 0x%04X", (unsigned)password_id);
PrintAndLogEx(INFO, " Password....... %s", sprint_hex(value + 22, password_len));
}
static int ndef_wifi_decode_wfa_vendor_extension(const uint8_t *value, size_t len) {
if (!ndef_wifi_print_attribute_length("Vendor Extension", len, 3, 1024, 1) && len < 3) {
PrintAndLogEx(INFO, "Vendor Ext...... %s", sprint_hex(value, len));
return PM3_SUCCESS;
}
PrintAndLogEx(INFO, "Vendor ID....... %s", sprint_hex(value, 3));
if (memcmp(value, "\x00\x37\x2A", 3) != 0) {
PrintAndLogEx(INFO, "Vendor data..... %s", sprint_hex(value + 3, len - 3));
return PM3_SUCCESS;
}
if (len == 3) {
PrintAndLogEx(WARNING, "WFA Vendor Extension contains no subelements");
}
size_t pos = 3;
while (pos < len) {
if (len - pos < 2) {
PrintAndLogEx(WARNING, "Malformed WFA vendor subelement header at offset %zu", pos);
return PM3_ESOFT;
}
uint8_t type = value[pos++];
uint8_t sub_len = value[pos++];
if (sub_len > len - pos) {
PrintAndLogEx(WARNING, "WFA vendor subelement 0x%02X exceeds the Vendor Extension", (unsigned)type);
return PM3_ESOFT;
}
const uint8_t *sub_value = value + pos;
switch (type) {
case 0x00:
if (ndef_wifi_print_attribute_length("WFA Version2", sub_len, 1, 1, 1)) {
PrintAndLogEx(INFO, "WFA Version2.... %u.%u",
(unsigned)(sub_value[0] >> 4), (unsigned)(sub_value[0] & 0x0F));
} else {
PrintAndLogEx(INFO, "WFA Version2.... %s", sprint_hex(sub_value, sub_len));
}
break;
case 0x01:
if (ndef_wifi_print_attribute_length("AuthorizedMACs", sub_len, 0, 30, 6)) {
for (size_t i = 0; i < sub_len; i += 6) {
PrintAndLogEx(INFO, "Authorized MAC. %s", sprint_hex(sub_value + i, 6));
}
} else {
PrintAndLogEx(INFO, "AuthorizedMACs.. %s", sprint_hex(sub_value, sub_len));
}
break;
case 0x02:
if (ndef_wifi_print_attribute_length("Network Key Shareable", sub_len, 1, 1, 1)) {
PrintAndLogEx(INFO, "Key Shareable... %s", sub_value[0] ? "true" : "false");
} else {
PrintAndLogEx(INFO, "Key Shareable... %s", sprint_hex(sub_value, sub_len));
}
break;
case 0x03:
if (ndef_wifi_print_attribute_length("Request to Enroll", sub_len, 1, 1, 1)) {
PrintAndLogEx(INFO, "Request Enroll.. %s", sub_value[0] ? "true" : "false");
} else {
PrintAndLogEx(INFO, "Request Enroll.. %s", sprint_hex(sub_value, sub_len));
}
break;
case 0x04:
if (ndef_wifi_print_attribute_length("Settings Delay Time", sub_len, 1, 1, 1)) {
PrintAndLogEx(INFO, "Settings Delay.. %u", (unsigned)sub_value[0]);
} else {
PrintAndLogEx(INFO, "Settings Delay.. %s", sprint_hex(sub_value, sub_len));
}
break;
case 0x05:
if (ndef_wifi_print_attribute_length("Registrar Configuration Methods", sub_len, 2, 2, 1)) {
PrintAndLogEx(INFO, "Config Methods.. 0x%04X", (unsigned)MemBeToUint2byte(sub_value));
} else {
PrintAndLogEx(INFO, "Config Methods.. %s", sprint_hex(sub_value, sub_len));
}
break;
case 0x06:
case 0x07:
ndef_wifi_print_attribute_length("EasyMesh reserved subelement", sub_len, 1, 1, 1);
PrintAndLogEx(INFO, "EasyMesh 0x%02X.. %s", (unsigned)type, sprint_hex(sub_value, sub_len));
break;
case 0x08:
ndef_wifi_print_attribute_length("EasyMesh reserved subelement", sub_len, 2, 2, 1);
PrintAndLogEx(INFO, "EasyMesh 0x08.. %s", sprint_hex(sub_value, sub_len));
break;
default:
PrintAndLogEx(INFO, "WFA subelem 0x%02X %s", (unsigned)type, sprint_hex(sub_value, sub_len));
break;
}
pos += sub_len;
}
return PM3_SUCCESS;
}
static int ndefDecodeMime_wifi_wsc_attributes(const uint8_t *payload, size_t payload_len, uint8_t depth) {
size_t pos = 0;
while (pos < payload_len) {
if (payload_len - pos < 4) {
PrintAndLogEx(WARNING, "Malformed WSC attribute header at offset %zu", pos);
return PM3_ESOFT;
}
uint16_t type = MemBeToUint2byte(payload + pos);
uint16_t len = MemBeToUint2byte(payload + pos + 2);
pos += 4;
if (len > payload_len - pos) {
PrintAndLogEx(WARNING, "WSC attribute 0x%04X exceeds the payload", (unsigned)type);
return PM3_ESOFT;
}
const uint8_t *value = payload + pos;
// See Table 28, Wi-Fi Protected Setup Specification, Version 2.0.10
switch (type) {
case 0x1001:
if (ndef_wifi_print_attribute_length("AP Channel", len, 2, 2, 1)) {
PrintAndLogEx(INFO, "AP Channel...... %u", (unsigned)MemBeToUint2byte(value));
} else {
PrintAndLogEx(INFO, "AP Channel...... %s", sprint_hex(value, len));
}
break;
case 0x1003:
if (ndef_wifi_print_attribute_length("Authentication Type", len, 2, 2, 1)) {
PrintAndLogEx(INFO, "Auth type....... %s ( " _YELLOW_("%s") " )",
sprint_hex(value, len), ndef_wifi_auth_lookup(value));
} else {
PrintAndLogEx(INFO, "Auth type....... %s", sprint_hex(value, len));
}
break;
case 0x100E:
PrintAndLogEx(INFO, "Credential...... %u bytes", (unsigned)len);
if (depth != 0) {
PrintAndLogEx(WARNING, "A Credential must not contain another Credential");
return PM3_ESOFT;
}
if (ndefDecodeMime_wifi_wsc_attributes(value, len, depth + 1) != PM3_SUCCESS) {
return PM3_ESOFT;
}
break;
case 0x100F:
if (ndef_wifi_print_attribute_length("Encryption Type", len, 2, 2, 1)) {
PrintAndLogEx(INFO, "Crypt type...... %s ( " _YELLOW_("%s") " )",
sprint_hex(value, len), ndef_wifi_crypt_lookup(value));
} else {
PrintAndLogEx(INFO, "Crypt type...... %s", sprint_hex(value, len));
}
break;
case 0x1011:
ndef_wifi_print_attribute_length("Device Name", len, 0, 32, 1);
ndef_wifi_print_string("Device Name.....", value, len);
break;
case 0x1020:
ndef_wifi_print_attribute_length("MAC Address", len, 6, 6, 1);
PrintAndLogEx(INFO, "MAC Address..... %s", sprint_hex(value, len));
break;
case 0x1021:
ndef_wifi_print_attribute_length("Manufacturer", len, 0, 64, 1);
ndef_wifi_print_string("Manufacturer....", value, len);
break;
case 0x1023:
ndef_wifi_print_attribute_length("Model Name", len, 0, 32, 1);
ndef_wifi_print_string("Model Name......", value, len);
break;
case 0x1024:
ndef_wifi_print_attribute_length("Model Number", len, 0, 32, 1);
ndef_wifi_print_string("Model Number....", value, len);
break;
case 0x1026:
if (ndef_wifi_print_attribute_length("Network Index", len, 1, 1, 1)) {
PrintAndLogEx(INFO, "Network Index... %u", (unsigned)value[0]);
} else {
PrintAndLogEx(INFO, "Network Index... %s", sprint_hex(value, len));
}
break;
case 0x1027:
ndef_wifi_print_attribute_length("Network Key", len, 0, 64, 1);
ndef_wifi_print_string("Network key.....", value, len);
break;
case 0x102C:
ndef_wifi_decode_oob_password(value, len);
break;
case 0x103C:
if (ndef_wifi_print_attribute_length("RF Bands", len, 1, 1, 1)) {
PrintAndLogEx(INFO, "RF Bands........ 0x%02X", (unsigned)value[0]);
if (value[0] & 0x01) {
PrintAndLogEx(INFO, " " _YELLOW_("2.4 GHz"));
}
if (value[0] & 0x02) {
PrintAndLogEx(INFO, " " _YELLOW_("5 GHz"));
}
if (value[0] & 0x04) {
PrintAndLogEx(INFO, " " _YELLOW_("60 GHz"));
}
if (value[0] & 0xF8) {
PrintAndLogEx(WARNING, "RF Bands contains unknown bits 0x%02X", (unsigned)(value[0] & 0xF8));
}
} else {
PrintAndLogEx(INFO, "RF Bands........ %s", sprint_hex(value, len));
}
break;
case 0x1042:
ndef_wifi_print_attribute_length("Serial Number", len, 0, 32, 1);
ndef_wifi_print_string("Serial Number...", value, len);
break;
case 0x1045:
ndef_wifi_print_attribute_length("SSID", len, 0, 32, 1);
ndef_wifi_print_string("SSID............", value, len);
break;
case 0x1047:
ndef_wifi_print_attribute_length("UUID-E", len, 16, 16, 1);
PrintAndLogEx(INFO, "UUID-E.......... %s", sprint_hex(value, len));
break;
case 0x1048:
ndef_wifi_print_attribute_length("UUID-R", len, 16, 16, 1);
PrintAndLogEx(INFO, "UUID-R.......... %s", sprint_hex(value, len));
break;
case 0x1049:
if (ndef_wifi_decode_wfa_vendor_extension(value, len) != PM3_SUCCESS) {
return PM3_ESOFT;
}
break;
case 0x104A:
if (ndef_wifi_print_attribute_length("Version", len, 1, 1, 1)) {
PrintAndLogEx(INFO, "Version......... %u.%u",
(unsigned)(value[0] >> 4), (unsigned)(value[0] & 0x0F));
} else {
PrintAndLogEx(INFO, "Version......... %s", sprint_hex(value, len));
}
break;
case 0x1054:
if (ndef_wifi_print_attribute_length("Primary Device Type", len, 8, 8, 1)) {
PrintAndLogEx(INFO, "Primary Dev Type %s", sprint_hex(value, len));
ndef_wifi_print_device_type(value);
} else {
PrintAndLogEx(INFO, "Primary Dev Type %s", sprint_hex(value, len));
}
break;
case 0x1055:
if (ndef_wifi_print_attribute_length("Secondary Device Type List", len, 8, 128, 8)) {
PrintAndLogEx(INFO, "Secondary Types. %u", (unsigned)(len / 8));
for (size_t i = 0; i < len; i += 8) {
ndef_wifi_print_device_type(value + i);
}
} else {
PrintAndLogEx(INFO, "Secondary Types. %s", sprint_hex(value, len));
}
break;
case 0x1061:
if (ndef_wifi_print_attribute_length("Key Provided Automatically", len, 1, 1, 1)) {
PrintAndLogEx(INFO, "Key Automatic... %s", value[0] ? "true" : "false");
} else {
PrintAndLogEx(INFO, "Key Automatic... %s", sprint_hex(value, len));
}
break;
default:
PrintAndLogEx(INFO, "WSC attr 0x%04X. %s", (unsigned)type, sprint_hex(value, len));
break;
}
pos += len;
}
return PM3_SUCCESS;
}
static int ndefDecodeMime_wifi_wsc(NDEFHeader_t *ndef) {
if (ndef->PayloadLen == 0) {
@@ -647,177 +972,7 @@ static int ndefDecodeMime_wifi_wsc(NDEFHeader_t *ndef) {
PrintAndLogEx(INFO, _CYAN_("NDEF Wifi Simple Config Record"));
PrintAndLogEx(INFO, "Type............ " _YELLOW_("%.*s"), (int)ndef->TypeLen, ndef->Type);
size_t n = ndef->PayloadLen;
size_t pos = 0;
while (n) {
if (ndef->Payload[pos] != 0x10) {
n -= 1;
pos += 1;
continue;
}
// VERSION
if (memcmp(&ndef->Payload[pos], "\x10\x4A", 2) == 0) {
uint8_t len = 1;
PrintAndLogEx(INFO, "Version......... %s", sprint_hex(&ndef->Payload[pos + 2], len));
n -= 2;
n -= len;
pos += 2;
pos += len;
}
// CREDENTIAL
if (memcmp(&ndef->Payload[pos], "\x10\x0E", 2) == 0) {
// 10 0E 00 39
uint8_t len = 2;
PrintAndLogEx(INFO, "Credential...... %s", sprint_hex(&ndef->Payload[pos + 2], len));
n -= 2;
n -= len;
pos += 2;
pos += len;
}
// AUTH_TYPE
if (memcmp(&ndef->Payload[pos], "\x10\x03", 2) == 0) {
// 10 03 00 02 00 20
uint8_t len = 4;
PrintAndLogEx(INFO, "Auth type....... %s ( " _YELLOW_("%s")" )",
sprint_hex(&ndef->Payload[pos + 2], len),
ndef_wifi_auth_lookup(&ndef->Payload[pos + 2])
);
n -= 2;
n -= len;
pos += 2;
pos += len;
}
// CRYPT_TYPE
if (memcmp(&ndef->Payload[pos], "\x10\x0F", 2) == 0) {
// 10 0F 00 02 00 04
uint8_t len = 4;
PrintAndLogEx(INFO, "Crypt type...... %s ( " _YELLOW_("%s")" )",
sprint_hex(&ndef->Payload[pos + 2], len),
ndef_wifi_crypt_lookup(&ndef->Payload[pos + 2])
);
n -= 2;
n -= len;
pos += 2;
pos += len;
}
// MAC_ADDRESS
if (memcmp(&ndef->Payload[pos], "\x10\x20", 2) == 0) {
// 10 20 00 06 FF FF FF FF FF FF
uint8_t len = ndef->Payload[pos + 3];
PrintAndLogEx(INFO, "MAC Address..... %s", sprint_hex_ascii(&ndef->Payload[pos + 4], len));
n -= 4;
n -= len;
pos += 4;
pos += len;
}
// NETWORK_IDX - always set to 1, deprecated
if (memcmp(&ndef->Payload[pos], "\x10\x26", 2) == 0) {
// 10 26 00 01 01
uint8_t len = 3;
PrintAndLogEx(INFO, "Network Index... %s", sprint_hex(&ndef->Payload[pos + 2], len));
n -= 2;
n -= len;
pos += 2;
pos += len;
}
// NETWORK_KEY
if (memcmp(&ndef->Payload[pos], "\x10\x27", 2) == 0) {
// 10 27 00 10 74 72 69 73 74 61 6E 2D 73 70 72 69 6E 67 65 72
uint8_t len = ndef->Payload[pos + 3];
PrintAndLogEx(INFO, "Network key..... %s", sprint_hex_ascii(&ndef->Payload[pos + 4], len));
n -= 4;
n -= len;
pos += 4;
pos += len;
}
// NETWORK_NAME
if (memcmp(&ndef->Payload[pos], "\x10\x45", 2) == 0) {
// 10 45 00 06 69 63 65 73 71 6C
uint8_t len = ndef->Payload[pos + 3];
PrintAndLogEx(INFO, "Network Name.... %s", sprint_hex_ascii(&ndef->Payload[pos + 4], len));
n -= 4;
n -= len;
pos += 4;
pos += len;
}
// OOB_PASSWORD
// unknown the length.
if (memcmp(&ndef->Payload[pos], "\x10\x2C", 2) == 0) {
uint8_t len = 1;
PrintAndLogEx(INFO, "OOB Password......... %s", sprint_hex(&ndef->Payload[pos + 2], len));
n -= 2;
n -= len;
pos += 2;
pos += len;
}
// VENDOR_EXT
// unknown the length.
if (memcmp(&ndef->Payload[pos], "\x10\x49", 2) == 0) {
uint8_t len = 1;
PrintAndLogEx(INFO, "Vendor Ext......... %s", sprint_hex(&ndef->Payload[pos + 2], len));
n -= 2;
n -= len;
pos += 2;
pos += len;
}
// VENDOR_WFA
// unknown the length.
if (memcmp(&ndef->Payload[pos], "\x10\x30\x2A", 3) == 0) {
uint8_t len = 1;
PrintAndLogEx(INFO, "Vendor WFA......... %s", sprint_hex(&ndef->Payload[pos + 2], len));
n -= 2;
n -= len;
pos += 2;
pos += len;
}
// rf-bands
if (memcmp(&ndef->Payload[pos], "\x10\x3C", 2) == 0) {
uint8_t len = 3;
if (ndef->Payload[pos + 2 + 2] == 0x01) {
PrintAndLogEx(INFO, "RF Bands........ %s ( " _YELLOW_("2.4 GHZ")" )", sprint_hex(&ndef->Payload[pos + 2], len));
} else if (ndef->Payload[pos + 2 + 2] == 0x02) {
PrintAndLogEx(INFO, "RF Bands........ %s ( " _YELLOW_("5.0 GHZ")" )", sprint_hex(&ndef->Payload[pos + 2], len));
}
n -= 2;
n -= len;
pos += 2;
pos += len;
}
}
/*
ap-channel 0, 6
+ credential
device-name
manufacturer
model-name
model-number
+ oob-password
primary-device-type
secondary-device-type-list
serial-number
ssid
uuid-enrollee
uuid-registrar
+ vendor-extension
version-1
*/
return PM3_SUCCESS;
return ndefDecodeMime_wifi_wsc_attributes(ndef->Payload, ndef->PayloadLen, 0);
}
static int ndefDecodeMime_wifi_p2p(NDEFHeader_t *ndef) {
if (ndef->PayloadLen == 0) {
+1
View File
@@ -481,6 +481,7 @@ while true; do
if ! CheckExecute "smart raw help t1" "$CLIENTBIN -c 'smart raw -h'" "use protocol T=1"; then break; fi
if ! CheckExecute "nfc decode test oob" "$CLIENTBIN -c 'nfc decode -d DA2010016170706C69636174696F6E2F766E642E626C7565746F6F74682E65702E6F6F62301000649201B96DFB0709466C65782032'" "Flex 2"; then break; fi
if ! CheckExecute "nfc decode test device info" "$CLIENTBIN -c 'nfc decode -d d1025744690004536f6e79010752432d533338300220426c61636b204e46432052656164657220636f6e6e656374656420746f2050430310123e4567e89b12d3a45642665544000004124e464320506f72742d3130302076312e3032'" "NFC Port-100 v1.02"; then break; fi
if ! CheckExecute "nfc decode test wifi wsc" "$CLIENTBIN -c 'nfc decode -d d2174d6170706c69636174696f6e2f766e642e7766612e777363100e002f10260001011045000474657374100300020020100f000200081027000870617373776f726410200006ffffffffffff103c0001031001000200061049000600372a000120104a000110'" "WFA Version2\.\.\.\. 2\.0"; then break; fi
if ! CheckExecute "nfc decode test vcard" "$CLIENTBIN -c 'nfc decode -d d20ca3746578742f782d7643617264424547494e3a56434152440a56455253494f4e3a332e300a4e3a43687269733b4963656d616e3b3b3b0a464e3a476f7468656e627572670a5245563a323032312d30362d32345432303a31353a30385a0a6974656d322e582d4142444154453b747970653d707265663a323032302d30362d32340a4954454d322e582d41424c4142454c3a5f24213c416e6e69766572736172793e21245f0a454e443a56434152440a'" "END:VCARD"; then break; fi
if ! CheckExecute "nfc decode test apple wallet" "$CLIENTBIN -c 'nfc decode -d 031AD10116550077616C6C65743A2F2F61637469766174652F6E6663FE'" "activate/nfc"; then break; fi
if ! CheckExecute "nfc decode test signature" "$CLIENTBIN -c 'nfc decode -d 03FF010194113870696C65742E65653A656B616172743A3266195F26063132303832325904202020205F28033233335F2701316E1B5A13333038363439303039303030323636343030355304EBF2CE704103000000AC536967010200803A2448FCA7D354A654A81BD021150D1A152D1DF4D7A55D2B771F12F094EAB6E5E10F2617A2F8DAD4FD38AFF8EA39B71C19BD42618CDA86EE7E144636C8E0E7CFC4096E19C3680E09C78A0CDBC05DA2D698E551D5D709717655E56FE3676880B897D2C70DF5F06ECE07C71435255144F8EE41AF110E7B180DA0E6C22FB8FDEF61800025687474703A2F2F70696C65742E65652F6372742F33303836343930302D303030312E637274FE'" "30864900-0001.crt"; then break; fi