This commit is contained in:
iceman1001 2023-10-03 17:10:39 +02:00
parent af685fe47c
commit 4f96d3eb46
13 changed files with 172 additions and 172 deletions

View file

@ -129,10 +129,10 @@ void print_result(const char *name, const uint8_t *d, size_t n) {
}
// Prints message and hexdump
void print_dbg(char *msg, uint8_t *d, uint16_t n) {
void print_dbg(char *msg, uint8_t *d, uint16_t n) {
if (g_dbglevel == DBG_DEBUG) {
print_result(msg, d, n);
}
}
}
/* useful when debugging new protocol implementations like FeliCa

View file

@ -240,7 +240,7 @@ static bool I2C_WaitForSim(uint32_t wait) {
// 1000*110*3.07 = 337.7ms (337700)
// 4 560 000 * 3.07 = 13999,2ms (13999200)
// 1byte transfer == 1ms with max frame being 256bytes
// fct WaitSCL_H_delay uses a I2C_DELAY_1CLK in the loop with "wait" as number of iterations.
// I2C_DELAY_1CLK == I2CSpinDelayClk(1) = 3.07us
return WaitSCL_H_delay(wait);
@ -474,7 +474,7 @@ bool I2C_BufferWrite(const uint8_t *data, uint16_t len, uint8_t device_cmd, uint
if (len == 0) {
_break = false;
}
} while (false);
I2C_Stop();
@ -586,7 +586,7 @@ int16_t I2C_BufferRead(uint8_t *data, uint16_t len, uint8_t device_cmd, uint8_t
// Dbprintf("rec len... %u readcount... %u", recv_len, readcount);
// Dbhexdump(readcount, pd, false);
if (readcount < 2 ) {
if (readcount < 2) {
return 0;
}
@ -771,7 +771,7 @@ bool GetATR(smart_card_atr_t *card_ptr, bool verbose) {
if (card_ptr == NULL) {
return false;
}
card_ptr->atr_len = 0;
memset(card_ptr->atr, 0, sizeof(card_ptr->atr));
@ -781,7 +781,7 @@ bool GetATR(smart_card_atr_t *card_ptr, bool verbose) {
I2C_WriteCmd(I2C_DEVICE_CMD_GENERATE_ATR, I2C_DEVICE_ADDRESS_MAIN);
// wait for sim card to answer.
// 1byte = 1ms , max frame 256bytes. Should wait 256ms atleast just in case.
// 1byte = 1ms , max frame 256bytes. Should wait 256ms atleast just in case.
if (I2C_WaitForSim(SIM_WAIT_DELAY) == false) {
return false;
}

View file

@ -2939,7 +2939,7 @@ int CmdHF14ANdefRead(const char *Cmd) {
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(INFO, "--- " _CYAN_("NDEF raw") " ----------------");
print_buffer(ndef_file, ndef_size, 1);
}
}
NDEFRecordsDecodeAndPrint(ndef_file, ndef_size, verbose);

View file

@ -2184,9 +2184,9 @@ static int CmdHF15Restore(const char *Cmd) {
void *argtable[6 + 5] = {};
uint8_t arglen = arg_add_default(argtable);
argtable[arglen++] = arg_str0("f", "file", "<fn>", "Specify a filename for dump file"),
argtable[arglen++] = arg_int0("r", "retry", "<dec>", "number of retries (def 3)"),
argtable[arglen++] = arg_int0(NULL, "bs", "<dec>", "block size (def 4)"),
argtable[arglen++] = arg_lit0("v", "verbose", "verbose output");
argtable[arglen++] = arg_int0("r", "retry", "<dec>", "number of retries (def 3)"),
argtable[arglen++] = arg_int0(NULL, "bs", "<dec>", "block size (def 4)"),
argtable[arglen++] = arg_lit0("v", "verbose", "verbose output");
argtable[arglen++] = arg_param_end;
CLIExecWithReturn(ctx, Cmd, argtable, true);

View file

@ -412,7 +412,7 @@ int CmdHFST25TANdefRead(const char *Cmd) {
n = resplen;
pm3_save_dump(filename, response + 2, n, jsfNDEF);
return PM3_SUCCESS;
}

View file

@ -2321,7 +2321,7 @@ static int CmdT55xxDump(const char *Cmd) {
data[i] = BSWAP_32(cardmem[i].blockdata);
}
pm3_save_dump(filename, (uint8_t*)data, (T55x7_BLOCK_COUNT * sizeof(uint32_t)), jsfT55x7);
pm3_save_dump(filename, (uint8_t *)data, (T55x7_BLOCK_COUNT * sizeof(uint32_t)), jsfT55x7);
}
return PM3_SUCCESS;
@ -3512,24 +3512,24 @@ bool tryDetectP1(bool getData) {
if (FSKrawDemod(0, 0, 0, 0, false) == PM3_SUCCESS) {
if (preambleSearchEx(g_DemodBuffer, preamble_atmel, sizeof(preamble_atmel), &g_DemodBufferLen, &startIdx, false) &&
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
return true;
}
if (preambleSearchEx(g_DemodBuffer, preamble_silicon, sizeof(preamble_silicon), &g_DemodBufferLen, &startIdx, false) &&
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
return true;
}
}
if (FSKrawDemod(0, 1, 0, 0, false) == PM3_SUCCESS) {
if (preambleSearchEx(g_DemodBuffer, preamble_atmel, sizeof(preamble_atmel), &g_DemodBufferLen, &startIdx, false) &&
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
return true;
}
if (preambleSearchEx(g_DemodBuffer, preamble_silicon, sizeof(preamble_silicon), &g_DemodBufferLen, &startIdx, false) &&
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
return true;
}
}
@ -3541,13 +3541,13 @@ bool tryDetectP1(bool getData) {
if (clk > 0) {
if (ASKDemod_ext(0, 0, 1, 0, false, false, false, 1, &st) == PM3_SUCCESS) {
if (preambleSearchEx(g_DemodBuffer, preamble_atmel, sizeof(preamble_atmel), &g_DemodBufferLen, &startIdx, false) &&
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
if (preambleSearchEx(g_DemodBuffer, preamble_atmel, sizeof(preamble_atmel), &g_DemodBufferLen, &startIdx, false) &&
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
return true;
}
if (preambleSearchEx(g_DemodBuffer, preamble_silicon, sizeof(preamble_silicon), &g_DemodBufferLen, &startIdx, false) &&
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
return true;
}
}
@ -3555,36 +3555,36 @@ bool tryDetectP1(bool getData) {
st = true;
if (ASKDemod_ext(0, 1, 1, 0, false, false, false, 1, &st) == PM3_SUCCESS) {
if (preambleSearchEx(g_DemodBuffer, preamble_atmel, sizeof(preamble_atmel), &g_DemodBufferLen, &startIdx, false) &&
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
return true;
}
if (preambleSearchEx(g_DemodBuffer, preamble_silicon, sizeof(preamble_silicon), &g_DemodBufferLen, &startIdx, false) &&
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
return true;
}
}
if (ASKbiphaseDemod(0, 0, 0, 2, false) == PM3_SUCCESS) {
if (preambleSearchEx(g_DemodBuffer, preamble_atmel, sizeof(preamble_atmel), &g_DemodBufferLen, &startIdx, false) &&
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
return true;
}
if (preambleSearchEx(g_DemodBuffer, preamble_silicon, sizeof(preamble_silicon), &g_DemodBufferLen, &startIdx, false) &&
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
return true;
}
}
if (ASKbiphaseDemod(0, 0, 1, 2, false) == PM3_SUCCESS) {
if (preambleSearchEx(g_DemodBuffer, preamble_atmel, sizeof(preamble_atmel), &g_DemodBufferLen, &startIdx, false) &&
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
return true;
}
if (preambleSearchEx(g_DemodBuffer, preamble_silicon, sizeof(preamble_silicon), &g_DemodBufferLen, &startIdx, false) &&
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
return true;
}
}
@ -3595,24 +3595,24 @@ bool tryDetectP1(bool getData) {
if (clk > 0) {
if (NRZrawDemod(0, 0, 1, false) == PM3_SUCCESS) {
if (preambleSearchEx(g_DemodBuffer, preamble_atmel, sizeof(preamble_atmel), &g_DemodBufferLen, &startIdx, false) &&
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
return true;
}
if (preambleSearchEx(g_DemodBuffer, preamble_silicon, sizeof(preamble_silicon), &g_DemodBufferLen, &startIdx, false) &&
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
return true;
}
}
if (NRZrawDemod(0, 1, 1, false) == PM3_SUCCESS) {
if (preambleSearchEx(g_DemodBuffer, preamble_atmel, sizeof(preamble_atmel), &g_DemodBufferLen, &startIdx, false) &&
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
return true;
}
if (preambleSearchEx(g_DemodBuffer, preamble_silicon, sizeof(preamble_silicon), &g_DemodBufferLen, &startIdx, false) &&
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
return true;
}
}
@ -3629,12 +3629,12 @@ bool tryDetectP1(bool getData) {
if (PSKDemod(0, 0, 6, false) == PM3_SUCCESS) {
//save_restoreGB(GRAPH_RESTORE);
if (preambleSearchEx(g_DemodBuffer, preamble_atmel, sizeof(preamble_atmel), &g_DemodBufferLen, &startIdx, false) &&
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
return true;
}
if (preambleSearchEx(g_DemodBuffer, preamble_silicon, sizeof(preamble_silicon), &g_DemodBufferLen, &startIdx, false) &&
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
return true;
}
}
@ -3642,12 +3642,12 @@ bool tryDetectP1(bool getData) {
if (PSKDemod(0, 1, 6, false) == PM3_SUCCESS) {
//save_restoreGB(GRAPH_RESTORE);
if (preambleSearchEx(g_DemodBuffer, preamble_atmel, sizeof(preamble_atmel), &g_DemodBufferLen, &startIdx, false) &&
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
return true;
}
if (preambleSearchEx(g_DemodBuffer, preamble_silicon, sizeof(preamble_silicon), &g_DemodBufferLen, &startIdx, false) &&
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
return true;
}
}
@ -3658,12 +3658,12 @@ bool tryDetectP1(bool getData) {
//save_restoreGB(GRAPH_RESTORE);
if (preambleSearchEx(g_DemodBuffer, preamble_atmel, sizeof(preamble_atmel), &g_DemodBufferLen, &startIdx, false) &&
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
return true;
}
if (preambleSearchEx(g_DemodBuffer, preamble_silicon, sizeof(preamble_silicon), &g_DemodBufferLen, &startIdx, false) &&
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
(g_DemodBufferLen == 32 || g_DemodBufferLen == 64)) {
return true;
}
} // inverse waves does not affect PSK2 demod

View file

@ -455,7 +455,7 @@ static int CmdSmartRaw(const char *Cmd) {
if (active_select)
payload->flags |= SC_SELECT;
}
payload->wait_delay = 0;
if (timeout > -1) {
payload->flags |= SC_WAIT;

View file

@ -361,7 +361,7 @@ int saveFileJSONex(const char *preferredName, JSONFileType ftype, uint8_t *data,
}
// size of header 56b
size_t len = (datalen - MFU_DUMP_PREFIX_LENGTH) / MFU_BLOCK_SIZE;
for (size_t i = 0; i < len; i++) {
@ -426,7 +426,7 @@ int saveFileJSONex(const char *preferredName, JSONFileType ftype, uint8_t *data,
for (size_t i = 0; i < datalen / 4; i++) {
snprintf(path, sizeof(path), "$.blocks.%zu", i);
JsonSaveBufAsHexCompact(root, path, &data[i * 4], 4);
}
}
break;
}
// handles ISO15693 w blocksize of 4 bytes
@ -438,7 +438,7 @@ int saveFileJSONex(const char *preferredName, JSONFileType ftype, uint8_t *data,
}
break;
}
// handles ISO15693 w blocksize of 8 bytes
// handles ISO15693 w blocksize of 8 bytes
case jsf15_v3: {
JsonSaveStr(root, "FileType", "15693 v3");
for (size_t i = 0; i < datalen / 8; i++) {
@ -457,8 +457,8 @@ int saveFileJSONex(const char *preferredName, JSONFileType ftype, uint8_t *data,
}
if (datalen % 16) {
snprintf(path, sizeof(path), "$.blocks.%zu", i);
JsonSaveBufAsHexCompact(root, path, &data[i * 16], (datalen % 16));
}
JsonSaveBufAsHexCompact(root, path, &data[i * 16], (datalen % 16));
}
break;
}
case jsfT5555: {
@ -610,7 +610,7 @@ int saveFileJSONex(const char *preferredName, JSONFileType ftype, uint8_t *data,
break;
}
case jsfNDEF: {
JsonSaveStr(root, "FileType", "ndef");
JsonSaveStr(root, "FileType", "ndef");
JsonSaveInt(root, "Ndef.Size", datalen);
size_t i = 0;
for (; i < datalen / 16; i++) {
@ -619,17 +619,17 @@ int saveFileJSONex(const char *preferredName, JSONFileType ftype, uint8_t *data,
}
if (datalen % 16) {
snprintf(path, sizeof(path), "$.blocks.%zu", i);
JsonSaveBufAsHexCompact(root, path, &data[i * 16], (datalen % 16));
}
JsonSaveBufAsHexCompact(root, path, &data[i * 16], (datalen % 16));
}
break;
}
// no action
case jsfFido:
case jsfFido:
break;
// depricated
case jsfCardMemory:
case jsfCardMemory:
case jsf14b:
case jsf15:
case jsf15:
case jsfLegic:
default:
break;
@ -1264,7 +1264,7 @@ int loadFileJSONex(const char *preferredName, void *data, size_t maxdatalen, siz
// handles ISO15693 w blocksize of 4 bytes.
if (!strcmp(ctype, "15693 v2")) {
size_t sptr = 0;
size_t sptr = 0;
for (int i = 0; i < (maxdatalen / 4); i++) {
if (sptr + 4 > maxdatalen) {
retval = PM3_EMALLOC;
@ -1284,7 +1284,7 @@ int loadFileJSONex(const char *preferredName, void *data, size_t maxdatalen, siz
}
// handles ISO15693 w blocksize of 8 bytes.
if (!strcmp(ctype, "15693 v3")) {
size_t sptr = 0;
size_t sptr = 0;
for (int i = 0; i < (maxdatalen / 8); i++) {
if (sptr + 8 > maxdatalen) {
retval = PM3_EMALLOC;
@ -1403,36 +1403,36 @@ int loadFileJSONex(const char *preferredName, void *data, size_t maxdatalen, siz
// size_t sptr = (14 + atslen);
// uint8_t dvdata[4][0xE][24 + 1] = {{{0}}};
/*
for (int i = 0; i < (int)datalen; i++) {
char path[PATH_MAX_LENGTH] = {0};
/*
for (int i = 0; i < (int)datalen; i++) {
char path[PATH_MAX_LENGTH] = {0};
if (dvdata[0][i][0]) {
snprintf(path, sizeof(path), "$.DES.%d.Key", i);
JsonSaveBufAsHexCompact(root, path, &dvdata[0][i][1], DES_KEY_LEN);
}
if (dvdata[1][i][0]) {
snprintf(path, sizeof(path), "$.3DES.%d.Key", i);
JsonSaveBufAsHexCompact(root, path, &dvdata[1][i][1], T2DES_KEY_LEN);
}
if (dvdata[2][i][0]) {
snprintf(path, sizeof(path), "$.AES.%d.Key", i);
JsonSaveBufAsHexCompact(root, path, &dvdata[2][i][1], AES_KEY_LEN);
}
if (dvdata[3][i][0]) {
snprintf(path, sizeof(path), "$.K3KDES.%d.Key", i);
JsonSaveBufAsHexCompact(root, path, &dvdata[3][i][1], T3DES_KEY_LEN);
}
if (dvdata[0][i][0]) {
snprintf(path, sizeof(path), "$.DES.%d.Key", i);
JsonSaveBufAsHexCompact(root, path, &dvdata[0][i][1], DES_KEY_LEN);
}
*/
if (dvdata[1][i][0]) {
snprintf(path, sizeof(path), "$.3DES.%d.Key", i);
JsonSaveBufAsHexCompact(root, path, &dvdata[1][i][1], T2DES_KEY_LEN);
}
if (dvdata[2][i][0]) {
snprintf(path, sizeof(path), "$.AES.%d.Key", i);
JsonSaveBufAsHexCompact(root, path, &dvdata[2][i][1], AES_KEY_LEN);
}
if (dvdata[3][i][0]) {
snprintf(path, sizeof(path), "$.K3KDES.%d.Key", i);
JsonSaveBufAsHexCompact(root, path, &dvdata[3][i][1], T3DES_KEY_LEN);
}
}
*/
// memcpy(&data[14 + atslen], dvdata, 4 * 0xE * (24 + 1));
goto out;
}
if (!strcmp(ctype, "14b v2")) {
size_t sptr = 0;
size_t sptr = 0;
for (int i = 0; i < (maxdatalen / 4); i++) {
if (sptr + 4 > maxdatalen) {
retval = PM3_EMALLOC;
@ -1452,7 +1452,7 @@ int loadFileJSONex(const char *preferredName, void *data, size_t maxdatalen, siz
}
if (!strcmp(ctype, "lto")) {
size_t sptr = 0;
size_t sptr = 0;
for (int i = 0; i < (maxdatalen / 32); i++) {
if (sptr + 32 > maxdatalen) {
retval = PM3_EMALLOC;
@ -1472,7 +1472,7 @@ int loadFileJSONex(const char *preferredName, void *data, size_t maxdatalen, siz
}
if (!strcmp(ctype, "cryptorf")) {
size_t sptr = 0;
size_t sptr = 0;
for (int i = 0; i < (maxdatalen / 8); i++) {
if (sptr + 8 > maxdatalen) {
retval = PM3_EMALLOC;
@ -2318,7 +2318,7 @@ int pm3_load_dump(const char *fn, void **pdump, size_t *dumplen, size_t maxdumpl
int pm3_save_dump(const char *fn, uint8_t *d, size_t n, JSONFileType jsft) {
if (fn == NULL || strlen(fn) == 0) {
return PM3_EINVARG;
return PM3_EINVARG;
}
if (d == NULL || n == 0) {
PrintAndLogEx(INFO, "No data to save, skipping...");

View file

@ -301,10 +301,10 @@ int pm3_save_dump(const char *fn, uint8_t *d, size_t n, JSONFileType jsft);
* It also tries to save according to user preferences set dump folder paths.
* E.g. dumpdata.bin
* E.g. dumpdata.json
*
*
* This function is dedicated for MIFARE CLASSIC dumps. Checking for 4 or 7 byte UID in indata.
* Saves the corrected data in the json file
*
*
* @param fn
* @param d The binary data to write to the file
* @param n the length of the data

View file

@ -1285,26 +1285,26 @@ int NDEFGetTotalLength(uint8_t *ndef, size_t ndeflen, size_t *outlen) {
size_t idx = 0;
while (idx < ndeflen) {
if (ndef[idx] == 0x00 ||
ndef[idx] == 0x01 ||
ndef[idx] == 0x02 ||
ndef[idx] == 0x03 ||
ndef[idx] == 0xFD) {
if (ndef[idx] == 0x00 ||
ndef[idx] == 0x01 ||
ndef[idx] == 0x02 ||
ndef[idx] == 0x03 ||
ndef[idx] == 0xFD) {
idx++;
idx += ndefTLVGetLength(&ndef[idx], &idx);
continue;
}
if (ndef[idx] == 0xFE) {
idx++;
break;
}
// invalid NDEF
// invalid NDEF
*outlen = 0;
return PM3_ESOFT;
}
*outlen = idx;
return PM3_SUCCESS;
}
}

View file

@ -966,11 +966,11 @@ void byte_2_binstr(char *target, const uint8_t *source, size_t sourcelen) {
*(target++) = ((b >> 7) & 0x1) + '0';
*(target++) = ((b >> 6) & 0x1) + '0';
*(target++) = ((b >> 5) & 0x1) + '0';
*(target++) = ((b >> 4) & 0x1) + '0';
*(target++) = ((b >> 4) & 0x1) + '0';
*(target++) = ((b >> 3) & 0x1) + '0';
*(target++) = ((b >> 2) & 0x1) + '0';
*(target++) = ((b >> 1) & 0x1) + '0';
*(target++) = (b & 0x1) + '0';
*(target++) = (b & 0x1) + '0';
}
*target = '\0';
}

View file

@ -1538,7 +1538,7 @@
"offline": true,
"options": [
"-h, --help This help",
"-f, --file <fn> filename of dump",
"-f, --file <fn> Specify a filename for dump file",
"-v, --verbose verbose output"
],
"usage": "hf 14b view [-hv] -f <fn>"
@ -1570,7 +1570,7 @@
},
"hf 15 dump": {
"command": "hf 15 dump",
"description": "This command dumps the contents of a ISO-15693 tag and save it to file",
"description": "This command dumps the contents of a ISO-15693 tag and save to file (bin/json)",
"notes": [
"hf 15 dump",
"hf 15 dump -*",
@ -1584,7 +1584,7 @@
"-* scan for tag",
"-2 use slower '1 out of 256' mode",
"-o, --opt set OPTION Flag (needed for TI)",
"-f, --file <fn> filename of dump"
"-f, --file <fn> Specify a filename for dump file"
],
"usage": "hf 15 dump [-h*2o] [-u <hex>] [--ua] [-f <fn>]"
},
@ -1603,18 +1603,18 @@
},
"hf 15 esave": {
"command": "hf 15 esave",
"description": "Save emulator memory into three files (BIN/EML/JSON)",
"description": "Save emulator memory into two files (bin/json)",
"notes": [
"hf 15 esave -f hf-15-01020304hf 15 esave -b 8 -c 42 -f hf-15-01020304"
],
"offline": false,
"options": [
"-h, --help This help",
"-f, --file <fn> filename of dump",
"-b, --blocksize <dec> block size, defaults to 4",
"-f, --file <fn> Specify a filename for dump file",
"--bsize <dec> block size, defaults to 4",
"-c, --count <dec> number of blocks to export, defaults to all"
],
"usage": "hf 15 esave [-h] -f <fn> [-b <dec>] [-c <dec>]"
"usage": "hf 15 esave [-h] -f <fn> [--bsize <dec>] [-c <dec>]"
},
"hf 15 eview": {
"command": "hf 15 eview",
@ -1784,7 +1784,7 @@
},
"hf 15 restore": {
"command": "hf 15 restore",
"description": "This command restore the contents of a dump file onto a ISO-15693 tag",
"description": "This command restore the contents of a dump file (bin/eml/json) onto a ISO-15693 tag",
"notes": [
"hf 15 restore",
"hf 15 restore -*",
@ -1798,7 +1798,7 @@
"-* scan for tag",
"-2 use slower '1 out of 256' mode",
"-o, --opt set OPTION Flag (needed for TI)",
"-f, --file <fn> filename of dump",
"-f, --file <fn> Specify a filename for dump file",
"-r, --retry <dec> number of retries (def 3)",
"--bs <dec> block size (def 4)",
"-v, --verbose verbose output"
@ -1919,7 +1919,7 @@
"offline": true,
"options": [
"-h, --help This help",
"-f, --file <fn> filename of dump (bin/eml/json)"
"-f, --file <fn> Specify a filename for dump file"
],
"usage": "hf 15 view [-h] -f <fn>"
},
@ -2807,14 +2807,14 @@
},
"hf fudan dump": {
"command": "hf fudan dump",
"description": "Dump FUDAN tag to binary file If no <name> given, UID will be used as filename",
"description": "Dump FUDAN tag to file (bin/json) If no <name> given, UID will be used as filename",
"notes": [
"hf fudan dump -f mydump -> dump using filename"
],
"offline": false,
"options": [
"-h, --help This help",
"-f, --file <fn> filename of dump"
"-f, --file <fn> Specify a filename for dump file"
],
"usage": "hf fudan dump [-h] [-f <fn>]"
},
@ -2858,7 +2858,7 @@
"offline": true,
"options": [
"-h, --help This help",
"-f, --file <fn> filename of dump"
"-f, --file <fn> Specify a filename for dump file"
],
"usage": "hf fudan view [-h] -f <fn>"
},
@ -3051,7 +3051,7 @@
},
"hf iclass decrypt": {
"command": "hf iclass decrypt",
"description": "3DES decrypt data This is a naive implementation, it tries to decrypt every block after block 6. Correct behaviour would be to decrypt only the application areas where the key is valid, which is defined by the configuration block. OBS! In order to use this function, the file `iclass_decryptionkey.bin` must reside in the resources directory. The file should be 16 bytes binary data or... make sure your cardhelper is placed in the sim module",
"description": "3DES decrypt data This is a naive implementation, it tries to decrypt every block after block 6. Correct behaviour would be to decrypt only the application areas where the key is valid, which is defined by the configuration block. OBS! In order to use this function, the file `iclass_decryptionkey.bin` must reside in the resources directory. The file must be 16 bytes binary data or... make sure your cardhelper is placed in the sim module",
"notes": [
"hf iclass decrypt -f hf-iclass-AA162D30F8FF12F1-dump.bin",
"hf iclass decrypt -f hf-iclass-AA162D30F8FF12F1-dump.bin -k 000102030405060708090a0b0c0d0e0f",
@ -3060,7 +3060,7 @@
"offline": true,
"options": [
"-h, --help This help",
"-f, --file <fn> filename of dump file (bin/eml/json)",
"-f, --file <fn> Specify a filename for dump file",
"-d, --data <hex> 3DES encrypted data",
"-k, --key <hex> 3DES transport key",
"-v, --verbose verbose output",
@ -3098,15 +3098,15 @@
},
"hf iclass eload": {
"command": "hf iclass eload",
"description": "Load emulator memory with data from (bin/eml/json) iCLASS dump file",
"description": "Load emulator memory with data from (bin/json) iCLASS dump file",
"notes": [
"hf iclass eload -f hf-iclass-AA162D30F8FF12F1-dump.eml",
"hf iclass eload -f hf-iclass-AA162D30F8FF12F1-dump.json",
"hf iclass eload -f hf-iclass-AA162D30F8FF12F1-dump.bin -m"
],
"offline": false,
"options": [
"-h, --help This help",
"-f, --file <fn> filename of dump (bin/eml/json)",
"-f, --file <fn> Specify a filename for dump file",
"-m, --mem use RDV4 spiffs",
"-v, --verbose verbose output"
],
@ -3155,7 +3155,7 @@
},
"hf iclass esave": {
"command": "hf iclass esave",
"description": "Save emulator memory to file. if filename is not supplied, CSN will be used.",
"description": "Save emulator memory to file (bin/json) if filename is not supplied, CSN will be used.",
"notes": [
"hf iclass esave",
"hf iclass esave -f hf-iclass-dump",
@ -3164,7 +3164,7 @@
"offline": false,
"options": [
"-h, --help This help",
"-f, --file <fn> filename of dump file",
"-f, --file <fn> Specify a filename for dump file",
"-s, --size <256|2048> number of bytes to save (default 256)"
],
"usage": "hf iclass esave [-h] [-f <fn>] [-s <256|2048>]"
@ -3344,7 +3344,7 @@
},
"hf iclass restore": {
"command": "hf iclass restore",
"description": "Restore data from dumpfile onto a iCLASS tag",
"description": "Restore data from dumpfile (bin/eml/json) onto a iCLASS tag",
"notes": [
"hf iclass restore -f hf-iclass-AA162D30F8FF12F1-dump.bin --first 6 --last 18 --ki 0",
"hf iclass restore -f hf-iclass-AA162D30F8FF12F1-dump.bin --first 6 --last 18 --ki 0 --elite",
@ -3353,7 +3353,7 @@
"offline": false,
"options": [
"-h, --help This help",
"-f, --file <fn> specify a filename to restore (bin/eml/json)",
"-f, --file <fn> specify a filename to restore",
"-k, --key <hex> Access key as 8 hex bytes",
"--ki <dec> Key index to select key from memory 'hf iclass managekeys'",
"--first <dec> The first block number to restore",
@ -3425,7 +3425,7 @@
"offline": true,
"options": [
"-h, --help This help",
"-f, --file <fn> filename of dump (bin/eml/json)",
"-f, --file <fn> Specify a filename for dump file",
"--first <dec> Begin printing from this block (default first user block)",
"--last <dec> End printing at this block (default 0, ALL)",
"-v, --verbose verbose output",
@ -3623,7 +3623,7 @@
},
"hf legic dump": {
"command": "hf legic dump",
"description": "Read all memory from LEGIC Prime tags and saves to (bin/eml/json) dump file It autodetects card type (MIM22, MIM256, MIM1024)",
"description": "Read all memory from LEGIC Prime tags and saves to (bin/json) dump file It autodetects card type (MIM22, MIM256, MIM1024)",
"notes": [
"hf legic dump -> use UID as filename",
"hf legic dump -f myfile",
@ -3670,7 +3670,7 @@
},
"hf legic esave": {
"command": "hf legic esave",
"description": "Saves a (bin/eml/json) dump file of emulator memory",
"description": "Saves a (bin/json) dump file of emulator memory",
"notes": [
"hf legic esave -> uses UID as filename",
"hf legic esave -f myfile --22",
@ -3778,7 +3778,7 @@
"offline": false,
"options": [
"-h, --help This help",
"-f, --file <fn> Filename to restore",
"-f, --file <fn> Specify a filename to restore",
"--ob obfuscate dump data (xor with MCC)"
],
"usage": "hf legic restore [-h] -f <fn> [--ob]"
@ -3807,7 +3807,7 @@
"offline": true,
"options": [
"-h, --help This help",
"-f, --file <fn> Filename of dump",
"-f, --file <fn> Specify a filename for dump file",
"-v, --verbose verbose output"
],
"usage": "hf legic view [-hv] -f <fn>"
@ -4092,14 +4092,14 @@
"offline": false,
"options": [
"-h, --help This help",
"-f, --file <fn> filename of dump",
"-f, --file <fn> Specify a filename for dump file",
"--emu from emulator memory"
],
"usage": "hf mf cload [-h] [-f <fn>] [--emu]"
},
"hf mf csave": {
"command": "hf mf csave",
"description": "Save magic gen1a card memory into three files (BIN/EML/JSON)or into emulator memory",
"description": "Save magic gen1a card memory to file (bin/json)or into emulator memory",
"notes": [
"hf mf csave",
"hf mf csave --4k"
@ -4107,7 +4107,7 @@
"offline": false,
"options": [
"-h, --help This help",
"-f, --file <fn> filename of dump",
"-f, --file <fn> Specify a filename for dump file",
"--mini MIFARE Classic Mini / S20",
"--1k MIFARE Classic 1k / S50 (def)",
"--2k MIFARE Classic/Plus 2k",
@ -4218,7 +4218,7 @@
},
"hf mf dump": {
"command": "hf mf dump",
"description": "Dump MIFARE Classic tag to binary file If no <name> given, UID will be used as filename",
"description": "Dump MIFARE Classic tag to file (bin/json) If no <name> given, UID will be used as filename",
"notes": [
"hf mf dump --mini -> MIFARE Mini",
"hf mf dump --1k -> MIFARE Classic 1k",
@ -4229,7 +4229,7 @@
"offline": false,
"options": [
"-h, --help This help",
"-f, --file <fn> filename of dump",
"-f, --file <fn> Specify a filename for dump file",
"-k, --keys <fn> filename of keys",
"--mini MIFARE Classic Mini / S20",
"--1k MIFARE Classic 1k / S50 (def)",
@ -4327,7 +4327,7 @@
"offline": false,
"options": [
"-h, --help This help",
"-f, --file <fn> filename of dump",
"-f, --file <fn> Specify a filename for dump file",
"--mini MIFARE Classic Mini / S20",
"--1k MIFARE Classic 1k / S50 (def)",
"--2k MIFARE Classic/Plus 2k",
@ -4341,7 +4341,7 @@
},
"hf mf esave": {
"command": "hf mf esave",
"description": "Save emulator memory into three files (BIN/EML/JSON)",
"description": "Save emulator memory to file (bin/json)",
"notes": [
"hf mf esave",
"hf mf esave --4k",
@ -4350,7 +4350,7 @@
"offline": false,
"options": [
"-h, --help This help",
"-f, --file <fn> filename of dump",
"-f, --file <fn> Specify a filename for dump file",
"--mini MIFARE Classic Mini / S20",
"--1k MIFARE Classic 1k / S50 (def)",
"--2k MIFARE Classic/Plus 2k",
@ -4540,7 +4540,7 @@
"--4k MIFARE Classic 4k / S70",
"-p, --pwd <hex> password 4bytes",
"-v, --verbose verbose output",
"-f, --file <fn> filename of dump",
"-f, --file <fn> Specify a filename for dump file",
"--emu from emulator memory",
"--start <dec> index of block to start writing (default 0)",
"--end <dec> index of block to end writing (default last block)"
@ -4549,7 +4549,7 @@
},
"hf mf gsave": {
"command": "hf mf gsave",
"description": "Save `magic gen4 gtu` card memory into three files (BIN/EML/JSON)or into emulator memory",
"description": "Save `magic gen4 gtu` card memory to file (bin/json)or into emulator memory",
"notes": [
"hf mf gsave",
"hf mf gsave --4k",
@ -4562,8 +4562,8 @@
"--1k MIFARE Classic 1k / S50 (def)",
"--2k MIFARE Classic/Plus 2k",
"--4k MIFARE Classic 4k / S70",
"-p, --pwd <hex> password 4bytes",
"-f, --file <fn> filename of dump",
"-p, --pwd <hex> password 4 bytes",
"-f, --file <fn> Specify a filename for dump file",
"--emu to emulator memory"
],
"usage": "hf mf gsave [-h] [--mini] [--1k] [--2k] [--4k] [-p <hex>] [-f <fn>] [--emu]"
@ -4864,7 +4864,7 @@
"--2k MIFARE Classic/Plus 2k",
"--4k MIFARE Classic 4k / S70",
"-u, --uid <hex> uid, (4|7|10 hex bytes)",
"-f, --file <fn> specify dump filename (bin/eml/json)",
"-f, --file <fn> specify a filename for dump file",
"-k, --kfn <fn> key filename",
"--ka use specified keyfile to authenticate",
"--force override warnings"
@ -4999,7 +4999,7 @@
"offline": true,
"options": [
"-h, --help This help",
"-f, --file <fn> filename of dump",
"-f, --file <fn> Specify a filename for dump file",
"-v, --verbose verbose output",
"--sk Save extracted keys to file"
],
@ -5163,9 +5163,9 @@
"description": "Checks keys with MIFARE DESFire card.",
"notes": [
"hf mfdes chk --aid 123456 -k 000102030405060708090a0b0c0d0e0f -> check key on aid 0x123456",
"hf mfdes chk -d mfdes_default_keys -> check keys from dictionary against all existing aid on card",
"hf mfdes chk -d mfdes_default_keys --aid 123456 -> check keys from dictionary against aid 0x123456",
"hf mfdes chk --aid 123456 --pattern1b -j keys -> check all 1-byte keys pattern on aid 0x123456 and save found keys to json",
"hf mfdes chk -d mfdes_default_keys -> check keys against all existing aid on card",
"hf mfdes chk -d mfdes_default_keys --aid 123456 -> check keys against aid 0x123456",
"hf mfdes chk --aid 123456 --pattern1b -j keys -> check all 1-byte keys pattern on aid 0x123456 and save found keys to `keys.json`",
"hf mfdes chk --aid 123456 --pattern2b --startp2b FA00 -> check all 2-byte keys pattern on aid 0x123456. Start from key FA00FA00...FA00"
],
"offline": false,
@ -6224,7 +6224,7 @@
},
"hf mfp dump": {
"command": "hf mfp dump",
"description": "Dump MIFARE Plus tag to binary file If no <name> given, UID will be used as filename",
"description": "Dump MIFARE Plus tag to file (bin/json) If no <name> given, UID will be used as filename",
"notes": [
"hf mfp dump",
"hf mfp dump --keys hf-mf-066C8B78-key.bin -> MIFARE Plus with keys from specified file"
@ -6232,8 +6232,8 @@
"offline": false,
"options": [
"-h, --help This help",
"-f, --file <fn> filename of dump",
"-k, --keys <fn> filename of keys",
"-f, --file <fn> Specify a filename for dump file",
"-k, --keys <fn> Specify a filename for keys file",
"--ns no save to file",
"-v, --verbose Verbose mode"
],
@ -6447,7 +6447,7 @@
},
"hf mfu dump": {
"command": "hf mfu dump",
"description": "Dump MIFARE Ultralight/NTAG tag to binary/eml/json files. It autodetects card type.Supports: Ultralight, Ultralight-C, Ultralight EV1 NTAG 203, NTAG 210, NTAG 212, NTAG 213, NTAG 215, NTAG 216",
"description": "Dump MIFARE Ultralight/NTAG tag to files (bin/json) It autodetects card type.Supports: Ultralight, Ultralight-C, Ultralight EV1 NTAG 203, NTAG 210, NTAG 212, NTAG 213, NTAG 215, NTAG 216",
"notes": [
"hf mfu dump -f myfile",
"hf mfu dump -k AABBCCDD -> dump whole tag using pwd AABBCCDD",
@ -6477,7 +6477,7 @@
"offline": false,
"options": [
"-h, --help This help",
"-f, --file <fn> Filename of dump",
"-f, --file <fn> Specify a filename for dump file",
"-q, --qty <dec> Number of blocks to load from eml file",
"-v, --verbose verbose output"
],
@ -6485,17 +6485,17 @@
},
"hf mfu esave": {
"command": "hf mfu esave",
"description": "Saves emulator memory to a MIFARE Ultralight/NTAG dump file (bin/eml/json) By default number of pages saved depends on defined tag type. You can override this with option --end.",
"description": "Saves emulator memory to a MIFARE Ultralight/NTAG dump file (bin/json) By default number of pages saved depends on defined tag type. You can override this with option --end.",
"notes": [
"hf mfu esave",
"hf mfu esave --end 255 -> saves whole memory",
"hf mfu esave -f hf-mfu-04010203040506-dump.json"
"hf mfu esave -f hf-mfu-04010203040506-dump"
],
"offline": false,
"options": [
"-h, --help This help",
"-e, --end <dec> index of last block",
"-f, --file <fn> filename of dump"
"-f, --file <fn> Specify a filename for dump file"
],
"usage": "hf mfu esave [-h] [-e <dec>] [-f <fn>]"
},
@ -6642,7 +6642,7 @@
},
"hf mfu restore": {
"command": "hf mfu restore",
"description": "Restore MIFARE Ultralight/NTAG dump file to tag.",
"description": "Restore MIFARE Ultralight/NTAG dump file (bin/eml/json) to tag.",
"notes": [
"hf mfu restore -f myfile -s -> special write",
"hf mfu restore -f myfile -k AABBCCDD -s -> special write, use key",
@ -6651,7 +6651,7 @@
"offline": false,
"options": [
"-h, --help This help",
"-f, --file <fn> specify dump filename (bin/eml/json)",
"-f, --file <fn> Specify a filename for dump file",
"-k, --key <hex> key for authentication (UL-C 16 bytes, EV1/NTAG 4 bytes)",
"-l swap entered key's endianness",
"-s enable special write UID -MAGIC TAG ONLY-",
@ -6733,7 +6733,7 @@
"offline": true,
"options": [
"-h, --help This help",
"-f, --file <fn> Filename of dump",
"-f, --file <fn> Specify a filename for dump file",
"-v, --verbose Verbose output"
],
"usage": "hf mfu view [-hv] -f <fn>"
@ -6790,7 +6790,7 @@
"offline": true,
"options": [
"-h, --help This help",
"-f, --file <fn> Filename of dump",
"-f, --file <fn> Specify a filename for dump file",
"-v, --verbose Verbose output"
],
"usage": "hf ntag424 view [-hv] -f <fn>"
@ -7087,14 +7087,14 @@
},
"hf topaz dump": {
"command": "hf topaz dump",
"description": "Dump TOPAZ tag to binary file If no <name> given, UID will be used as filename",
"description": "Dump TOPAZ tag to file (bin/json) If no <name> given, UID will be used as filename",
"notes": [
"hf topaz dump"
],
"offline": false,
"options": [
"-h, --help This help",
"-f, --file <fn> filename of dump",
"-f, --file <fn> Specify a filename for dump file",
"--ns no save to file"
],
"usage": "hf topaz dump [-h] [-f <fn>] [--ns]"
@ -7208,7 +7208,7 @@
"offline": true,
"options": [
"-h, --help This help",
"-f, --file <fn> filename of dump (bin/eml/json)"
"-f, --file <fn> Specify a filename for dump file"
],
"usage": "hf topaz view [-h] -f <fn>"
},
@ -8159,7 +8159,7 @@
},
"lf em 4x50 dump": {
"command": "lf em 4x50 dump",
"description": "Reads all blocks/words from EM4x50 tag and saves dump in bin/eml/json format",
"description": "Reads all blocks/words from EM4x50 tag and saves dump in (bin/json) format",
"notes": [
"lf em 4x50 dump",
"lf em 4x50 dump -f mydump",
@ -8169,7 +8169,7 @@
"offline": false,
"options": [
"-h, --help This help",
"-f, --file <fn> specify dump filename (bin/eml/json)",
"-f, --file <fn> specify dump filename",
"-p, --pwd <hex> password, 4 hex bytes, lsb"
],
"usage": "lf em 4x50 dump [-h] [-f <fn>] [-p <hex>]"
@ -8183,13 +8183,13 @@
"offline": false,
"options": [
"-h, --help This help",
"-f, --file <fn> dump filename (bin/eml/json)"
"-f, --file <fn> Specify a filename for dump file"
],
"usage": "lf em 4x50 eload [-h] -f <fn>"
},
"lf em 4x50 esave": {
"command": "lf em 4x50 esave",
"description": "Saves bin/eml/json dump file of emulator memory.",
"description": "Saves bin/json dump file of emulator memory.",
"notes": [
"lf em 4x50 esave -> use UID as filename",
"lf em 4x50 esave -f mydump"
@ -8284,7 +8284,7 @@
"options": [
"-h, --help This help",
"-u, --uid <hex> uid, 4 hex bytes, msb",
"-f, --file <fn> specify dump filename (bin/eml/json)",
"-f, --file <fn> specify a filename for dump file",
"-p, --pwd <hex> password, 4 hex bytes, lsb"
],
"usage": "lf em 4x50 restore [-h] [-u <hex>] [-f <fn>] [-p <hex>]"
@ -8806,7 +8806,7 @@
"-1, --ht1 Card type Hitag 1",
"-2, --ht2 Card type Hitag 2",
"-s, --hts Card type Hitag S",
"-m, --htm Card type Hitag \u00ce\u00bc"
"-m, --htm Card type Hitag \u03bc"
],
"usage": "lf hitag eload [-h12sm] -f <fn>"
},
@ -10176,7 +10176,7 @@
},
"lf t55xx dump": {
"command": "lf t55xx dump",
"description": "This command dumps a T55xx card Page 0 block 0-7. It will create three files (bin/eml/json)",
"description": "This command dumps a T55xx card Page 0 block 0-7. It will create two files (bin/json)",
"notes": [
"lf t55xx dump",
"lf t55xx dump -p aabbccdd --override",
@ -10328,7 +10328,7 @@
"offline": false,
"options": [
"-h, --help This help",
"-f, --file <fn> filename of dump file",
"-f, --file <fn> Specify a filename for dump file",
"-p, --pwd <hex> password if target card has password set (4 hex bytes)"
],
"usage": "lf t55xx restore [-h] [-f <fn>] [-p <hex>]"
@ -10713,16 +10713,15 @@
"description": "Dumps device SPIFFS file to a local file Size is handled by first sending a STAT command against file to verify existence",
"notes": [
"mem spiffs dump -s tag.bin -> download binary file from device",
"mem spiffs dump -s tag.bin -d aaa -e -> download tag.bin, save as aaa.eml format"
"mem spiffs dump -s tag.bin -d a001 -e -> download tag.bin, save as `a001.bin`"
],
"offline": false,
"options": [
"-h, --help This help",
"-s, --src <fn> SPIFFS file to save",
"-d, --dest <fn> file name to save to <w/o .bin>",
"-e, --eml also save in EML format"
"-d, --dest <fn> file name to save to <w/o .bin>"
],
"usage": "mem spiffs dump [-he] -s <fn> [-d <fn>]"
"usage": "mem spiffs dump [-h] -s <fn> [-d <fn>]"
},
"mem spiffs info": {
"command": "mem spiffs info",
@ -11579,9 +11578,10 @@
"-s active smartcard with select (get ATR)",
"-t, --tlv executes TLV decoder if it possible",
"-0 use protocol T=0",
"--timeout <ms> Timeout in MS waiting for SIM to respond. (def 337ms)",
"-d, --data <hex> bytes to send"
],
"usage": "smart raw [-hrast0] -d <hex>"
"usage": "smart raw [-hrast0] [--timeout <ms>] -d <hex>"
},
"smart reader": {
"command": "smart reader",
@ -11857,6 +11857,6 @@
"metadata": {
"commands_extracted": 687,
"extracted_by": "PM3Help2JSON v1.00",
"extracted_on": "2023-09-10T12:59:25"
"extracted_on": "2023-10-03T15:10:12"
}
}

View file

@ -700,7 +700,7 @@ typedef struct {
#define CMD_HF_MIFARE_G4_GDM_CONFIG 0x0872
#define CMD_HF_MIFARE_G4_GDM_WRCFG 0x0873
// HID SAM
// HID SAM
#define CMD_HF_SAM_PICOPASS 0x0900
#define CMD_HF_SAM_SEOS 0x0901
#define CMD_HF_SAM_MFC 0x0902