Merge pull request #1222 from craftbyte/function/desfire-standalone

Fixed UID Stealer
This commit is contained in:
Philippe Teuwen 2021-03-15 01:21:53 +01:00 committed by GitHub
commit 139d934085
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 12 deletions

View file

@ -80,4 +80,4 @@ endif
# WITH_STANDALONE_HF_CRAFTBYTE
ifneq (,$(findstring WITH_STANDALONE_HF_CRAFTBYTE,$(APP_CFLAGS)))
SRC_STANDALONE = hf_craftbyte.c
endif
endif

View file

@ -9,7 +9,7 @@
//-----------------------------------------------------------------------------
/*
* `hf_basicbreak` scans a card
* `hf_craftyte` scans a card's UID and then emulates it in 14a
*/
#include "standalone.h"
@ -52,7 +52,6 @@ void RunMod(void) {
if (data_available()) break;
iso14a_card_select_t card;
card_clone_t clone;
SpinDelay(500);
@ -75,20 +74,15 @@ void RunMod(void) {
SpinDelay(500);
continue;
} else {
Dbprintf("Found card with SAQ: %02X, ATQA: %02X %02X, UID: ", card.sak, card.atqa[0], card.atqa[1]);
Dbprintf("Found card with SAK: %02X, ATQA: %02X %02X, UID: ", card.sak, card.atqa[0], card.atqa[1]);
Dbhexdump(card.uidlen, card.uid, 0);
clone.uidlen = card.uidlen;
clone.sak = card.sak;
clone.atqa[0] = card.atqa[0];
clone.atqa[1] = card.atqa[1];
memcpy(clone.uid, card.uid, card.uidlen);
state = STATE_EMUL;
}
} else if (state == STATE_EMUL) {
uint8_t flags;
if (clone.uidlen == 4) flags |= FLAG_4B_UID_IN_DATA;
else if (clone.uidlen == 7) flags |= FLAG_7B_UID_IN_DATA;
else if (clone.uidlen == 10) flags |= FLAG_10B_UID_IN_DATA;
if (card.uidlen == 4) flags |= FLAG_4B_UID_IN_DATA;
else if (card.uidlen == 7) flags |= FLAG_7B_UID_IN_DATA;
else if (card.uidlen == 10) flags |= FLAG_10B_UID_IN_DATA;
else {
Dbprintf("Unusual UID length, something is wrong. Try again please.");
state = STATE_READ;