utils/nfc-mfclassic: remove non-conscistent "extract payload" option in nfc-mfclassic and use MIFARE instead of Mifare typo (Thanks to Thomas Hood)

This commit is contained in:
Romuald Conty 2012-02-15 13:41:38 +00:00
parent e9bd9e4b67
commit 75e776ffd0
2 changed files with 7 additions and 59 deletions

View file

@ -12,29 +12,29 @@ nfc-mfclassic \- MIFARE Classic command line tool
.B nfc-mfclassic
is a MIFARE Classic tool that allow to read or write
.IR DUMP
file using Mifare keys provided in
file using MIFARE keys provided in
.IR KEYS
file.
MIFARE Classic tag is one of the most widely used RFID tags.
The firmware in the NFC controller supports authenticating, reading and writing
to/from Mifare Classic tags. This tool demonstrates the speed of this library
to/from MIFARE Classic tags. This tool demonstrates the speed of this library
and its ease-of-use. It's possible to read and write the complete content of a
Mifare Classic 4KB tag within 1 second. It uses a binary Mifare Dump file (MFD)
MIFARE Classic 4KB tag within 1 second. It uses a binary MIFARE Dump file (MFD)
to store the keys and data for all sectors.
Be cautious that some parts of a Mifare Classic memory are used for r/w access
Be cautious that some parts of a MIFARE Classic memory are used for r/w access
of the rest of the memory, so please read the tag documentation before experimenting too much!
The 'W' option allows writing of special Mifare cards that can be 'unlocked' to allow block 0
The 'W' option allows writing of special MIFARE cards that can be 'unlocked' to allow block 0
to be overwritten. This includes UID and manufacturer data. Take care when amending UIDs to set
the correct BCC (UID checksum). Currently only 4 byte UIDs are supported.
Similarly, the 'R' option allows an 'unlocked' read. This bypasses authentication and allows
reading of the Key A and Key B data regardless of ACLs.
*** Note that 'W' and 'R' options only work on special versions of Mifare 1K cards (Chinese clones).
*** Note that 'W' and 'R' options only work on special versions of MIFARE 1K cards (Chinese clones).
.SH OPTIONS
.BR r " | " R " | " w " | " W
@ -49,7 +49,7 @@ Perform read from (
) card.
.TP
.BR a " | " b
Use A or B Mifare keys.
Use A or B MIFARE keys.
.TP
.IR DUMP
MiFare Dump (MFD) used to write (card to MFD) or (MFD to card)

View file

@ -431,7 +431,6 @@ mifare_classic_extract_payload (const char *abDump, char *pbPayload)
typedef enum {
ACTION_READ,
ACTION_WRITE,
ACTION_EXTRACT,
ACTION_USAGE
} action_t;
@ -447,11 +446,6 @@ print_usage (const char *pcProgramName)
printf (" a|b - Use A or B keys for action\n");
printf (" <dump.mfd> - MiFare Dump (MFD) used to write (card to MFD) or (MFD to card)\n");
printf (" <keys.mfd> - MiFare Dump (MFD) that contain the keys (optional)\n");
printf ("Or: ");
printf ("%s x <dump.mfd> <payload.bin>\n", pcProgramName);
printf (" x - Extract payload (data blocks) from MFD\n");
printf (" <dump.mfd> - MiFare Dump (MFD) that contains wanted payload\n");
printf (" <payload.bin> - Binary file where payload will be extracted\n");
}
int
@ -489,12 +483,6 @@ main (int argc, const char *argv[])
unlock= 1;
bUseKeyA = tolower ((int) ((unsigned char) *(argv[2]))) == 'a';
bUseKeyFile = (argc > 4);
} else if (strcmp (command, "x") == 0) {
if (argc < 4) {
print_usage (argv[0]);
exit (EXIT_FAILURE);
}
atAction = ACTION_EXTRACT;
}
switch (atAction) {
@ -623,46 +611,6 @@ main (int argc, const char *argv[])
nfc_close (pnd);
break;
case ACTION_EXTRACT:{
const char *pcDump = argv[2];
const char *pcPayload = argv[3];
FILE *pfDump = NULL;
FILE *pfPayload = NULL;
char abDump[4096];
char abPayload[4096];
pfDump = fopen (pcDump, "rb");
if (pfDump == NULL) {
printf ("Could not open dump file: %s\n", pcDump);
exit (EXIT_FAILURE);
}
if (fread (abDump, 1, sizeof (abDump), pfDump) != sizeof (abDump)) {
printf ("Could not read dump file: %s\n", pcDump);
fclose (pfDump);
exit (EXIT_FAILURE);
}
fclose (pfDump);
mifare_classic_extract_payload (abDump, abPayload);
printf ("Writing data to file: %s\n", pcPayload);
pfPayload = fopen (pcPayload, "wb");
if (pfPayload == NULL) {
printf ("Could not open file %s for writting.\n", pcPayload);
exit (EXIT_FAILURE);
}
if (fwrite (abPayload, 1, sizeof (abPayload), pfPayload) != sizeof (abPayload)) {
printf ("Could not write to file: %s\n", pcPayload);
exit (EXIT_FAILURE);
}
fclose (pfPayload);
printf ("Done, all bytes have been extracted!\n");
}
};
nfc_exit (NULL);