Merge branch 'master' into master
Signed-off-by: Iceman <iceman@iuse.se>
This commit is contained in:
15 files changed
+1576
-56
No files matched your search
@@ -56,6 +56,13 @@ if (NOT SKIPPYTHON EQUAL 1)
|
||||
pkg_search_module(PYTHON3EMBED QUIET ${PYTHON3_PKGCONFIG}-embed)
|
||||
endif (NOT SKIPPYTHON EQUAL 1)
|
||||
|
||||
if (MINGW)
|
||||
# Prefer static archives for single-exe deployments.
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
set(ZLIB_USE_STATIC_LIBS ON)
|
||||
set(BZIP2_USE_STATIC_LIBS ON)
|
||||
endif()
|
||||
|
||||
# If cross-compiled, we need to init source and build.
|
||||
if (CMAKE_TOOLCHAIN_FILE)
|
||||
if (ANDROID)
|
||||
@@ -692,7 +699,26 @@ add_library(pm3rrg_rdv4 SHARED
|
||||
${ADDITIONAL_SRC}
|
||||
)
|
||||
|
||||
target_compile_definitions(pm3rrg_rdv4 PRIVATE LIBPM3)
|
||||
add_library(pm3rrg_rdv4_static STATIC
|
||||
${PM3_ROOT}/client/src/proxmark3.c
|
||||
${PM3_ROOT}/client/src/guidummy.cpp
|
||||
${TARGET_SOURCES}
|
||||
${ADDITIONAL_SRC}
|
||||
)
|
||||
|
||||
set(PM3_LIBRARY_TARGETS pm3rrg_rdv4 pm3rrg_rdv4_static)
|
||||
foreach (target IN LISTS PM3_LIBRARY_TARGETS)
|
||||
target_compile_definitions(${target} PRIVATE LIBPM3)
|
||||
target_compile_options(${target} PUBLIC -Wall -Werror -O3)
|
||||
target_include_directories(${target} PRIVATE
|
||||
${PM3_ROOT}/common
|
||||
${PM3_ROOT}/common_fpga
|
||||
${PM3_ROOT}/include
|
||||
${PM3_ROOT}/client/src
|
||||
${PM3_ROOT}/client/include
|
||||
${ADDITIONAL_DIRS}
|
||||
)
|
||||
endforeach()
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
# Fail the build if a client source file is missing from TARGET_SOURCES.
|
||||
@@ -700,17 +726,22 @@ if (UNIX AND NOT APPLE)
|
||||
set_property(TARGET pm3rrg_rdv4 APPEND_STRING PROPERTY LINK_FLAGS " -Wl,--no-undefined")
|
||||
endif()
|
||||
|
||||
target_compile_options(pm3rrg_rdv4 PUBLIC -Wall -Werror -O3)
|
||||
if (EMBED_READLINE)
|
||||
if (NOT SKIPREADLINE EQUAL 1)
|
||||
add_dependencies(pm3rrg_rdv4 ncurses readline)
|
||||
foreach (target IN LISTS PM3_LIBRARY_TARGETS)
|
||||
add_dependencies(${target} ncurses readline)
|
||||
endforeach()
|
||||
endif (NOT SKIPREADLINE EQUAL 1)
|
||||
endif (EMBED_READLINE)
|
||||
if (EMBED_BZIP2)
|
||||
add_dependencies(pm3rrg_rdv4 bzip2)
|
||||
foreach (target IN LISTS PM3_LIBRARY_TARGETS)
|
||||
add_dependencies(${target} bzip2)
|
||||
endforeach()
|
||||
endif (EMBED_BZIP2)
|
||||
if (EMBED_LZ4)
|
||||
add_dependencies(pm3rrg_rdv4 lz4)
|
||||
foreach (target IN LISTS PM3_LIBRARY_TARGETS)
|
||||
add_dependencies(${target} lz4)
|
||||
endforeach()
|
||||
endif (EMBED_LZ4)
|
||||
|
||||
if (MINGW)
|
||||
@@ -718,7 +749,9 @@ if (MINGW)
|
||||
# and setting _ISOC99_SOURCE sets internally __USE_MINGW_ANSI_STDIO=1
|
||||
# FTR __USE_MINGW_ANSI_STDIO seems deprecated in Mingw32
|
||||
# but not Mingw64 https://fr.osdn.net/projects/mingw/lists/archive/users/2019-January/000199.html
|
||||
target_compile_definitions(pm3rrg_rdv4 PRIVATE _ISOC99_SOURCE)
|
||||
foreach (target IN LISTS PM3_LIBRARY_TARGETS)
|
||||
target_compile_definitions(${target} PRIVATE _ISOC99_SOURCE)
|
||||
endforeach()
|
||||
|
||||
set(CMAKE_C_FLAGS "-mno-ms-bitfields -fexec-charset=cp850 ${CMAKE_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "-mno-ms-bitfields -fexec-charset=cp850 ${CMAKE_CXX_FLAGS}")
|
||||
@@ -727,15 +760,6 @@ if (MINGW)
|
||||
set(ADDITIONAL_LNK ws2_32 ${ADDITIONAL_LNK})
|
||||
endif (MINGW)
|
||||
|
||||
target_include_directories(pm3rrg_rdv4 PRIVATE
|
||||
${PM3_ROOT}/common
|
||||
${PM3_ROOT}/common_fpga
|
||||
${PM3_ROOT}/include
|
||||
${PM3_ROOT}/client/src
|
||||
${PM3_ROOT}/client/include
|
||||
${ADDITIONAL_DIRS}
|
||||
)
|
||||
|
||||
if (NOT APPLE)
|
||||
# required for Raspberry Pi, but breaks with clang (OSX). Need to be at the end of the linker line.
|
||||
set(ADDITIONAL_LNK ${ADDITIONAL_LNK} -Wl,--as-needed -latomic -Wl,--no-as-needed)
|
||||
@@ -759,22 +783,26 @@ if (NOT WHEREAMI_FOUND)
|
||||
set(ADDITIONAL_LNK pm3rrg_rdv4_whereami ${ADDITIONAL_LNK})
|
||||
endif (NOT WHEREAMI_FOUND)
|
||||
|
||||
target_link_libraries(pm3rrg_rdv4 PRIVATE
|
||||
m
|
||||
pm3rrg_rdv4_mbedtls
|
||||
pm3rrg_rdv4_cliparser
|
||||
pm3rrg_rdv4_lua
|
||||
pm3rrg_rdv4_tinycbor
|
||||
pm3rrg_rdv4_amiibo
|
||||
pm3rrg_rdv4_reveng
|
||||
pm3rrg_rdv4_hardnested
|
||||
pm3rrg_rdv4_id48
|
||||
pm3rrg_rdv4_mqtt
|
||||
pm3rrg_rdv4_vec
|
||||
${ADDITIONAL_LNK})
|
||||
foreach (target IN LISTS PM3_LIBRARY_TARGETS)
|
||||
target_link_libraries(${target} PRIVATE
|
||||
m
|
||||
pm3rrg_rdv4_mbedtls
|
||||
pm3rrg_rdv4_cliparser
|
||||
pm3rrg_rdv4_lua
|
||||
pm3rrg_rdv4_tinycbor
|
||||
pm3rrg_rdv4_amiibo
|
||||
pm3rrg_rdv4_reveng
|
||||
pm3rrg_rdv4_hardnested
|
||||
pm3rrg_rdv4_id48
|
||||
pm3rrg_rdv4_mqtt
|
||||
pm3rrg_rdv4_vec
|
||||
${ADDITIONAL_LNK})
|
||||
endforeach()
|
||||
|
||||
if (NOT SKIPPTHREAD EQUAL 1)
|
||||
target_link_libraries(pm3rrg_rdv4 PRIVATE pthread)
|
||||
foreach (target IN LISTS PM3_LIBRARY_TARGETS)
|
||||
target_link_libraries(${target} PRIVATE pthread)
|
||||
endforeach()
|
||||
endif (NOT SKIPPTHREAD EQUAL 1)
|
||||
|
||||
if (NOT SKIPPYTHON EQUAL 1)
|
||||
@@ -786,4 +814,6 @@ if (NOT SKIPPYTHON EQUAL 1)
|
||||
endif (PYTHON3EMBED_FOUND OR PYTHON3_FOUND)
|
||||
endif (NOT SKIPPYTHON EQUAL 1)
|
||||
|
||||
target_link_directories(pm3rrg_rdv4 PRIVATE ${ADDITIONAL_LNKDIRS})
|
||||
foreach (target IN LISTS PM3_LIBRARY_TARGETS)
|
||||
target_link_directories(${target} PRIVATE ${ADDITIONAL_LNKDIRS})
|
||||
endforeach()
|
||||
+54
-7
@@ -58,13 +58,13 @@ static bool legic_xor(uint8_t *data, uint16_t cardsize) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static void legic_xor_with_crc(uint8_t *data, uint16_t cardsize, uint8_t crc) {
|
||||
void legic_xor_with_crc(uint8_t *data, uint16_t cardsize, uint8_t crc) {
|
||||
for (uint16_t i = 22; i < cardsize; i++) {
|
||||
data[i] ^= crc;
|
||||
}
|
||||
}
|
||||
|
||||
static bool legic_clone_update_segment_crcs(uint8_t *data, size_t bytes_read, const uint8_t uid[4]) {
|
||||
bool legic_clone_update_segment_crcs(uint8_t *data, size_t bytes_read, const uint8_t uid[4]) {
|
||||
// Segment headers are parsed from offset 22 everywhere else in LEGIC decoding.
|
||||
size_t start = 22;
|
||||
bool found_segment = false;
|
||||
@@ -96,7 +96,7 @@ static bool legic_clone_update_segment_crcs(uint8_t *data, size_t bytes_read, co
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool legic_clone_update_kgh_crcs(uint8_t *data, size_t bytes_read, const uint8_t uid[4]) {
|
||||
bool legic_clone_update_kgh_crcs(uint8_t *data, size_t bytes_read, const uint8_t uid[4]) {
|
||||
// Decoded segmented payload starts at byte 22.
|
||||
size_t start = 22;
|
||||
bool found_kgh = false;
|
||||
@@ -142,7 +142,7 @@ static bool legic_clone_update_kgh_crcs(uint8_t *data, size_t bytes_read, const
|
||||
return true;
|
||||
}
|
||||
|
||||
static int legic_write_bytes_to_tag(uint16_t offset, uint8_t iv, const uint8_t *data, size_t bytes_read, const char *verb) {
|
||||
int legic_write_bytes_to_tag(uint16_t offset, uint8_t iv, const uint8_t *data, size_t bytes_read, const char *verb) {
|
||||
PrintAndLogEx(SUCCESS, "%s", verb);
|
||||
|
||||
// fast push mode
|
||||
@@ -183,21 +183,68 @@ static int legic_write_bytes_to_tag(uint16_t offset, uint8_t iv, const uint8_t *
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
|
||||
if (resp.status != PM3_SUCCESS) {
|
||||
PrintAndLogEx(WARNING, "Failed writing tag");
|
||||
PrintAndLogEx(WARNING, "Failed writing tag at offset %zu len %zu. Status: %d", i, len, resp.status);
|
||||
g_conn.block_after_ACK = false;
|
||||
return PM3_ERFTRANS;
|
||||
}
|
||||
PrintAndLogEx(SUCCESS, "Wrote chunk [offset %zu | len %zu | total %zu", i, len, i + len);
|
||||
PrintAndLogEx(SUCCESS, "Wrote chunk [offset %zu | len %zu | end %zu of %zu]", i, len, i + len, bytes_read);
|
||||
}
|
||||
|
||||
g_conn.block_after_ACK = false;
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int legic_write_dump_to_tag(uint8_t *dump, size_t bytes_read) {
|
||||
int legic_write_dump_to_tag(uint8_t *dump, size_t bytes_read) {
|
||||
return legic_write_bytes_to_tag(7, 0x55, dump, bytes_read, "Restoring to card");
|
||||
}
|
||||
|
||||
int legic_migrate_dump(uint8_t *dump, size_t bytes_read, bool rewrite_kgh, const uint8_t dcf[2], bool allow_dcf) {
|
||||
if (dump == NULL || bytes_read <= 22) {
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
if (dcf != NULL && !allow_dcf) {
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
legic_card_select_t card;
|
||||
if (legic_get_type(&card) != PM3_SUCCESS) {
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
if (card.cardsize < bytes_read) {
|
||||
return PM3_EFILE;
|
||||
}
|
||||
|
||||
uint8_t target_uid[4] = {0};
|
||||
memcpy(target_uid, card.uid, sizeof(target_uid));
|
||||
uint8_t target_mcc = (uint8_t)CRC8Legic(target_uid, sizeof(target_uid));
|
||||
|
||||
if (!legic_clone_update_segment_crcs(dump, bytes_read, target_uid)) {
|
||||
return PM3_EFAILED;
|
||||
}
|
||||
if (rewrite_kgh && !legic_clone_update_kgh_crcs(dump, bytes_read, target_uid)) {
|
||||
return PM3_EFAILED;
|
||||
}
|
||||
|
||||
memcpy(dump, target_uid, sizeof(target_uid));
|
||||
dump[4] = target_mcc;
|
||||
legic_xor_with_crc(dump, bytes_read, dump[4]);
|
||||
|
||||
int write_res = legic_write_dump_to_tag(dump, bytes_read);
|
||||
if (write_res != PM3_SUCCESS) {
|
||||
return write_res;
|
||||
}
|
||||
|
||||
if (dcf != NULL) {
|
||||
uint8_t dcf_dump[7] = {0};
|
||||
memcpy(dcf_dump + 5, dcf, 2);
|
||||
return legic_write_bytes_to_tag(5, 0x55, dcf_dump, sizeof(dcf_dump), "Applying explicit DCF update");
|
||||
}
|
||||
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int CmdLegicMigrate(const char *Cmd) {
|
||||
CLIParserContext *ctx;
|
||||
CLIParserInit(&ctx, "hf legic migrate",
|
||||
|
||||
@@ -31,5 +31,11 @@ int legic_get_type(legic_card_select_t *card);
|
||||
void legic_chk_iv(uint32_t *iv);
|
||||
void legic_seteml(uint8_t *src, uint32_t offset, uint32_t numofbytes);
|
||||
int legic_read_mem(uint32_t offset, uint32_t len, uint32_t iv, uint8_t *out, uint16_t *outlen);
|
||||
int legic_migrate_dump(uint8_t *dump, size_t bytes_read, bool rewrite_kgh, const uint8_t dcf[2], bool allow_dcf);
|
||||
void legic_xor_with_crc(uint8_t *data, uint16_t cardsize, uint8_t crc);
|
||||
bool legic_clone_update_segment_crcs(uint8_t *data, size_t bytes_read, const uint8_t uid[4]);
|
||||
bool legic_clone_update_kgh_crcs(uint8_t *data, size_t bytes_read, const uint8_t uid[4]);
|
||||
int legic_write_bytes_to_tag(uint16_t offset, uint8_t iv, const uint8_t *data, size_t bytes_read, const char *verb);
|
||||
int legic_write_dump_to_tag(uint8_t *dump, size_t bytes_read);
|
||||
|
||||
#endif
|
||||
+369
-2
@@ -68,8 +68,9 @@
|
||||
#define MIFAREU3P_KEY_SIZE 16
|
||||
#define MIFAREULC_KEY_INDEX 3
|
||||
|
||||
// NDEF data area starts at block 4 and READ takes a one byte block number,
|
||||
// so block 255 is the last one reachable.
|
||||
// The Capability Container sits in block 3, the NDEF data area starts at block 4
|
||||
// and READ takes a one byte block number, so block 255 is the last one reachable.
|
||||
#define MFU_NDEF_CC_BLOCK 3
|
||||
#define MFU_NDEF_FIRST_BLOCK 4
|
||||
#define MFU_NDEF_MAX_BYTES ((0xFF - MFU_NDEF_FIRST_BLOCK + 1) * MFU_BLOCK_SIZE)
|
||||
|
||||
@@ -7851,6 +7852,371 @@ int CmdHF14MfuNDEFWrite(const char *Cmd) {
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
// NDEF formatting - restores the NXP factory delivery content (Capability
|
||||
// Container + empty NDEF message) for the detected tag type. Block 3 is OTP.
|
||||
// Per-type sources and rationale: doc/mfu_ndef_format_notes.md
|
||||
typedef struct {
|
||||
uint64_t tagtype;
|
||||
const char *name;
|
||||
uint8_t page[3][MFU_BLOCK_SIZE]; // pages 03h, 04h, 05h
|
||||
} mfu_ndef_format_t;
|
||||
|
||||
static const mfu_ndef_format_t mfu_ndef_format_table[] = {
|
||||
{ MFU_TT_UL, "MIFARE Ultralight", {{0xE1, 0x10, 0x06, 0x00}, {0x03, 0x00, 0xFE, 0x00}, {0x00, 0x00, 0x00, 0x00}} },
|
||||
{ MFU_TT_UL_C, "MIFARE Ultralight C", {{0xE1, 0x10, 0x12, 0x00}, {0x03, 0x00, 0xFE, 0x00}, {0x00, 0x00, 0x00, 0x00}} },
|
||||
{ MFU_TT_UL_EV1_48, "MIFARE Ultralight EV1 48", {{0xE1, 0x10, 0x06, 0x00}, {0x03, 0x00, 0xFE, 0x00}, {0x00, 0x00, 0x00, 0x00}} },
|
||||
{ MFU_TT_UL_EV1_128, "MIFARE Ultralight EV1 128", {{0xE1, 0x10, 0x10, 0x00}, {0x03, 0x00, 0xFE, 0x00}, {0x00, 0x00, 0x00, 0x00}} },
|
||||
{ MFU_TT_NTAG_203, "NTAG203", {{0xE1, 0x10, 0x12, 0x00}, {0x03, 0x00, 0xFE, 0x00}, {0x00, 0x00, 0x00, 0x00}} },
|
||||
{ MFU_TT_NTAG_210, "NTAG210", {{0xE1, 0x10, 0x06, 0x00}, {0x03, 0x00, 0xFE, 0x00}, {0x00, 0x00, 0x00, 0x00}} },
|
||||
{ MFU_TT_NTAG_210u, "NTAG210u", {{0xE1, 0x10, 0x06, 0x00}, {0x03, 0x00, 0xFE, 0x00}, {0x00, 0x00, 0x00, 0x00}} },
|
||||
{ MFU_TT_NTAG_212, "NTAG212", {{0xE1, 0x10, 0x10, 0x00}, {0x01, 0x03, 0x90, 0x0A}, {0x34, 0x03, 0x00, 0xFE}} },
|
||||
{ MFU_TT_NTAG_213, "NTAG213", {{0xE1, 0x10, 0x12, 0x00}, {0x01, 0x03, 0xA0, 0x0C}, {0x34, 0x03, 0x00, 0xFE}} },
|
||||
{ MFU_TT_NTAG_213_F, "NTAG213F", {{0xE1, 0x10, 0x12, 0x00}, {0x01, 0x03, 0xA0, 0x0C}, {0x34, 0x03, 0x00, 0xFE}} },
|
||||
{ MFU_TT_NTAG_213_TT, "NTAG213TT", {{0xE1, 0x10, 0x12, 0x00}, {0x01, 0x03, 0xA0, 0x0C}, {0x34, 0x03, 0x00, 0xFE}} },
|
||||
{ MFU_TT_NTAG_213_C, "NTAG213C", {{0xE1, 0x10, 0x12, 0x00}, {0x01, 0x03, 0xA0, 0x0C}, {0x34, 0x03, 0x00, 0xFE}} },
|
||||
{ MFU_TT_NTAG_215, "NTAG215", {{0xE1, 0x10, 0x3E, 0x00}, {0x03, 0x00, 0xFE, 0x00}, {0x00, 0x00, 0x00, 0x00}} },
|
||||
{ MFU_TT_NTAG_216, "NTAG216", {{0xE1, 0x10, 0x6D, 0x00}, {0x03, 0x00, 0xFE, 0x00}, {0x00, 0x00, 0x00, 0x00}} },
|
||||
{ MFU_TT_NTAG_216_F, "NTAG216F", {{0xE1, 0x10, 0x6D, 0x00}, {0x03, 0x00, 0xFE, 0x00}, {0x00, 0x00, 0x00, 0x00}} },
|
||||
};
|
||||
|
||||
static const mfu_ndef_format_t *mfu_get_ndef_format(uint64_t tagtype) {
|
||||
for (size_t i = 0; i < ARRAYLEN(mfu_ndef_format_table); i++) {
|
||||
uint64_t tt = mfu_ndef_format_table[i].tagtype;
|
||||
if ((tagtype & tt) == tt) {
|
||||
return &mfu_ndef_format_table[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int CmdHF14MfuNDEFFormat(const char *Cmd) {
|
||||
|
||||
CLIParserContext *ctx;
|
||||
CLIParserInit(&ctx, "hf mfu ndefformat",
|
||||
"Format a MIFARE Ultralight / NTAG tag for NDEF by writing the Capability\n"
|
||||
"Container to block 3, followed by an empty NDEF message.\n"
|
||||
"\n"
|
||||
"Writes NXP factory delivery content for the detected tag type. Block 3 is\n"
|
||||
"One Time Programmable; unknown types and unreachable CCs are refused.\n"
|
||||
"\n"
|
||||
"Note: the tag is re-selected and re-authenticated for each block written.",
|
||||
"hf mfu ndefformat\n"
|
||||
"hf mfu ndefformat -v\n"
|
||||
"hf mfu ndefformat --erase\n"
|
||||
"hf mfu ndefformat -k FFFFFFFF\n"
|
||||
"hf mfu ndefformat -k 49454D4B41455242214E4143554F5946\n"
|
||||
"hf mfu ndefformat -d E1101200 --force"
|
||||
);
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_str0("k", "key", "<hex>", "Authentication key (UL-C/UL-AES 16 bytes, EV1/NTAG 4 bytes)"),
|
||||
arg_lit0("l", NULL, "Swap entered key endianness"),
|
||||
arg_str0("d", "data", "<hex>", "Capability Container to write, 4 bytes. Overrides the detected type"),
|
||||
arg_lit0(NULL, "erase", "Also zero the rest of the NDEF data area"),
|
||||
arg_lit0(NULL, "force", "Continue on an unknown tag type, or with an oversized -d value"),
|
||||
arg_lit0("v", "verbose", "Verbose output"),
|
||||
arg_lit0(NULL, "schann", "use secure channel. Must have key"),
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
int ak_len = 0;
|
||||
uint8_t authenticationkey[16] = {0x00};
|
||||
CLIGetHexWithReturn(ctx, 1, authenticationkey, &ak_len);
|
||||
bool swap_endian = arg_get_lit(ctx, 2);
|
||||
|
||||
int cc_len = 0;
|
||||
uint8_t cc_override[MFU_BLOCK_SIZE] = {0x00};
|
||||
CLIGetHexWithReturn(ctx, 3, cc_override, &cc_len);
|
||||
|
||||
bool erase = arg_get_lit(ctx, 4);
|
||||
bool force = arg_get_lit(ctx, 5);
|
||||
bool verbose = arg_get_lit(ctx, 6);
|
||||
bool use_schann = arg_get_lit(ctx, 7);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
if ((cc_len != 0) && (cc_len != MFU_BLOCK_SIZE)) {
|
||||
PrintAndLogEx(WARNING, "Capability Container must be %d bytes, got %d", MFU_BLOCK_SIZE, cc_len);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
bool has_auth_key = false;
|
||||
bool has_pwd = false;
|
||||
switch (ak_len) {
|
||||
case 0:
|
||||
break;
|
||||
case 4:
|
||||
has_pwd = true;
|
||||
break;
|
||||
case 16:
|
||||
has_auth_key = true;
|
||||
break;
|
||||
default:
|
||||
PrintAndLogEx(WARNING, "ERROR: Key is incorrect length\n");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
if (use_schann && (has_auth_key == false)) {
|
||||
PrintAndLogEx(WARNING, "Secure channel must be called with key");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
uint64_t tagtype = GetHF14AMfU_Type();
|
||||
if (tagtype == MFU_TT_UL_ERROR) {
|
||||
PrintAndLogEx(WARNING, "No Ultralight / NTAG based tag found");
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
ul_print_type(tagtype, 0);
|
||||
|
||||
const mfu_ndef_format_t *fmt = mfu_get_ndef_format(tagtype);
|
||||
if (fmt == NULL) {
|
||||
if (cc_len == 0) {
|
||||
PrintAndLogEx(FAILED, "Don't know the Capability Container for this tag type");
|
||||
PrintAndLogEx(INFO, "Block 3 is One Time Programmable, a wrong value can not be undone,");
|
||||
PrintAndLogEx(INFO, "so this command will not guess one.");
|
||||
PrintAndLogEx(HINT, "Hint: supply it yourself with `" _YELLOW_("hf mfu ndefformat -d <hex> --force") "`");
|
||||
return PM3_ENOTIMPL;
|
||||
}
|
||||
if (force == false) {
|
||||
PrintAndLogEx(FAILED, "Unknown tag type, add `" _YELLOW_("--force") "` to write anyway");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
if (erase) {
|
||||
PrintAndLogEx(FAILED, "Refusing to erase on an unknown tag type");
|
||||
PrintAndLogEx(INFO, "The end of the data area can not be established, so the erase");
|
||||
PrintAndLogEx(INFO, "could run into the lock bytes, configuration or key pages.");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
}
|
||||
|
||||
// pages 03h, 04h and 05h as they will be written
|
||||
uint8_t pages[3][MFU_BLOCK_SIZE] = {{0}};
|
||||
if (fmt != NULL) {
|
||||
memcpy(pages, fmt->page, sizeof(pages));
|
||||
} else {
|
||||
// unknown type, -d plus --force: user supplied CC and an empty NDEF message
|
||||
const uint8_t empty[2][MFU_BLOCK_SIZE] = {{0x03, 0x00, 0xFE, 0x00}, {0x00, 0x00, 0x00, 0x00}};
|
||||
memcpy(pages[1], empty[0], MFU_BLOCK_SIZE);
|
||||
memcpy(pages[2], empty[1], MFU_BLOCK_SIZE);
|
||||
}
|
||||
|
||||
if (cc_len == MFU_BLOCK_SIZE) {
|
||||
|
||||
// -d must not announce more memory than this tag type actually has
|
||||
if ((fmt != NULL) && (cc_override[2] > fmt->page[0][2]) && (force == false)) {
|
||||
PrintAndLogEx(FAILED, "Capability Container announces more memory than this tag has");
|
||||
PrintAndLogEx(INFO, " requested... %d bytes ( MLEN %02X )", cc_override[2] * 8, cc_override[2]);
|
||||
PrintAndLogEx(INFO, " tag holds... %d bytes ( MLEN %02X )", fmt->page[0][2] * 8, fmt->page[0][2]);
|
||||
PrintAndLogEx(INFO, "Block 3 is One Time Programmable, this can not be undone.");
|
||||
PrintAndLogEx(HINT, "Hint: add `" _YELLOW_("--force") "` if you really mean it");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
memcpy(pages[0], cc_override, MFU_BLOCK_SIZE);
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
PrintAndLogEx(INFO, "Tag type... " _YELLOW_("%s"), (fmt != NULL) ? fmt->name : "unknown");
|
||||
for (uint8_t i = 0; i < 3; i++) {
|
||||
PrintAndLogEx(INFO, "Block %2u... %s"
|
||||
, MFU_NDEF_CC_BLOCK + i
|
||||
, sprint_hex_inrow(pages[i], MFU_BLOCK_SIZE)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t *auth_key_ptr = authenticationkey;
|
||||
if (swap_endian) {
|
||||
if (ak_len == 16) {
|
||||
if ((tagtype & MFU_TT_UL_C) == MFU_TT_UL_C) {
|
||||
auth_key_ptr = SwapEndian64(authenticationkey, ak_len, 8);
|
||||
} else if ((tagtype & MFU_TT_UL_AES) == MFU_TT_UL_AES) {
|
||||
auth_key_ptr = SwapEndian64(authenticationkey, ak_len, 16);
|
||||
}
|
||||
} else if (ak_len == 4) {
|
||||
auth_key_ptr = SwapEndian64(authenticationkey, ak_len, 4);
|
||||
}
|
||||
}
|
||||
|
||||
iso14a_card_select_t card;
|
||||
uint8_t pack[4] = {0, 0, 0, 0};
|
||||
if (ul_auth_select(&card, tagtype, (has_auth_key || has_pwd), auth_key_ptr, pack, sizeof(pack), use_schann) == PM3_ESOFT) {
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
// read blocks 0..3 so the current Capability Container can be inspected
|
||||
uint8_t data[16] = {0x00};
|
||||
int status = ul_read(0, data, sizeof(data), use_schann);
|
||||
DropField();
|
||||
|
||||
if (status <= 0) {
|
||||
PrintAndLogEx(ERR, "Error: tag didnt answer to READ");
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
if (status != 16) {
|
||||
PrintAndLogEx(ERR, "Error: tag returned %d bytes, need 16 to read the NDEF Container", status);
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
// block 3 is OTP: refuse a target the current content can't reach via OR
|
||||
uint8_t *cur = data + (MFU_NDEF_CC_BLOCK * MFU_BLOCK_SIZE);
|
||||
bool blank = true;
|
||||
bool reachable = true;
|
||||
for (uint8_t i = 0; i < MFU_BLOCK_SIZE; i++) {
|
||||
if (cur[i] != 0x00) {
|
||||
blank = false;
|
||||
}
|
||||
if ((cur[i] | pages[0][i]) != pages[0][i]) {
|
||||
reachable = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (reachable == false) {
|
||||
PrintAndLogEx(FAILED, "Capability Container can not be written on this tag");
|
||||
PrintAndLogEx(INFO, " on tag now... " _RED_("%s"), sprint_hex_inrow(cur, MFU_BLOCK_SIZE));
|
||||
PrintAndLogEx(INFO, " wanted....... " _GREEN_("%s"), sprint_hex_inrow(pages[0], MFU_BLOCK_SIZE));
|
||||
PrintAndLogEx(INFO, "Block 3 is One Time Programmable. A write is OR'ed with the current");
|
||||
PrintAndLogEx(INFO, "content, so a bit that is already 1 can not be cleared again.");
|
||||
ndef_print_CC(cur);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
if (blank == false) {
|
||||
PrintAndLogEx(WARNING, "Tag already carries a Capability Container ( " _YELLOW_("%s") " )"
|
||||
, sprint_hex_inrow(cur, MFU_BLOCK_SIZE)
|
||||
);
|
||||
if (verbose) {
|
||||
ndef_print_CC(cur);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t keytype = 0;
|
||||
if (has_auth_key || has_pwd) {
|
||||
if ((tagtype & MFU_TT_UL_C) == MFU_TT_UL_C) {
|
||||
keytype = 1; // UL_C auth
|
||||
} else if ((tagtype & MFU_TT_UL_AES) == MFU_TT_UL_AES) {
|
||||
keytype = 3; // UL_AES auth
|
||||
} else {
|
||||
keytype = 2; // UL_EV1/NTAG auth
|
||||
}
|
||||
}
|
||||
|
||||
// erase range from the table MLEN, never from -d - can't run past user memory
|
||||
uint16_t last_block = MFU_NDEF_CC_BLOCK + 2;
|
||||
if (erase && (fmt != NULL)) {
|
||||
last_block = (uint16_t)(MFU_NDEF_CC_BLOCK + (fmt->page[0][2] * 2));
|
||||
}
|
||||
|
||||
// block 255 is the last one WRITE can reach with its single address byte
|
||||
if (last_block > 0xFF) {
|
||||
PrintAndLogEx(INFO, "Data area runs past block 255, stopping at the last addressable block");
|
||||
last_block = 0xFF;
|
||||
}
|
||||
|
||||
uint16_t total = (uint16_t)(last_block - MFU_NDEF_CC_BLOCK + 1);
|
||||
|
||||
PrintAndLogEx(INFO, "Writing " _YELLOW_("%u") " blocks from block " _YELLOW_("%d"), total, MFU_NDEF_CC_BLOCK);
|
||||
PrintAndLogEx(INFO, "Press " _GREEN_("<Enter>") " to abort");
|
||||
|
||||
uint16_t done = 0;
|
||||
const uint8_t zeros[MFU_BLOCK_SIZE] = {0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
for (uint16_t blockno = MFU_NDEF_CC_BLOCK; blockno <= last_block; blockno++) {
|
||||
|
||||
if (kbd_enter_pressed()) {
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(WARNING, "aborted via keyboard!");
|
||||
if (done > 0) {
|
||||
PrintAndLogEx(WARNING, "tag holds a partially written NDEF data area, blocks %d..%u"
|
||||
, MFU_NDEF_CC_BLOCK
|
||||
, blockno - 1
|
||||
);
|
||||
}
|
||||
return PM3_EOPABORTED;
|
||||
}
|
||||
|
||||
const uint8_t *src = zeros;
|
||||
if (blockno < MFU_NDEF_CC_BLOCK + 3) {
|
||||
src = pages[blockno - MFU_NDEF_CC_BLOCK];
|
||||
}
|
||||
|
||||
int res = mfu_write_block(src, MFU_BLOCK_SIZE, keytype, auth_key_ptr, (uint8_t)blockno, use_schann);
|
||||
if (res != PM3_SUCCESS) {
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
|
||||
// a protected tag simply stops answering, so the write times out
|
||||
// rather than coming back with an explicit error
|
||||
if (res == PM3_ETIMEOUT) {
|
||||
PrintAndLogEx(FAILED, "Write block %u ( " _RED_("timeout") " )", blockno);
|
||||
} else {
|
||||
PrintAndLogEx(FAILED, "Write block %u ( " _RED_("fail") " )", blockno);
|
||||
}
|
||||
PrintAndLogEx(HINT, "Hint: Check password / key!");
|
||||
|
||||
if (done > 0) {
|
||||
PrintAndLogEx(WARNING, "tag holds a partially written NDEF data area, blocks %d..%u"
|
||||
, MFU_NDEF_CC_BLOCK
|
||||
, blockno - 1
|
||||
);
|
||||
}
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
done++;
|
||||
PrintAndLogEx(INPLACE, "Block %u / %u", done, total);
|
||||
}
|
||||
|
||||
DropField();
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
|
||||
// read the formatted blocks back rather than trust the write status alone
|
||||
if (ul_auth_select(&card, tagtype, (has_auth_key || has_pwd), auth_key_ptr, pack, sizeof(pack), use_schann) == PM3_ESOFT) {
|
||||
PrintAndLogEx(WARNING, "Wrote the tag but could not re-select it to verify");
|
||||
PrintAndLogEx(HINT, "Hint: Try `" _YELLOW_("hf mfu ndefread") "` to check it yourself");
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
uint8_t verify[16] = {0x00};
|
||||
status = ul_read(MFU_NDEF_CC_BLOCK, verify, sizeof(verify), use_schann);
|
||||
DropField();
|
||||
|
||||
if (status != 16) {
|
||||
PrintAndLogEx(WARNING, "Wrote the tag but could not read it back to verify");
|
||||
PrintAndLogEx(HINT, "Hint: Try `" _YELLOW_("hf mfu ndefread") "` to check it yourself");
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
// the read started at block 3, so the three formatted blocks are at offset 0
|
||||
if (memcmp(verify, pages[0], MFU_BLOCK_SIZE) != 0) {
|
||||
PrintAndLogEx(FAILED, "Capability Container did not take");
|
||||
PrintAndLogEx(INFO, " wanted...... " _GREEN_("%s"), sprint_hex_inrow(pages[0], MFU_BLOCK_SIZE));
|
||||
PrintAndLogEx(INFO, " on tag now.. " _RED_("%s"), sprint_hex_inrow(verify, MFU_BLOCK_SIZE));
|
||||
PrintAndLogEx(HINT, "Hint: block 3 is OTP, check whether its block locking bit is set");
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
if (memcmp(verify + MFU_BLOCK_SIZE, pages[1], 2 * MFU_BLOCK_SIZE) != 0) {
|
||||
PrintAndLogEx(FAILED, "Capability Container is correct but the empty NDEF message is not");
|
||||
// one sprint_hex_inrow() call per line: it returns a shared static buffer
|
||||
PrintAndLogEx(INFO, " wanted...... " _GREEN_("%s"), sprint_hex_inrow(pages[1], 2 * MFU_BLOCK_SIZE));
|
||||
PrintAndLogEx(INFO, " on tag now.. " _RED_("%s"), sprint_hex_inrow(verify + MFU_BLOCK_SIZE, 2 * MFU_BLOCK_SIZE));
|
||||
PrintAndLogEx(HINT, "Hint: these blocks are ordinary user memory, check the lock bytes");
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
PrintAndLogEx(INFO, "Verified blocks %d..%d against the tag", MFU_NDEF_CC_BLOCK, MFU_NDEF_CC_BLOCK + 2);
|
||||
}
|
||||
|
||||
PrintAndLogEx(SUCCESS, "Format ( " _GREEN_("ok") " )");
|
||||
PrintAndLogEx(HINT, "Hint: Try `" _YELLOW_("hf mfu ndefwrite") "` to write a NDEF message");
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
// utility function. Retrieves emulator memory
|
||||
static int GetMfuDumpFromEMul(mfu_dump_t **buf) {
|
||||
|
||||
@@ -8722,6 +9088,7 @@ static command_t CommandTable[] = {
|
||||
{"dump", CmdHF14AMfUDump, IfPm3Iso14443a, "Dump MIFARE Ultralight family tag to binary file"},
|
||||
{"incr", CmdHF14AMfUIncr, IfPm3Iso14443a, "Increments Ev1/NTAG counter"},
|
||||
{"info", CmdHF14AMfUInfo, IfPm3Iso14443a, "Tag information"},
|
||||
{"ndefformat", CmdHF14MfuNDEFFormat, IfPm3Iso14443a, "Format tag as NDEF, writes the Capability Container"},
|
||||
{"ndefread", CmdHF14MfuNDEFRead, IfPm3Iso14443a, "Prints NDEF records from card"},
|
||||
{"ndefwrite", CmdHF14MfuNDEFWrite, IfPm3Iso14443a, "Write NDEF records to card"},
|
||||
{"rdbl", CmdHF14AMfURdBl, IfPm3Iso14443a, "Read block"},
|
||||
|
||||
@@ -59,6 +59,7 @@ int mfuc_test_authentication_support(void);
|
||||
int CmdHFMFUltra(const char *Cmd);
|
||||
int CmdHF14MfuNDEFRead(const char *Cmd); // used by cmdnfc.c
|
||||
int CmdHF14MfuNDEFWrite(const char *Cmd); // used by cmdnfc.c
|
||||
int CmdHF14MfuNDEFFormat(const char *Cmd); // used by cmdnfc.c
|
||||
int CmdHF14MfUTamper(const char *Cmd);
|
||||
|
||||
#define MFU_TT_UNKNOWN 0x0ULL
|
||||
|
||||
+81
-5
@@ -2267,19 +2267,95 @@ static int CmdPM5QCTest(const char *Cmd) {
|
||||
|
||||
CLIParserContext *ctx;
|
||||
CLIParserInit(&ctx, "hw qc_pm5", "QC Test for the PM5",
|
||||
"hw qc_pm5 -> run QC test with default 20 second timeout\n"
|
||||
"hw qc_pm5 -t 3 -> run QC test with a 3 second timeout");
|
||||
"hw qc_pm5 -> run hardware QC test with default 20 second timeout\n"
|
||||
"hw qc_pm5 -t 3 -> run hardware QC test with a 3 second timeout\n"
|
||||
"hw qc_pm5 --iolow <index> --pwd <hex> -> drive PM5 test IO <index> low\n"
|
||||
"hw qc_pm5 --iohigh <index> --pwd <hex> -> drive PM5 test IO <index> high\n"
|
||||
"hw qc_pm5 --ioreset <index> --pwd <hex> -> reset PM5 test IO <index> to default");
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_u64_0("t", "timeout", "<s>", "test sequence timeout in seconds (default 20)"),
|
||||
arg_u64_0(NULL, "iolow", "<index>", "drive PM5 test IO <index> low"),
|
||||
arg_u64_0(NULL, "iohigh", "<index>", "drive PM5 test IO <index> high"),
|
||||
arg_u64_0(NULL, "ioreset", "<index>", "reset PM5 test IO <index> to default"),
|
||||
arg_str0(NULL, "pwd", "<hex>", "QC test password in hex (required for IO tests)"),
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
uint32_t timeout_ms = arg_get_u32_def(ctx, 1, 20);
|
||||
timeout_ms *= 1000;
|
||||
|
||||
bool io_low = arg_get_u64_count(ctx, 2) > 0;
|
||||
bool io_high = arg_get_u64_count(ctx, 3) > 0;
|
||||
bool io_reset = arg_get_u64_count(ctx, 4) > 0;
|
||||
int io_count = (io_low ? 1 : 0) + (io_high ? 1 : 0) + (io_reset ? 1 : 0);
|
||||
|
||||
uint16_t io_index = 0;
|
||||
uint8_t io_status = 0;
|
||||
if (io_low) {
|
||||
io_index = (uint16_t)arg_get_u32(ctx, 2);
|
||||
io_status = 0;
|
||||
} else if (io_high) {
|
||||
io_index = (uint16_t)arg_get_u32(ctx, 3);
|
||||
io_status = 1;
|
||||
} else if (io_reset) {
|
||||
io_index = (uint16_t)arg_get_u32(ctx, 4);
|
||||
io_status = 2;
|
||||
}
|
||||
|
||||
uint8_t pwd[4];
|
||||
int dlen = 0;
|
||||
int res = CLIParamHexToBuf(arg_get_str(ctx, 5), pwd, sizeof(pwd), &dlen);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
if (io_count > 1) {
|
||||
PrintAndLogEx(ERR, "only one of --iolow, --iohigh, --ioreset may be specified");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
if (io_count == 1) {
|
||||
if (res || dlen != sizeof(pwd)) {
|
||||
PrintAndLogEx(ERR, "invalid password format, must be hex(8 chars)");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
PrintAndLogEx(WARNING, _RED_("!!! WARNING: PM5 IO QC test drives the test IO pins directly !!!"));
|
||||
PrintAndLogEx(WARNING, _RED_("!!! This can damage the device if used incorrectly !!!"));
|
||||
PrintAndLogEx(WARNING, _RED_("!!! Only proceed if you know exactly what you are doing !!!"));
|
||||
PrintAndLogEx(INFO, "PM5 IO QC test password: 0x%02X%02X%02X%02X", pwd[0], pwd[1], pwd[2], pwd[3]);
|
||||
|
||||
struct {
|
||||
uint32_t pwd; // QC password, verified by the device
|
||||
uint16_t index; // index of the IO to test
|
||||
uint8_t status; // 0 = low, 1 = high, 2 = float or RESET TO DEFAULT
|
||||
} PACKED payload = {
|
||||
.pwd = BYTES2UINT32_BE(pwd),
|
||||
.index = io_index,
|
||||
.status = io_status,
|
||||
};
|
||||
|
||||
PrintAndLogEx(INFO, "Performing PM5 IO QC test (index %u, status %u)...", io_index, io_status);
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_PM5_QC_TEST_IO, (uint8_t *)&payload, sizeof(payload));
|
||||
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_PM5_QC_TEST_IO, &resp, 1000) == false) {
|
||||
SendCommandNG(CMD_BREAK_LOOP, NULL, 0);
|
||||
PrintAndLogEx(WARNING, "command execution time out");
|
||||
return PM3_ETIMEOUT;
|
||||
}
|
||||
|
||||
if (resp.status != PM3_SUCCESS) {
|
||||
PrintAndLogEx(ERR, "failed to perform IO QC test on PM5 (wrong password?)");
|
||||
return resp.status;
|
||||
}
|
||||
PrintAndLogEx(INFO, "PM5 IO QC test successful.");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
if (timeout_ms == 0) {
|
||||
PrintAndLogEx(ERR, "timeout must be greater than zero");
|
||||
return PM3_EINVARG;
|
||||
@@ -2288,11 +2364,11 @@ static int CmdPM5QCTest(const char *Cmd) {
|
||||
PrintAndLogEx(INFO, "Performing QC test for the PM5...");
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_PM5_QC_TEST, (uint8_t *)&timeout_ms, sizeof(timeout_ms));
|
||||
SendCommandNG(CMD_PM5_QC_TEST_HW, (uint8_t *)&timeout_ms, sizeof(timeout_ms));
|
||||
|
||||
PacketResponseNG resp;
|
||||
// wait a bit longer than the device side sequence timeout, with headroom for RTC drift
|
||||
if (WaitForResponseTimeout(CMD_PM5_QC_TEST, &resp, timeout_ms + (timeout_ms / 5) + 1000) == false) {
|
||||
if (WaitForResponseTimeout(CMD_PM5_QC_TEST_HW, &resp, timeout_ms + (timeout_ms / 5) + 1000) == false) {
|
||||
SendCommandNG(CMD_BREAK_LOOP, NULL, 0);
|
||||
PrintAndLogEx(WARNING, "command execution time out");
|
||||
return PM3_ETIMEOUT;
|
||||
@@ -2594,7 +2670,7 @@ static command_t CommandTable[] = {
|
||||
{"fpga", CmdFPGA, IfPm3Present, "Fpga commands"},
|
||||
{"fpgaoff", CmdFPGAOff, IfPm3Present, "Turn off FPGA on device"},
|
||||
{"ant_pm5", CmdPM5Ant, IfPm5StdAnt, "Control the antennal of pm5"},
|
||||
{"qc_pm5", CmdPM5QCTest, IfPm5, "Perform QC test for the PM5"},
|
||||
{"qc_pm5", CmdPM5QCTest, IfPm5, "Perform QC test (hardware or IO) for the PM5"},
|
||||
{"factorydata", CmdDeviceFactoryData, IfI2cEeprom, "Get/Set the factory data for Device"},
|
||||
{"lcd", CmdLCD, IfPm3Lcd, "Send command/data to LCD"},
|
||||
{"lcdreset", CmdLCDReset, IfPm3Lcd, "Hardware reset LCD"},
|
||||
|
||||
+5
-1
@@ -391,12 +391,16 @@ static int CmdNFCType2Write(const char *Cmd) {
|
||||
return CmdHF14MfuNDEFWrite(Cmd);
|
||||
}
|
||||
|
||||
static int CmdNFCType2Format(const char *Cmd) {
|
||||
return CmdHF14MfuNDEFFormat(Cmd);
|
||||
}
|
||||
|
||||
static int CmdNFCType2Help(const char *Cmd);
|
||||
|
||||
static command_t CommandNFCType2Table[] = {
|
||||
|
||||
{"--------", CmdNFCType2Help, AlwaysAvailable, "-------------- " _CYAN_("NFC Forum Tag Type 2") " ---------------"},
|
||||
// {"format", CmdNFCType2Format, IfPm3Iso14443a, "format ISO-14443-a tag as NFC Tag"},
|
||||
{"format", CmdNFCType2Format, IfPm3Iso14443a, "format MIFARE Ultralight / NTAG as NFC Forum Tag Type 2"},
|
||||
{"read", CmdNFCType2Read, IfPm3Iso14443a, "read NFC Forum Tag Type 2"},
|
||||
{"write", CmdNFCType2Write, IfPm3Iso14443a, "write NFC Forum Tag Type 2"},
|
||||
{"--------", CmdNFCType2Help, AlwaysAvailable, "--------------------- " _CYAN_("General") " ---------------------"},
|
||||
|
||||
Reference in new issue
Block a user