mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 05:13:46 -07:00
use string instead
This commit is contained in:
parent
1e26d79ddd
commit
d6a0f8edac
1 changed files with 6 additions and 13 deletions
|
@ -3427,26 +3427,19 @@ static int CmdAtrLookup(const char *Cmd) {
|
||||||
arg_param_end
|
arg_param_end
|
||||||
};
|
};
|
||||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||||
int dlen = 64;
|
int dlen = 128;
|
||||||
uint8_t data[64];
|
uint8_t data[128 + 1];
|
||||||
CLIGetHexWithReturn(ctx, 1, data, &dlen);
|
CLIGetStrWithReturn(ctx, 1, data, &dlen);
|
||||||
|
|
||||||
// bool selftest = arg_get_lit(ctx, 2);
|
// bool selftest = arg_get_lit(ctx, 2);
|
||||||
CLIParserFree(ctx);
|
CLIParserFree(ctx);
|
||||||
// if (selftest) {
|
// if (selftest) {
|
||||||
// return atr_selftest();
|
// return atr_selftest();
|
||||||
// }
|
// }
|
||||||
// convert bytes to str.
|
PrintAndLogEx(INFO, "ISO7816-3 ATR... " _YELLOW_("%s"), data);
|
||||||
char *hexstr = calloc((dlen << 1) + 1, sizeof(uint8_t));
|
|
||||||
if (hexstr == NULL) {
|
|
||||||
PrintAndLogEx(WARNING, "failed to allocate memory");
|
|
||||||
return PM3_EMALLOC;
|
|
||||||
}
|
|
||||||
hex_to_buffer((uint8_t *)hexstr, data, dlen, (dlen << 1), 0, 0, true);
|
|
||||||
|
|
||||||
PrintAndLogEx(INFO, "ISO7816-3 ATR... " _YELLOW_("%s"), sprint_hex(data, dlen));
|
|
||||||
PrintAndLogEx(INFO, "Fingerprint...");
|
PrintAndLogEx(INFO, "Fingerprint...");
|
||||||
|
|
||||||
char *copy = str_dup(getAtrInfo(hexstr));
|
char *copy = str_dup(getAtrInfo((char*)data));
|
||||||
|
|
||||||
char * token = strtok(copy, "\n");
|
char * token = strtok(copy, "\n");
|
||||||
while ( token != NULL ) {
|
while ( token != NULL ) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue