mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-04 07:11:10 +08:00
Merge remote-tracking branch 'upstream/master' into hf_mf_sim
This commit is contained in:
commit
e26677f841
2 changed files with 28 additions and 24 deletions
|
@ -1933,13 +1933,18 @@ void MifareCIdent() {
|
||||||
uint8_t isGen = 0;
|
uint8_t isGen = 0;
|
||||||
uint8_t rec[1] = {0x00};
|
uint8_t rec[1] = {0x00};
|
||||||
uint8_t recpar[1] = {0x00};
|
uint8_t recpar[1] = {0x00};
|
||||||
|
uint8_t rats[4] = { ISO14443A_CMD_RATS, 0x80, 0x31, 0x73 };
|
||||||
|
uint8_t *par = BigBuf_malloc(MAX_PARITY_SIZE);
|
||||||
|
uint8_t *buf = BigBuf_malloc(USB_CMD_DATA_SIZE);
|
||||||
|
uint8_t *uid = BigBuf_malloc(10);
|
||||||
|
uint32_t cuid = 0;
|
||||||
|
|
||||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||||
|
|
||||||
// Generation 1 test
|
// Generation 1 test
|
||||||
ReaderTransmitBitsPar(wupC1, 7, NULL, NULL);
|
ReaderTransmitBitsPar(wupC1, 7, NULL, NULL);
|
||||||
if (!ReaderReceive(rec, recpar) || (rec[0] != 0x0a)) {
|
if (!ReaderReceive(rec, recpar) || (rec[0] != 0x0a)) {
|
||||||
goto TEST2;
|
goto TEST2;
|
||||||
};
|
};
|
||||||
isGen = GEN_1B;
|
isGen = GEN_1B;
|
||||||
|
|
||||||
|
@ -1951,32 +1956,29 @@ void MifareCIdent() {
|
||||||
goto OUT;
|
goto OUT;
|
||||||
|
|
||||||
TEST2:
|
TEST2:
|
||||||
;
|
// reset card
|
||||||
/*
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||||
// Generation 2 test
|
SpinDelay(100);
|
||||||
|
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||||
// halt previous.
|
|
||||||
mifare_classic_halt(NULL, 0);
|
int res = iso14443a_select_card(uid, NULL, &cuid, true, 0, true);
|
||||||
|
if ( res == 2 ) {
|
||||||
//select
|
ReaderTransmit(rats, sizeof(rats), NULL);
|
||||||
if (!iso14443a_select_card(NULL, NULL, NULL, true, 0, true)) {
|
res = ReaderReceive(buf, par);
|
||||||
goto OUT;
|
if (memcmp(buf, "\x09\x78\x00\x91\x02\xDA\xBC\x19\x10\xF0\x05", 11) == 0) {
|
||||||
};
|
|
||||||
|
|
||||||
// MIFARE_CLASSIC_WRITEBLOCK 0xA0
|
|
||||||
// ACK 0x0a
|
|
||||||
uint16_t len = mifare_sendcmd_short(null, 1, 0xA0, 0, rec, recpar, NULL);
|
|
||||||
if ((len != 1) || (rec[0] != 0x0A)) {
|
|
||||||
isGen = GEN_2;
|
isGen = GEN_2;
|
||||||
};
|
goto OUT;
|
||||||
*/
|
}
|
||||||
|
if (memcmp(buf, "\x0D\x78\x00\x71\x02\x88\x49\xA1\x30\x20\x15\x06\x08\x56\x3D", 15) == 0) {
|
||||||
|
isGen = GEN_2;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
OUT:
|
OUT:
|
||||||
;
|
|
||||||
// removed the if, since some magic tags misbehavies and send an answer to it.
|
|
||||||
mifare_classic_halt_ex(NULL);
|
|
||||||
cmd_send(CMD_ACK, isGen, 0, 0, 0, 0);
|
cmd_send(CMD_ACK, isGen, 0, 0, 0, 0);
|
||||||
// turns off
|
// turns off
|
||||||
OnSuccessMagic();
|
OnSuccessMagic();
|
||||||
|
BigBuf_free();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnSuccessMagic() {
|
void OnSuccessMagic() {
|
||||||
|
|
|
@ -1027,7 +1027,9 @@ void detect_classic_magic(void) {
|
||||||
case 2:
|
case 2:
|
||||||
PrintAndLogEx(SUCCESS, "Answers to magic commands (GEN 1b): " _GREEN_("YES"));
|
PrintAndLogEx(SUCCESS, "Answers to magic commands (GEN 1b): " _GREEN_("YES"));
|
||||||
break;
|
break;
|
||||||
//case 4: PrintAndLogEx(SUCCESS, "Answers to magic commands (GEN 2): " _GREEN_("YES")); break;
|
case 4:
|
||||||
|
PrintAndLogEx(SUCCESS, "Answers to magic commands (GEN 2 / CUID): " _GREEN_("YES"));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
PrintAndLogEx(INFO, "Answers to magic commands: " _YELLOW_("NO"));
|
PrintAndLogEx(INFO, "Answers to magic commands: " _YELLOW_("NO"));
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue