This commit is contained in:
iceman1001 2019-08-05 12:01:11 -04:00
commit 25748b0746
2 changed files with 57 additions and 57 deletions

View file

@ -888,8 +888,8 @@ void RAMFUNC SniffIClass(void) {
for (;;) { for (;;) {
WDT_HIT(); WDT_HIT();
if ( checked == 1000 ) { if (checked == 1000) {
if (BUTTON_PRESS() || data_available() ) break; if (BUTTON_PRESS() || data_available()) break;
checked = 0; checked = 0;
} else { } else {
checked++; checked++;
@ -1009,8 +1009,8 @@ static bool GetIClassCommandFromReader(uint8_t *received, int *len, int maxLen)
WDT_HIT(); WDT_HIT();
if ( checked == 1000 ) { if (checked == 1000) {
if( BUTTON_PRESS() || data_available() ) return false; if (BUTTON_PRESS() || data_available()) return false;
checked = 0; checked = 0;
} else { } else {
checked++; checked++;
@ -1665,8 +1665,8 @@ static int SendIClassAnswer(uint8_t *resp, int respLen, uint16_t delay) {
uint16_t checked = 0; uint16_t checked = 0;
for (;;) { for (;;) {
if ( checked == 1000 ) { if (checked == 1000) {
if ( BUTTON_PRESS() || data_available()) return 0; if (BUTTON_PRESS() || data_available()) return 0;
checked = 0; checked = 0;
} else { } else {
checked++; checked++;
@ -1842,7 +1842,7 @@ static int GetIClassAnswer(uint8_t *receivedResponse, int maxLen, int *samples,
for (;;) { for (;;) {
WDT_HIT(); WDT_HIT();
if ( checked == 1000 ) { if (checked == 1000) {
if (BUTTON_PRESS() || data_available()) return false; if (BUTTON_PRESS() || data_available()) return false;
checked = 0; checked = 0;
} else { } else {
@ -2140,7 +2140,7 @@ void ReaderIClass(uint8_t arg0) {
} }
LED_B_OFF(); LED_B_OFF();
if ( checked == 1000 ) { if (checked == 1000) {
userCancelled = BUTTON_PRESS() || data_available(); userCancelled = BUTTON_PRESS() || data_available();
checked = 0; checked = 0;
} else { } else {
@ -2344,7 +2344,7 @@ void iClass_Authentication_fast(uint64_t arg0, uint64_t arg1, uint8_t *datain) {
uint8_t startup_limit = 10; uint8_t startup_limit = 10;
while (read_status != 2) { while (read_status != 2) {
if ( checked == 1000 ) { if (checked == 1000) {
if (BUTTON_PRESS() || !data_available()) goto out; if (BUTTON_PRESS() || !data_available()) goto out;
checked = 0; checked = 0;
} else { } else {
@ -2364,7 +2364,7 @@ void iClass_Authentication_fast(uint64_t arg0, uint64_t arg1, uint8_t *datain) {
for (i = 0; i < keyCount; i++) { for (i = 0; i < keyCount; i++) {
// Allow button press / usb cmd to interrupt device // Allow button press / usb cmd to interrupt device
if ( checked == 1000 ) { if (checked == 1000) {
if (BUTTON_PRESS() || !data_available()) goto out; if (BUTTON_PRESS() || !data_available()) goto out;
checked = 0; checked = 0;
} else { } else {

View file

@ -156,9 +156,9 @@ static int CmdLFNedapDemod(const char *Cmd) {
subtype = (data[1] & 0x1e) >> 1; subtype = (data[1] & 0x1e) >> 1;
customerCode = ((data[1] & 0x01) << 11) | (data[2] << 3) | ((data[3] & 0xe0) >> 5); customerCode = ((data[1] & 0x01) << 11) | (data[2] << 3) | ((data[3] & 0xe0) >> 5);
if ( isValid == false ) { if (isValid == false) {
PrintAndLogEx(ERR, "Checksum : %s (calc 0x%04X != 0x%04X)", _RED_("failed"), checksum, *(uint16_t *)(buffer + 5)); PrintAndLogEx(ERR, "Checksum : %s (calc 0x%04X != 0x%04X)", _RED_("failed"), checksum, *(uint16_t *)(buffer + 5));
ret = PM3_ESOFT; ret = PM3_ESOFT;
} }
idxC1 = invTranslateTable[(data[3] & 0x1e) >> 1]; idxC1 = invTranslateTable[(data[3] & 0x1e) >> 1];
@ -178,8 +178,8 @@ static int CmdLFNedapDemod(const char *Cmd) {
badgeId = r1 * 10000 + r2 * 1000 + r3 * 100 + r4 * 10 + r5; badgeId = r1 * 10000 + r2 * 1000 + r3 * 100 + r4 * 10 + r5;
PrintAndLogEx(SUCCESS, "NEDAP Tag Found: Card ID "_YELLOW_("%05u")" subtype: "_YELLOW_("%1u")" customer code: "_YELLOW_("%03x"), badgeId, subtype, customerCode); PrintAndLogEx(SUCCESS, "NEDAP Tag Found: Card ID "_YELLOW_("%05u")" subtype: "_YELLOW_("%1u")" customer code: "_YELLOW_("%03x"), badgeId, subtype, customerCode);
PrintAndLogEx(SUCCESS, "Checksum is %s (0x%04X)", _GREEN_("OK"), checksum ); PrintAndLogEx(SUCCESS, "Checksum is %s (0x%04X)", _GREEN_("OK"), checksum);
PrintAndLogEx(SUCCESS, "Raw: %s", sprint_hex(data, size/8)); PrintAndLogEx(SUCCESS, "Raw: %s", sprint_hex(data, size / 8));
} else { } else {
PrintAndLogEx(ERR, "Invalid idx (1:%02x - 2:%02x - 3:%02x - 4:%02x - 5:%02x)", idxC1, idxC2, idxC3, idxC4, idxC5); PrintAndLogEx(ERR, "Invalid idx (1:%02x - 2:%02x - 3:%02x - 4:%02x - 5:%02x)", idxC1, idxC2, idxC3, idxC4, idxC5);
ret = PM3_ESOFT; ret = PM3_ESOFT;
@ -195,13 +195,13 @@ static int CmdLFNedapDemod(const char *Cmd) {
} }
// validation // validation
if ( (data[8] & 0x80) if ((data[8] & 0x80)
&& (data[9] & 0x40) && (data[9] & 0x40)
&& (data[10] & 0x20) && (data[10] & 0x20)
&& (data[11] & 0x10) && (data[11] & 0x10)
&& (data[12] & 0x08) && (data[12] & 0x08)
&& (data[13] & 0x04) && (data[13] & 0x04)
&& (data[14] & 0x02)) { && (data[14] & 0x02)) {
PrintAndLogEx(ERR, "Bad zeros"); PrintAndLogEx(ERR, "Bad zeros");
return ret; return ret;
} }
@ -402,7 +402,7 @@ static int CmdLfNedapGen(const char *Cmd) {
, subType , subType
, customerCode , customerCode
, id , id
); );
NedapGen(subType, customerCode, id, isLong, data); NedapGen(subType, customerCode, id, isLong, data);
@ -479,7 +479,7 @@ int CmdLFNedapClone(const char *Cmd) {
} }
// TODO info correct? // TODO info correct?
PrintAndLogEx(INFO, "The block 0 was changed (eXtended) which can be hard to detect. Configure it manually with"); PrintAndLogEx(INFO, "The block 0 was changed (eXtended) which can be hard to detect. Configure it manually with");
PrintAndLogEx(INFO, _YELLOW_("`lf t55xx config b 64 d BI i 1 o 32`") ); PrintAndLogEx(INFO, _YELLOW_("`lf t55xx config b 64 d BI i 1 o 32`"));
return PM3_SUCCESS; return PM3_SUCCESS;
} }