mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-05-12 11:18:11 -07:00
Merge branch 'RfidResearchGroup:master' into master
This commit is contained in:
@@ -2275,6 +2275,49 @@ void SimulateIso14443aTagEx(uint8_t tagType, uint16_t flags, uint8_t *useruid, u
|
||||
EmSendCmd(cmd, sizeof(cmd));
|
||||
p_response = NULL;
|
||||
|
||||
} else if (receivedCmd[0] == MFP_WRITEPERSO && len == 21 && (tagType == 15)) {
|
||||
// cmd + 2 bytes block + value + 2 bytes crc
|
||||
if (CheckCrc14A(receivedCmd, len)) {
|
||||
uint16_t page = receivedCmd[1] | (receivedCmd[2] << 8);
|
||||
if (page > 0x9005 || page < 0x9000) {
|
||||
// send NACK 0x0 == invalid argument
|
||||
EmSend4bit(CARD_NACK_IV);
|
||||
} else {
|
||||
// send ACK
|
||||
EmSend4bit(CARD_ACK);
|
||||
|
||||
Dbprintf("MFP Perso Key | %04X | %02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
|
||||
page,
|
||||
receivedCmd[3],
|
||||
receivedCmd[4],
|
||||
receivedCmd[5],
|
||||
receivedCmd[6],
|
||||
receivedCmd[7],
|
||||
receivedCmd[8],
|
||||
receivedCmd[9],
|
||||
receivedCmd[10],
|
||||
receivedCmd[11],
|
||||
receivedCmd[12],
|
||||
receivedCmd[13],
|
||||
receivedCmd[14],
|
||||
receivedCmd[15],
|
||||
receivedCmd[16],
|
||||
receivedCmd[17],
|
||||
receivedCmd[18]
|
||||
);
|
||||
|
||||
numReads++; // Increment number of times reader requested a block
|
||||
|
||||
if (exitAfterNReads > 0 && numReads == exitAfterNReads) {
|
||||
finished = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// send NACK 0x1 == crc/parity error
|
||||
EmSend4bit(CARD_NACK_PA);
|
||||
}
|
||||
p_response = NULL;
|
||||
|
||||
} else {
|
||||
|
||||
// clear old dynamic responses
|
||||
@@ -3633,6 +3676,9 @@ void ReaderIso14443a(PacketCommandNG *c) {
|
||||
|
||||
if ((param & ISO14A_CONNECT) == ISO14A_CONNECT) {
|
||||
iso14_pcb_blocknum = 0;
|
||||
}
|
||||
|
||||
if ((param & ISO14A_CLEARTRACE) == ISO14A_CLEARTRACE) {
|
||||
clear_trace();
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ local ISO14A_COMMAND = {
|
||||
ISO14A_SEND_CHAINING = 0x400,
|
||||
ISO14A_USE_ECP = 0x800,
|
||||
ISO14A_USE_MAGSAFE = 0x1000,
|
||||
ISO14A_CLEARTRACE = 0x20000,
|
||||
}
|
||||
|
||||
local ISO14443a_TYPES = {}
|
||||
@@ -90,7 +91,7 @@ local function read14443a(dont_disconnect, no_rats)
|
||||
|
||||
command = Command:newMIX{
|
||||
cmd = cmds.CMD_HF_ISO14443A_READER,
|
||||
arg1 = ISO14A_COMMAND.ISO14A_CONNECT
|
||||
arg1 = ISO14A_COMMAND.ISO14A_CONNECT + ISO14A_COMMAND.ISO14A_CLEARTRACE
|
||||
}
|
||||
|
||||
if dont_disconnect then
|
||||
|
||||
@@ -72,7 +72,7 @@ local function sendRaw(rawdata, options)
|
||||
local flags = lib14a.ISO14A_COMMAND.ISO14A_NO_DISCONNECT + lib14a.ISO14A_COMMAND.ISO14A_RAW
|
||||
|
||||
if options.connect then
|
||||
flags = flags + lib14a.ISO14A_COMMAND.ISO14A_CONNECT
|
||||
flags = flags + lib14a.ISO14A_COMMAND.ISO14A_CONNECT + lib14a.ISO14A_COMMAND.ISO14A_CLEARTRACE
|
||||
end
|
||||
|
||||
if options.no_select then
|
||||
|
||||
@@ -75,7 +75,7 @@ local function sendRaw(rawdata, options)
|
||||
end
|
||||
|
||||
if options.connect then
|
||||
flags = flags + lib14a.ISO14A_COMMAND.ISO14A_CONNECT
|
||||
flags = flags + lib14a.ISO14A_COMMAND.ISO14A_CONNECT + lib14a.ISO14A_COMMAND.ISO14A_CLEARTRACE
|
||||
end
|
||||
|
||||
if options.no_select then
|
||||
|
||||
@@ -2217,11 +2217,30 @@
|
||||
},
|
||||
{
|
||||
"AID": "4F53452E5641532E3031",
|
||||
"Vendor": "Apple, Google",
|
||||
"Vendor": "Apple",
|
||||
"Country": "",
|
||||
"Name": "Value-Added Services (OSE.VAS.01)",
|
||||
"Description": "Used by Apple VAS and Google SmartTap",
|
||||
"Type": "loyalty"
|
||||
"Name": "Apple VAS (OSE.VAS.01)",
|
||||
"Description": "Apple VAS",
|
||||
"Type": "loyalty",
|
||||
"ResponseContains": "50084170706c65506179"
|
||||
},
|
||||
{
|
||||
"AID": "4F53452E5641532E3031",
|
||||
"Vendor": "Google",
|
||||
"Country": "",
|
||||
"Name": "Google Smart Tap (OSE.VAS.01)",
|
||||
"Description": "Google Smart Tap",
|
||||
"Type": "loyalty",
|
||||
"ResponseContains": "500a416e64726f6964506179"
|
||||
},
|
||||
{
|
||||
"AID": "4F53452E5641532E3031",
|
||||
"Vendor": "Samsung",
|
||||
"Country": "",
|
||||
"Name": "Samsung VAS (OSE.VAS.01)",
|
||||
"Description": "Samsung VAS",
|
||||
"Type": "loyalty",
|
||||
"ResponseContains": "500d53616d73756e6757616c6c6574"
|
||||
},
|
||||
{
|
||||
"AID": "A000000476D0000101",
|
||||
@@ -2239,6 +2258,14 @@
|
||||
"Description": "",
|
||||
"Type": "loyalty"
|
||||
},
|
||||
{
|
||||
"AID": "A000000870FC000000000034",
|
||||
"Vendor": "Samsung",
|
||||
"Country": "",
|
||||
"Name": "Samsung VAS",
|
||||
"Description": "",
|
||||
"Type": "loyalty"
|
||||
},
|
||||
{
|
||||
"AID": "A0000002480400",
|
||||
"Vendor": "ISO/IEC JTC1/SC17",
|
||||
|
||||
+134
-36
@@ -20,6 +20,7 @@
|
||||
#include <string.h>
|
||||
#include "fileutils.h"
|
||||
#include "pm3_cmd.h"
|
||||
#include "util.h"
|
||||
|
||||
static int openAIDFile(json_t **root, bool verbose) {
|
||||
json_error_t error;
|
||||
@@ -111,6 +112,27 @@ static bool aidCompare(const char *aidlarge, const char *aidsmall) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool ResponseContainsMatch(const char *needle, const char *text) {
|
||||
if (needle == NULL || text == NULL || needle[0] == '\0' || text[0] == '\0') {
|
||||
return false;
|
||||
}
|
||||
|
||||
char *needle_lc = str_dup(needle);
|
||||
char *text_lc = str_dup(text);
|
||||
if (needle_lc == NULL || text_lc == NULL) {
|
||||
free(needle_lc);
|
||||
free(text_lc);
|
||||
return false;
|
||||
}
|
||||
|
||||
str_lower(needle_lc);
|
||||
str_lower(text_lc);
|
||||
bool matched = (strstr(text_lc, needle_lc) != NULL);
|
||||
free(needle_lc);
|
||||
free(text_lc);
|
||||
return matched;
|
||||
}
|
||||
|
||||
bool AIDGetFromElm(json_t *data, uint8_t *aid, size_t aidmaxlen, int *aidlen) {
|
||||
*aidlen = 0;
|
||||
const char *hexaid = jsonStrGet(data, "AID");
|
||||
@@ -124,7 +146,49 @@ bool AIDGetFromElm(json_t *data, uint8_t *aid, size_t aidmaxlen, int *aidlen) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AIDSeenBefore(json_t *root, const uint8_t *aid, size_t aidlen, size_t before_index) {
|
||||
if (root == NULL || aid == NULL || aidlen == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t limit = before_index;
|
||||
if (limit > json_array_size(root)) {
|
||||
limit = json_array_size(root);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < limit; i++) {
|
||||
json_t *data = AIDSearchGetElm(root, i);
|
||||
if (data == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
uint8_t prev_aid[200] = {0};
|
||||
int prev_aid_len = 0;
|
||||
if ((AIDGetFromElm(data, prev_aid, sizeof(prev_aid), &prev_aid_len) == false) || (prev_aid_len <= 0)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((size_t)prev_aid_len == aidlen && memcmp(prev_aid, aid, aidlen) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int PrintAIDDescription(json_t *xroot, char *aid, bool verbose) {
|
||||
return PrintAIDDescriptionEx(xroot, aid, NULL, 0, verbose);
|
||||
}
|
||||
|
||||
int PrintAIDDescriptionBuf(json_t *root, uint8_t *aid, size_t aidlen, bool verbose) {
|
||||
return PrintAIDDescription(root, sprint_hex_inrow(aid, aidlen), verbose);
|
||||
}
|
||||
|
||||
int PrintAIDDescriptionEx(json_t *xroot, char *aid, const uint8_t *response, size_t response_len, bool verbose) {
|
||||
if (aid == NULL || aid[0] == '\0') {
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int retval = PM3_SUCCESS;
|
||||
|
||||
json_t *root = xroot;
|
||||
@@ -135,50 +199,89 @@ int PrintAIDDescription(json_t *xroot, char *aid, bool verbose) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
json_t *elm = NULL;
|
||||
char *response_hex = NULL;
|
||||
if (response != NULL && response_len > 0) {
|
||||
if (response_len > ((SIZE_MAX - 1) / 2)) {
|
||||
goto out;
|
||||
}
|
||||
size_t response_hexlen = (response_len * 2) + 1;
|
||||
response_hex = calloc(response_hexlen, sizeof(char));
|
||||
if (response_hex == NULL) {
|
||||
goto out;
|
||||
}
|
||||
hex_to_buffer((uint8_t *)response_hex, response, response_len, response_hexlen - 1, 0, 0, true);
|
||||
}
|
||||
|
||||
json_t *fallback_elm = NULL;
|
||||
json_t *contains_elm = NULL;
|
||||
size_t maxaidlen = 0;
|
||||
|
||||
for (size_t elmindx = 0; elmindx < json_array_size(root); elmindx++) {
|
||||
json_t *data = AIDSearchGetElm(root, elmindx);
|
||||
if (data == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const char *dictaid = jsonStrGet(data, "AID");
|
||||
if (aidCompare(aid, dictaid)) { // dictaid may be less length than requested aid
|
||||
if (maxaidlen < strlen(dictaid) && strlen(dictaid) <= strlen(aid)) {
|
||||
maxaidlen = strlen(dictaid);
|
||||
elm = data;
|
||||
if (dictaid == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!aidCompare(aid, dictaid)) { // dictaid may be less length than requested aid
|
||||
continue;
|
||||
}
|
||||
|
||||
size_t dictaidlen = strlen(dictaid);
|
||||
if (dictaidlen > strlen(aid)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (dictaidlen > maxaidlen) {
|
||||
maxaidlen = dictaidlen;
|
||||
fallback_elm = data;
|
||||
contains_elm = NULL;
|
||||
} else if (dictaidlen < maxaidlen) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (response_hex != NULL) {
|
||||
const char *response_contains = jsonStrGet(data, "ResponseContains");
|
||||
if (response_contains && ResponseContainsMatch(response_contains, response_hex)) {
|
||||
contains_elm = data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (elm == NULL) {
|
||||
goto out;
|
||||
json_t *elm = contains_elm ? contains_elm : fallback_elm;
|
||||
if (elm != NULL) {
|
||||
const char *vaid = jsonStrGet(elm, "AID");
|
||||
const char *vendor = jsonStrGet(elm, "Vendor");
|
||||
const char *name = jsonStrGet(elm, "Name");
|
||||
const char *country = jsonStrGet(elm, "Country");
|
||||
const char *description = jsonStrGet(elm, "Description");
|
||||
const char *type = jsonStrGet(elm, "Type");
|
||||
|
||||
if (verbose == false) {
|
||||
PrintAndLogEx(SUCCESS, "AID : " _YELLOW_("%s") " | %s | %s", vaid, vendor, name);
|
||||
} else {
|
||||
PrintAndLogEx(SUCCESS, "Input AID..... " _YELLOW_("%s"), aid);
|
||||
if (aid)
|
||||
PrintAndLogEx(SUCCESS, "Found AID..... " _YELLOW_("%s"), vaid);
|
||||
if (vendor)
|
||||
PrintAndLogEx(SUCCESS, "Vendor........ " _YELLOW_("%s"), vendor);
|
||||
if (type)
|
||||
PrintAndLogEx(SUCCESS, "Type.......... " _YELLOW_("%s"), type);
|
||||
if (name)
|
||||
PrintAndLogEx(SUCCESS, "Name.......... " _YELLOW_("%s"), name);
|
||||
if (country)
|
||||
PrintAndLogEx(SUCCESS, "Country....... %s", country);
|
||||
if (description)
|
||||
PrintAndLogEx(SUCCESS, "Description... %s", description);
|
||||
}
|
||||
}
|
||||
|
||||
// print here
|
||||
const char *vaid = jsonStrGet(elm, "AID");
|
||||
const char *vendor = jsonStrGet(elm, "Vendor");
|
||||
const char *name = jsonStrGet(elm, "Name");
|
||||
const char *country = jsonStrGet(elm, "Country");
|
||||
const char *description = jsonStrGet(elm, "Description");
|
||||
const char *type = jsonStrGet(elm, "Type");
|
||||
|
||||
if (verbose == false) {
|
||||
PrintAndLogEx(SUCCESS, "AID : " _YELLOW_("%s") " | %s | %s", vaid, vendor, name);
|
||||
} else {
|
||||
PrintAndLogEx(SUCCESS, "Input AID..... " _YELLOW_("%s"), aid);
|
||||
if (aid)
|
||||
PrintAndLogEx(SUCCESS, "Found AID..... " _YELLOW_("%s"), vaid);
|
||||
if (vendor)
|
||||
PrintAndLogEx(SUCCESS, "Vendor........ " _YELLOW_("%s"), vendor);
|
||||
if (type)
|
||||
PrintAndLogEx(SUCCESS, "Type.......... " _YELLOW_("%s"), type);
|
||||
if (name)
|
||||
PrintAndLogEx(SUCCESS, "Name.......... " _YELLOW_("%s"), name);
|
||||
if (country)
|
||||
PrintAndLogEx(SUCCESS, "Country....... %s", country);
|
||||
if (description)
|
||||
PrintAndLogEx(SUCCESS, "Description... %s", description);
|
||||
if (response_hex != NULL) {
|
||||
free(response_hex);
|
||||
}
|
||||
|
||||
out:
|
||||
@@ -187,8 +290,3 @@ out:
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
int PrintAIDDescriptionBuf(json_t *root, uint8_t *aid, size_t aidlen, bool verbose) {
|
||||
return PrintAIDDescription(root, sprint_hex_inrow(aid, aidlen), verbose);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,10 +26,12 @@
|
||||
#include "jansson.h"
|
||||
|
||||
int PrintAIDDescription(json_t *xroot, char *aid, bool verbose);
|
||||
int PrintAIDDescriptionEx(json_t *xroot, char *aid, const uint8_t *response, size_t response_len, bool verbose);
|
||||
int PrintAIDDescriptionBuf(json_t *root, uint8_t *aid, size_t aidlen, bool verbose);
|
||||
json_t *AIDSearchInit(bool verbose);
|
||||
json_t *AIDSearchGetElm(json_t *root, size_t elmindx);
|
||||
bool AIDGetFromElm(json_t *data, uint8_t *aid, size_t aidmaxlen, int *aidlen);
|
||||
bool AIDSeenBefore(json_t *root, const uint8_t *aid, size_t aidlen, size_t before_index);
|
||||
int AIDSearchFree(json_t *root);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "cliparser.h"
|
||||
#include "generator.h" // generate nuid
|
||||
#include "iso14b.h" // defines for ETU conversions
|
||||
#include "util.h" // regex utility
|
||||
|
||||
static int CmdHelp(const char *Cmd);
|
||||
|
||||
@@ -1168,6 +1169,91 @@ static int CmdAnalyseUnits(const char *Cmd) {
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int CmdAnalyseRegex(const char *Cmd) {
|
||||
CLIParserContext *ctx;
|
||||
CLIParserInit(&ctx, "analyse regex",
|
||||
"Regex utility (subset: ^ $ . * with \\\\ escape)",
|
||||
"analyse regex --pattern '^A000' --text A000000476D0000111\n"
|
||||
"analyse regex --pattern '.*500A416E64726F6964506179.*9000$' --text 6F8150500A416E64726F69645061799000 --insensitive\n"
|
||||
"analyse regex --test"
|
||||
);
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_str0("p", "pattern", "<str>", "regex pattern"),
|
||||
arg_str0("d", "text", "<str>", "text to match"),
|
||||
arg_lit0("i", "insensitive", "case-insensitive match"),
|
||||
arg_lit0("t", "test", "run self tests"),
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
struct arg_str *arg_pattern = arg_get_str(ctx, 1);
|
||||
struct arg_str *arg_text = arg_get_str(ctx, 2);
|
||||
bool insensitive = arg_get_lit(ctx, 3);
|
||||
bool selftest = arg_get_lit(ctx, 4);
|
||||
|
||||
if (selftest) {
|
||||
CLIParserFree(ctx);
|
||||
|
||||
typedef struct {
|
||||
const char *pattern;
|
||||
const char *text;
|
||||
bool case_insensitive;
|
||||
bool expect_match;
|
||||
} regex_test_case_t;
|
||||
|
||||
const regex_test_case_t tests[] = {
|
||||
{.pattern = "^A000", .text = "A000000476D0000111", .case_insensitive = false, .expect_match = true},
|
||||
{.pattern = "9000$", .text = "6F009000", .case_insensitive = false, .expect_match = true},
|
||||
{.pattern = ".*500A416E64726F6964506179.*9000$", .text = "6F8150500A416E64726F69645061799000", .case_insensitive = true, .expect_match = true},
|
||||
{.pattern = "^a0.*$", .text = "A0000000", .case_insensitive = true, .expect_match = true},
|
||||
{.pattern = "^a0.*$", .text = "B0000000", .case_insensitive = true, .expect_match = false},
|
||||
{.pattern = "A\\*B", .text = "ZZA*BZZ", .case_insensitive = false, .expect_match = true},
|
||||
{.pattern = "A+B", .text = "AAAB", .case_insensitive = false, .expect_match = false},
|
||||
{.pattern = "*ABC", .text = "ABC", .case_insensitive = false, .expect_match = false},
|
||||
{.pattern = "ABC\\", .text = "ABC", .case_insensitive = false, .expect_match = false},
|
||||
};
|
||||
|
||||
bool all_ok = true;
|
||||
for (size_t i = 0; i < ARRAYLEN(tests); i++) {
|
||||
bool matched = tests[i].case_insensitive
|
||||
? str_regex_match_case_insensitive(tests[i].pattern, tests[i].text)
|
||||
: str_regex_match(tests[i].pattern, tests[i].text);
|
||||
|
||||
bool ok = (matched == tests[i].expect_match);
|
||||
PrintAndLogEx(ok ? SUCCESS : FAILED, "%zu. pattern=`%s` valid=%s match=%s ( %s )",
|
||||
i + 1,
|
||||
tests[i].pattern,
|
||||
"true",
|
||||
matched ? "true" : "false",
|
||||
ok ? _GREEN_("ok") : _RED_("fail"));
|
||||
if (!ok) {
|
||||
all_ok = false;
|
||||
}
|
||||
}
|
||||
|
||||
PrintAndLogEx(all_ok ? SUCCESS : FAILED, "Tests ( %s )", all_ok ? _GREEN_("ok") : _RED_("fail"));
|
||||
return all_ok ? PM3_SUCCESS : PM3_ESOFT;
|
||||
}
|
||||
|
||||
if (arg_pattern->count == 0 || arg_text->count == 0) {
|
||||
CLIParserFree(ctx);
|
||||
PrintAndLogEx(ERR, "pattern and text are required unless --test is used");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
const char *pattern = arg_pattern->sval[0];
|
||||
const char *text = arg_text->sval[0];
|
||||
|
||||
bool matched = insensitive
|
||||
? str_regex_match_case_insensitive(pattern, text)
|
||||
: str_regex_match(pattern, text);
|
||||
CLIParserFree(ctx);
|
||||
PrintAndLogEx(matched ? SUCCESS : INFO, "Regex match: %s", matched ? _GREEN_("true") : _YELLOW_("false"));
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static command_t CommandTable[] = {
|
||||
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
||||
{"lrc", CmdAnalyseLRC, AlwaysAvailable, "Generate final byte for XOR LRC"},
|
||||
@@ -1180,6 +1266,7 @@ static command_t CommandTable[] = {
|
||||
{"demodbuff", CmdAnalyseDemodBuffer, AlwaysAvailable, "Load binary string to DemodBuffer"},
|
||||
{"freq", CmdAnalyseFreq, AlwaysAvailable, "Calc wave lengths"},
|
||||
{"foo", CmdAnalyseFoo, AlwaysAvailable, "muxer"},
|
||||
{"regex", CmdAnalyseRegex, AlwaysAvailable, "Regex utility (subset: ^ $ . * with \\\\ escape)"},
|
||||
{"units", CmdAnalyseUnits, AlwaysAvailable, "convert ETU <> US <> SSP_CLK (3.39MHz)"},
|
||||
{NULL, NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
+69
-12
@@ -3982,24 +3982,71 @@ static int CmdQRcode(const char *Cmd) {
|
||||
CLIParserInit(&ctx, "data qrcode",
|
||||
"Generate a QR code with the input data",
|
||||
"data qrcode -f <filename>\n"
|
||||
"data qrcode -d 123456789\n"
|
||||
"data qrcode -d 0123456789\n"
|
||||
"data qrcode -d AABBCCDD --ascii\n"
|
||||
);
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_lit0("a", "ascii", "Render with ASCII-safe characters"),
|
||||
arg_str0("f", "file", "<fn>", "Specify a filename"),
|
||||
arg_str0("d", "data", "<hex>", "message as hex bytes"),
|
||||
arg_str0("d", "data", "<hex>", "message as a single hex byte string"),
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
|
||||
bool ascii = arg_get_lit(ctx, 1);
|
||||
int fnlen = 0;
|
||||
char filename[FILE_PATH_SIZE] = { 0 };
|
||||
CLIParamStrToBuf(arg_get_str(ctx, 1), (uint8_t *)filename, FILE_PATH_SIZE, &fnlen);
|
||||
CLIParamStrToBuf(arg_get_str(ctx, 2), (uint8_t *)filename, FILE_PATH_SIZE, &fnlen);
|
||||
|
||||
int dlen = 0;
|
||||
char data[1024] = { 0 };
|
||||
CLIParamStrToBuf(arg_get_str(ctx, 2), (uint8_t *)data, sizeof(data), &dlen);
|
||||
uint8_t data[512] = { 0 };
|
||||
int data_arg_len = 0;
|
||||
char data_arg[1024] = { 0 };
|
||||
struct arg_str *data_arg_str = arg_get_str(ctx, 3);
|
||||
int data_count = data_arg_str->count;
|
||||
|
||||
if (data_count > 1) {
|
||||
CLIParserFree(ctx);
|
||||
PrintAndLogEx(ERR, "QR data accepts exactly one -d value. Use a single contiguous hex string and encode spaces as 20.");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
if (data_count == 1) {
|
||||
if (CLIParamStrToBuf(data_arg_str, (uint8_t *)data_arg, sizeof(data_arg), &data_arg_len) != 0) {
|
||||
CLIParserFree(ctx);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
if (strpbrk(data_arg, " \t") != NULL) {
|
||||
CLIParserFree(ctx);
|
||||
PrintAndLogEx(ERR, "QR data must be one contiguous hex string. Spaces are not supported; encode a space byte as 20.");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
for (int i = 0; i < data_arg_len; i++) {
|
||||
if (isxdigit((unsigned char)data_arg[i]) == 0) {
|
||||
CLIParserFree(ctx);
|
||||
PrintAndLogEx(ERR, "QR data must contain only hex characters 0-9, a-f, or A-F.");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
}
|
||||
|
||||
if (data_arg_len & 1) {
|
||||
CLIParserFree(ctx);
|
||||
PrintAndLogEx(ERR, "QR data must contain an even number of hex digits.");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
dlen = hex_to_bytes(data_arg, data, sizeof(data));
|
||||
if (dlen < 0) {
|
||||
CLIParserFree(ctx);
|
||||
PrintAndLogEx(ERR, "QR data must be valid hex bytes.");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
}
|
||||
|
||||
CLIParserFree(ctx);
|
||||
|
||||
if (fnlen && dlen) {
|
||||
@@ -4028,17 +4075,27 @@ static int CmdQRcode(const char *Cmd) {
|
||||
}
|
||||
|
||||
if (dlen) {
|
||||
int8_t smallest_version = qrcode_getMinVersionForBytes(dlen, ECC_LOW);
|
||||
if (smallest_version < 1) {
|
||||
PrintAndLogEx(ERR, "QR data is too large to fit in a supported QR code.");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
// calc size of input data to get the correct
|
||||
int smallest_version = (dlen + 17) / 20;
|
||||
uint8_t qr_arr[qrcode_getBufferSize(smallest_version)];
|
||||
qrcode_initText(&qrcode, qr_arr, smallest_version, ECC_LOW, (char *) data);
|
||||
if (qrcode_initBytes(&qrcode, qr_arr, smallest_version, ECC_LOW, data, dlen) < 0) {
|
||||
PrintAndLogEx(ERR, "Failed to encode QR data.");
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
qrcode_print_matrix_utf8(&qrcode);
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
qrcode_print_matrix_utf8_2x2(&qrcode);
|
||||
if (ascii) {
|
||||
qrcode_print_matrix_ascii(&qrcode);
|
||||
} else {
|
||||
qrcode_print_matrix_utf8(&qrcode);
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
qrcode_print_matrix_utf8_2x2(&qrcode);
|
||||
}
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
}
|
||||
|
||||
|
||||
+21
-8
@@ -618,7 +618,7 @@ static const char *get_uid_type(iso14a_card_select_t *card) {
|
||||
|
||||
int Hf14443_4aGetCardData(iso14a_card_select_t *card) {
|
||||
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) {
|
||||
PrintAndLogEx(WARNING, "timeout while waiting for reply");
|
||||
@@ -695,9 +695,10 @@ static int CmdHF14AReader(const char *Cmd) {
|
||||
|
||||
bool silent = arg_get_lit(ctx, 2);
|
||||
|
||||
uint32_t cm = ISO14A_CONNECT;
|
||||
uint32_t cm = ISO14A_CONNECT | ISO14A_CLEARTRACE;
|
||||
if (arg_get_lit(ctx, 3)) {
|
||||
cm &= ~ISO14A_CONNECT;
|
||||
cm &= ~ISO14A_CLEARTRACE;
|
||||
}
|
||||
|
||||
if (arg_get_lit(ctx, 4)) {
|
||||
@@ -872,7 +873,7 @@ static int CmdHF14ACUIDs(const char *Cmd) {
|
||||
}
|
||||
|
||||
// execute anticollision procedure
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_RATS, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE | ISO14A_NO_RATS, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) {
|
||||
@@ -1225,9 +1226,9 @@ int SelectCard14443A_4_WithParameters(bool disconnect, bool verbose, iso14a_card
|
||||
// Anticollision + SELECT card
|
||||
PacketResponseNG resp;
|
||||
if (polling_parameters != NULL) {
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_DISCONNECT | ISO14A_USE_CUSTOM_POLLING, 0, 0, (uint8_t *)polling_parameters, sizeof(iso14a_polling_parameters_t));
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE | ISO14A_NO_DISCONNECT | ISO14A_USE_CUSTOM_POLLING, 0, 0, (uint8_t *)polling_parameters, sizeof(iso14a_polling_parameters_t));
|
||||
} else {
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0);
|
||||
}
|
||||
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 2000) == false) {
|
||||
@@ -1719,6 +1720,7 @@ static int CmdHF14ACmdRaw(const char *Cmd) {
|
||||
|
||||
if (active || active_select) {
|
||||
flags |= ISO14A_CONNECT;
|
||||
flags |= ISO14A_CLEARTRACE;
|
||||
if (active)
|
||||
flags |= ISO14A_NO_SELECT;
|
||||
}
|
||||
@@ -2695,7 +2697,7 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
|
||||
}
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) {
|
||||
PrintAndLogEx(DEBUG, "iso14443a card select timeout");
|
||||
@@ -2912,7 +2914,7 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
|
||||
|
||||
// reconnect for further tests
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0);
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) {
|
||||
PrintAndLogEx(WARNING, "timeout while waiting for reply");
|
||||
DropField();
|
||||
@@ -3182,6 +3184,9 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
|
||||
if ((AIDGetFromElm(data, vaid, sizeof(vaid), &vaidlen) == false) || (vaidlen == 0)) {
|
||||
continue;
|
||||
}
|
||||
if (AIDSeenBefore(root, vaid, (size_t)vaidlen, elmindx)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
uint16_t sw = 0;
|
||||
uint8_t result[1024] = {0};
|
||||
@@ -3214,7 +3219,15 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
|
||||
if (verbose) PrintAndLogEx(WARNING, "Application ( " _RED_("blocked") " )");
|
||||
}
|
||||
|
||||
PrintAIDDescriptionBuf(root, vaid, vaidlen, verbose);
|
||||
uint8_t response_for_match[1026] = {0};
|
||||
size_t response_for_match_len = resultlen;
|
||||
memcpy(response_for_match, result, MIN(resultlen, sizeof(response_for_match)));
|
||||
if ((response_for_match_len + 2) <= sizeof(response_for_match)) {
|
||||
response_for_match[response_for_match_len] = sw >> 8;
|
||||
response_for_match[response_for_match_len + 1] = sw & 0xff;
|
||||
response_for_match_len += 2;
|
||||
}
|
||||
PrintAIDDescriptionEx(root, sprint_hex_inrow(vaid, vaidlen), response_for_match, response_for_match_len, verbose);
|
||||
|
||||
if (dfnamelen) {
|
||||
if (dfnamelen == vaidlen) {
|
||||
|
||||
@@ -122,6 +122,9 @@ static void hf14b_aid_search(bool verbose) {
|
||||
if ((AIDGetFromElm(data, vaid, sizeof(vaid), &vaidlen) == false) || (vaidlen == 0)) {
|
||||
continue;
|
||||
}
|
||||
if (AIDSeenBefore(root, vaid, (size_t)vaidlen, elmindx)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// COMPUTE APDU
|
||||
@@ -172,7 +175,7 @@ static void hf14b_aid_search(bool verbose) {
|
||||
}
|
||||
}
|
||||
|
||||
PrintAIDDescriptionBuf(root, vaid, vaidlen, verbose);
|
||||
PrintAIDDescriptionEx(root, sprint_hex_inrow(vaid, vaidlen), result, (size_t)resultlen, verbose);
|
||||
|
||||
if (dfnamelen) {
|
||||
if (dfnamelen == vaidlen) {
|
||||
|
||||
@@ -111,7 +111,7 @@ static int fudan_get_type(iso14a_card_select_t *card, bool verbose) {
|
||||
}
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) {
|
||||
PrintAndLogEx(DEBUG, "iso14443a card select timeout");
|
||||
|
||||
@@ -1048,7 +1048,7 @@ static int hfgal_write_classic_card(GallagherCredentials_t *creds, uint8_t cred_
|
||||
clearCommandBuffer();
|
||||
|
||||
// Select card to get UID
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) {
|
||||
PrintAndLogEx(ERR, "Card select timeout");
|
||||
@@ -1177,7 +1177,7 @@ static int hfgal_read_classic_card(uint8_t *site_key, bool verbose, bool quiet)
|
||||
GallagherCredentials_t creds = {0};
|
||||
|
||||
// Select card
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) {
|
||||
if (!quiet) {
|
||||
|
||||
@@ -403,7 +403,7 @@ static int ict_select_card(iso14a_card_select_t *card) {
|
||||
}
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) {
|
||||
return PM3_ESOFT;
|
||||
|
||||
@@ -107,7 +107,7 @@ static void lto_switch_off_field(void) {
|
||||
}
|
||||
|
||||
static void lto_switch_on_field(void) {
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_SELECT | ISO14A_NO_DISCONNECT | ISO14A_NO_RATS, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE | ISO14A_NO_SELECT | ISO14A_NO_DISCONNECT | ISO14A_NO_RATS, 0, 0, NULL, 0);
|
||||
}
|
||||
|
||||
// send a raw LTO-CM command, returns the length of the response (0 in case of error)
|
||||
|
||||
+11
-11
@@ -369,7 +369,7 @@ int mfc_ev1_print_signature(uint8_t *uid, uint8_t uidlen, uint8_t *signature, in
|
||||
|
||||
int mf_read_uid(uint8_t *uid, int *uidlen, int *nxptype) {
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) {
|
||||
PrintAndLogEx(DEBUG, "iso14443a card select failed");
|
||||
@@ -897,7 +897,7 @@ static int mfc_read_tag(iso14a_card_select_t *card, uint8_t *carddata, uint8_t n
|
||||
|
||||
// Select card to get UID/UIDLEN/ATQA/SAK information
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 1500) == false) {
|
||||
PrintAndLogEx(DEBUG, "iso14443a card select timeout");
|
||||
@@ -3059,7 +3059,7 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
|
||||
|
||||
// Select card to get UID/UIDLEN/ATQA/SAK information
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 1500) == false) {
|
||||
PrintAndLogEx(DEBUG, "iso14443a card select timeout");
|
||||
@@ -6287,7 +6287,7 @@ static int CmdHF14AMfCSave(const char *Cmd) {
|
||||
|
||||
// Select card to get UID/UIDLEN information
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 1500) == false) {
|
||||
PrintAndLogEx(DEBUG, "iso14443a card select timeout");
|
||||
@@ -6437,7 +6437,7 @@ static int CmdHF14AMfCView(const char *Cmd) {
|
||||
|
||||
// Select card to get UID/UIDLEN information
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 1500) == false) {
|
||||
PrintAndLogEx(DEBUG, "iso14443a card select timeout");
|
||||
@@ -7289,7 +7289,7 @@ int CmdHFMFNDEFFormat(const char *Cmd) {
|
||||
|
||||
// Select card to get UID/UIDLEN/ATQA/SAK information
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 1500) == false) {
|
||||
PrintAndLogEx(DEBUG, "iso14443a card select timeout");
|
||||
@@ -8023,7 +8023,7 @@ static int CmdHf14AMfSuperCard(const char *Cmd) {
|
||||
for (i = 0; i < FURUI_MAX_TRACES; i++) {
|
||||
|
||||
uint8_t data[] = {0xAA, 0xA8, 0x00, i};
|
||||
uint32_t flags = ISO14A_CONNECT | ISO14A_RAW | ISO14A_APPEND_CRC | ISO14A_NO_RATS;
|
||||
uint32_t flags = ISO14A_CONNECT | ISO14A_CLEARTRACE | ISO14A_RAW | ISO14A_APPEND_CRC | ISO14A_NO_RATS;
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, flags, sizeof(data), 0, data, sizeof(data));
|
||||
if (WaitForResponseTimeout(CMD_ACK, NULL, 1500) == false) {
|
||||
@@ -8054,7 +8054,7 @@ static int CmdHf14AMfSuperCard(const char *Cmd) {
|
||||
for (i = 0; i < SUPER_MAX_TRACES; i++) {
|
||||
|
||||
uint8_t data[] = {0x30, i};
|
||||
uint32_t flags = ISO14A_CONNECT | ISO14A_RAW | ISO14A_APPEND_CRC | ISO14A_NO_RATS;
|
||||
uint32_t flags = ISO14A_CONNECT | ISO14A_CLEARTRACE | ISO14A_RAW | ISO14A_APPEND_CRC | ISO14A_NO_RATS;
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, flags, sizeof(data), 0, data, sizeof(data));
|
||||
if (WaitForResponseTimeout(CMD_ACK, NULL, 1500) == false) {
|
||||
@@ -9271,7 +9271,7 @@ static int CmdHF14AGen4Save(const char *Cmd) {
|
||||
|
||||
// Select card to get UID/UIDLEN information
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 1500) == false) {
|
||||
PrintAndLogEx(DEBUG, "iso14443a card select timeout");
|
||||
@@ -10268,7 +10268,7 @@ static int CmdHF14AMfInfo(const char *Cmd) {
|
||||
}
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) {
|
||||
PrintAndLogEx(DEBUG, "iso14443a card select timeout");
|
||||
@@ -10830,7 +10830,7 @@ static int CmdHF14AMfISEN(const char *Cmd) {
|
||||
}
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) {
|
||||
PrintAndLogEx(DEBUG, "iso14443a card select timeout");
|
||||
|
||||
@@ -1514,7 +1514,7 @@ static int CmdHF14aDesChk(const char *Cmd) {
|
||||
if ((jsonnamelen > 0) && result) {
|
||||
DropField();
|
||||
// MIFARE DESFire info
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) {
|
||||
PrintAndLogEx(WARNING, "timeout while waiting for reply");
|
||||
|
||||
@@ -221,7 +221,7 @@ static int mfp_read_card_id(iso14a_card_select_t *card, int *nxptype) {
|
||||
}
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) {
|
||||
PrintAndLogEx(DEBUG, "iso14443a card select failed");
|
||||
@@ -383,7 +383,7 @@ static int CmdHFMFPInfo(const char *Cmd) {
|
||||
PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") " ---------------------------");
|
||||
|
||||
// Mifare Plus info
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 2000) == false) {
|
||||
PrintAndLogEx(DEBUG, "iso14443a card select timeout");
|
||||
|
||||
@@ -329,7 +329,7 @@ int ul_read_uid(uint8_t *uid) {
|
||||
}
|
||||
// read uid from tag
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_RATS, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE | ISO14A_NO_RATS, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) {
|
||||
PrintAndLogEx(WARNING, "timeout while waiting for reply");
|
||||
@@ -358,7 +358,7 @@ int ul_read_uid(uint8_t *uid) {
|
||||
|
||||
static void ul_switch_on_field(void) {
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_DISCONNECT | ISO14A_NO_RATS, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE | ISO14A_NO_DISCONNECT | ISO14A_NO_RATS, 0, 0, NULL, 0);
|
||||
}
|
||||
|
||||
static int ul_send_cmd_raw(const uint8_t *cmd, uint8_t cmdlen, uint8_t *response, uint16_t responseLength, bool schann) {
|
||||
@@ -487,7 +487,7 @@ static int ulc_requestAuthentication(uint8_t *nonce, uint16_t nonceLength) {
|
||||
}
|
||||
|
||||
int mfuc_test_authentication_support(void) {
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) {
|
||||
PrintAndLogEx(DEBUG, "iso14443a card select timeout");
|
||||
@@ -2004,7 +2004,7 @@ static int mfulc_fingerprint(void) {
|
||||
// GT23SC4489
|
||||
uint8_t cmd3a[] = {0x26};
|
||||
uint8_t cmd3b[] = {0x30};
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_RAW | ISO14A_CONNECT | ISO14A_NO_SELECT | ISO14A_NO_DISCONNECT, 7 << 16, 0, cmd3a, sizeof(cmd3a));
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_RAW | ISO14A_CONNECT | ISO14A_CLEARTRACE | ISO14A_NO_SELECT | ISO14A_NO_DISCONNECT, 7 << 16, 0, cmd3a, sizeof(cmd3a));
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 500)) {
|
||||
if (resp.oldarg[0] == 2) {
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_RAW | ISO14A_NO_SELECT, sizeof(cmd3b), 0, cmd3b, sizeof(cmd3b));
|
||||
@@ -5187,7 +5187,7 @@ static int CmdHF14AMfUKeyGen(const char *Cmd) {
|
||||
if (read_tag) {
|
||||
// read uid from tag
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_RATS, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE | ISO14A_NO_RATS, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) {
|
||||
PrintAndLogEx(WARNING, "timeout while waiting for reply");
|
||||
|
||||
@@ -1128,7 +1128,7 @@ static void saflok_encode(
|
||||
// perhaps by creating a struct to avoid having to pass a length parameter.
|
||||
static int saflok_read_sector(int sector, uint8_t *secdata) {
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_CLEARTRACE, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) {
|
||||
PrintAndLogEx(DEBUG, "iso14443a card select failed");
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user