This commit is contained in:
iceman1001 2025-03-12 16:48:30 +01:00
commit 06a1627a95
5 changed files with 47 additions and 47 deletions

View file

@ -239,11 +239,11 @@ int CLIParserParseStringEx(CLIParserContext *ctx, const char *str, void *vargtab
} else { } else {
// if (isSpace(str[i]) == false) { // if (isSpace(str[i]) == false) {
*bufptr++ = str[i]; *bufptr++ = str[i];
// } // }
} }
break; break;
} }
} }
if (bufptr > bufptrend) { if (bufptr > bufptrend) {

View file

@ -1228,57 +1228,57 @@ static int CmdExchangeAPDU(bool chainingin, const uint8_t *datain, int datainlen
return PM3_EAPDU_FAIL; return PM3_EAPDU_FAIL;
} }
const uint8_t *recv = resp.data.asBytes; const uint8_t *recv = resp.data.asBytes;
int iLen = resp.oldarg[0]; int iLen = resp.oldarg[0];
uint8_t res = resp.oldarg[1]; uint8_t res = resp.oldarg[1];
int dlen = iLen - 2; int dlen = iLen - 2;
if (dlen < 0) { if (dlen < 0) {
dlen = 0; dlen = 0;
} }
*dataoutlen += dlen; *dataoutlen += dlen;
if (maxdataoutlen && *dataoutlen > maxdataoutlen) { if (maxdataoutlen && *dataoutlen > maxdataoutlen) {
PrintAndLogEx(DEBUG, "ERR: APDU: Buffer too small(%d), needs %d bytes", *dataoutlen, maxdataoutlen); PrintAndLogEx(DEBUG, "ERR: APDU: Buffer too small(%d), needs %d bytes", *dataoutlen, maxdataoutlen);
return PM3_EAPDU_FAIL; return PM3_EAPDU_FAIL;
} }
// I-block ACK // I-block ACK
if ((res & 0xF2) == 0xA2) { if ((res & 0xF2) == 0xA2) {
*dataoutlen = 0; *dataoutlen = 0;
*chainingout = true; *chainingout = true;
return PM3_SUCCESS; return PM3_SUCCESS;
} }
if (iLen == 0) { if (iLen == 0) {
PrintAndLogEx(DEBUG, "ERR: APDU: No APDU response"); PrintAndLogEx(DEBUG, "ERR: APDU: No APDU response");
return PM3_EAPDU_FAIL; return PM3_EAPDU_FAIL;
} }
// check apdu length // check apdu length
if (iLen < 2 && iLen >= 0) { if (iLen < 2 && iLen >= 0) {
PrintAndLogEx(DEBUG, "ERR: APDU: Small APDU response, len %d", iLen); PrintAndLogEx(DEBUG, "ERR: APDU: Small APDU response, len %d", iLen);
return PM3_EAPDU_FAIL; return PM3_EAPDU_FAIL;
} }
// check block TODO // check block TODO
if (iLen == -2) { if (iLen == -2) {
PrintAndLogEx(DEBUG, "ERR: APDU: Block type mismatch"); PrintAndLogEx(DEBUG, "ERR: APDU: Block type mismatch");
return PM3_EAPDU_FAIL; return PM3_EAPDU_FAIL;
} }
memcpy(dataout, recv, dlen); memcpy(dataout, recv, dlen);
// chaining // chaining
if ((res & 0x10) != 0) { if ((res & 0x10) != 0) {
*chainingout = true; *chainingout = true;
} }
// CRC Check // CRC Check
if (iLen == -1) { if (iLen == -1) {
PrintAndLogEx(DEBUG, "ERR: APDU: ISO 14443A CRC error"); PrintAndLogEx(DEBUG, "ERR: APDU: ISO 14443A CRC error");
return PM3_EAPDU_FAIL; return PM3_EAPDU_FAIL;
} }
return PM3_SUCCESS; return PM3_SUCCESS;
} }

View file

@ -464,7 +464,7 @@ int applyIso14443a(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool i
} else { } else {
return PM3_ESOFT; return PM3_ESOFT;
} }
} }
} }
} else { } else {
@ -1798,7 +1798,7 @@ void annotateSeos(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool is
default: { default: {
pos = 2; pos = 2;
break; break;
} }
} }
if (memcmp(cmd + pos, "\x00\xA4\x04\x00", 4) == 0) { if (memcmp(cmd + pos, "\x00\xA4\x04\x00", 4) == 0) {

View file

@ -1305,7 +1305,7 @@ int detect_num_CPUs(void) {
void str_lower(char *s) { void str_lower(char *s) {
for (size_t i = 0; i < strlen(s); i++) { for (size_t i = 0; i < strlen(s); i++) {
s[i] = tolower(s[i]); s[i] = tolower(s[i]);
} }
} }
void str_upper(char *s) { void str_upper(char *s) {
@ -1315,7 +1315,7 @@ void str_upper(char *s) {
void strn_upper(char *s, size_t n) { void strn_upper(char *s, size_t n) {
for (size_t i = 0; i < n; i++) { for (size_t i = 0; i < n; i++) {
s[i] = toupper(s[i]); s[i] = toupper(s[i]);
} }
} }
// check for prefix in string // check for prefix in string
bool str_startswith(const char *s, const char *pre) { bool str_startswith(const char *s, const char *pre) {
@ -1352,9 +1352,9 @@ void str_creplace(char *buf, size_t len, char from, char to) {
for (size_t i = 0; i < len; i++) { for (size_t i = 0; i < len; i++) {
if (buf[i] == from) { if (buf[i] == from) {
buf[i] = to; buf[i] = to;
}
} }
} }
}
char *str_dup(const char *src) { char *str_dup(const char *src) {
return str_ndup(src, strlen(src)); return str_ndup(src, strlen(src));

View file

@ -13232,6 +13232,6 @@
"metadata": { "metadata": {
"commands_extracted": 760, "commands_extracted": 760,
"extracted_by": "PM3Help2JSON v1.00", "extracted_by": "PM3Help2JSON v1.00",
"extracted_on": "2025-03-12T08:23:41" "extracted_on": "2025-03-12T15:46:33"
} }
} }