diff --git a/examples/nfc-mfclassic.c b/examples/nfc-mfclassic.c index feb1147..b42efec 100644 --- a/examples/nfc-mfclassic.c +++ b/examples/nfc-mfclassic.c @@ -329,7 +329,6 @@ typedef enum { ACTION_READ, ACTION_WRITE, ACTION_EXTRACT, - ACTION_FINGERPRINT, ACTION_USAGE } action_t; @@ -347,9 +346,6 @@ print_usage (const char *pcProgramName) printf (" x - Extract payload (data blocks) from MFD\n"); printf (" - MiFare Dump (MFD) that contains wanted payload\n"); printf (" - Binary file where payload will be extracted\n"); - printf ("Or: "); - printf ("%s f\n", pcProgramName); - printf (" f - Fingerprinting of the Mifare Classic card type\n"); } int @@ -389,9 +385,6 @@ main (int argc, const char *argv[]) exit (EXIT_FAILURE); } atAction = ACTION_EXTRACT; - } else if (strcmp (command, "f") == 0) { - atAction = ACTION_FINGERPRINT; - bUseKeyFile = false; } switch (atAction) { @@ -434,8 +427,6 @@ main (int argc, const char *argv[]) } // printf("Successfully opened required files\n"); - // yes indeed we don't break here but code goes on next section... - case ACTION_FINGERPRINT: // Try to open the NFC reader pnd = nfc_connect (NULL); if (pnd == NULL) { @@ -523,63 +514,6 @@ main (int argc, const char *argv[]) } } else if (atAction == ACTION_WRITE) { write_card (); - } else if (atAction == ACTION_FINGERPRINT) { - printf ("Fingerprinting based on timings...\n"); - uint16_t cycles; - float diffc; - if (!nfc_configure (pnd, NDO_HANDLE_CRC, false)) { - nfc_disconnect (pnd); - break; - } - if (!nfc_configure (pnd, NDO_EASY_FRAMING, false)) { - nfc_disconnect (pnd); - break; - } - byte_t abtTx[4] = {0x60, 0x00}; - size_t szTx = sizeof(abtTx); - iso14443a_crc_append(abtTx, 2); - byte_t abtRx[4]; - size_t szRx = sizeof(abtRx); - if (!nfc_initiator_transceive_bytes_timed (pnd, abtTx, szTx, abtRx, &szRx, &cycles)) { - nfc_disconnect (pnd); - break; - } - if (szRx != 4) { - nfc_disconnect (pnd); - break; - } - diffc = cycles; - printf ("* Response to AuthA0 received in %.2f usecs ( %.0f / %2.2fMHz )\n", diffc / 13.56, diffc, 13.56); - struct mfc_candidate { - uint16_t autha0_cycles; - char *name; - }; - const struct mfc_candidate mfc_candidates[] = { - { 1752, "Emulation on JCOP41 V2.2.1 or Nokia 6131" }, - { 2008, "Regular Mifare Classic" }, - { 3544, "Emulation on P5CD144 EvalOS" }, - { 4316, "Emulation on JCOP31 V2.4.1 J3A080" }, - { 4568, "7-byte UID (Mifare Classic or MFP SL1)" }, - { 4696, "7-byte UID (Mifare Classic or MFP SL1)" }, - { 4824, "Mifare Plus SL1" }, - { 5850, "Emulation on JCOP31 V2.4.1 J3A080" }, - }; - int min_delta_cycles = 0xFFFF; - char * name = ""; - for (size_t n = 0; n < sizeof (mfc_candidates) / sizeof (struct mfc_candidate); n++) { - int delta_cycles = cycles - mfc_candidates[n].autha0_cycles; - if (delta_cycles < 0) - delta_cycles = - delta_cycles; - if (delta_cycles < min_delta_cycles) { - min_delta_cycles = delta_cycles; - name = mfc_candidates[n].name; - } - } - if (min_delta_cycles <= 8) { - printf(" ** Perfect match: %s\n", name); - } else { - printf(" ** Best match: %s, with diff of %i/%i (%.2f%%)\n", name, min_delta_cycles, cycles, ((float) min_delta_cycles * 100)/cycles); - } } nfc_disconnect (pnd);