[libfreefare] 2 new revisions pushed by yob...@gmail.com on 2013-06-20 12:28 GMT

3 views
Skip to first unread message

libfr...@googlecode.com

unread,
Jun 20, 2013, 8:28:53 AM6/20/13
to nfc-tool...@googlegroups.com
2 new revisions:

Revision: cc36619f132e
Author: Dominik Heidler <dhei...@gmail.com>
Date: Fri May 3 00:58:22 2013
Log: mifare-classic-format option: read keys from dump
http://code.google.com/p/libfreefare/source/detail?r=cc36619f132e

Revision: ea496c441d23
Author: Philippe Teuwen <yob...@gmail.com>
Date: Thu Jun 20 05:27:58 2013
Log: Merge remote-tracking branch 'dheidler/master'...
http://code.google.com/p/libfreefare/source/detail?r=ea496c441d23

==============================================================================
Revision: cc36619f132e
Author: Dominik Heidler <dhei...@gmail.com>
Date: Fri May 3 00:58:22 2013
Log: mifare-classic-format option: read keys from dump

http://code.google.com/p/libfreefare/source/detail?r=cc36619f132e

Modified:
/examples/mifare-classic-format.c

=======================================
--- /examples/mifare-classic-format.c Sat Mar 30 10:07:34 2013
+++ /examples/mifare-classic-format.c Fri May 3 00:58:22 2013
@@ -33,7 +33,8 @@
#define START_FORMAT_N "Formatting %d sectors ["
#define DONE_FORMAT "] done.\n"

-MifareClassicKey default_keys[] = {
+MifareClassicKey default_keys[40];
+MifareClassicKey default_keys_int[] = {
{ 0xff,0xff,0xff,0xff,0xff,0xff },
{ 0xd3,0xf7,0xd3,0xf7,0xd3,0xf7 },
{ 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5 },
@@ -129,10 +130,11 @@
static void
usage(char *progname)
{
- fprintf (stderr, "usage: %s [-fy]\n", progname);
+ fprintf (stderr, "usage: %s [-fy] [keyfile]\n", progname);
fprintf (stderr, "\nOptions:\n");
- fprintf (stderr, " -f Fast format (only erase MAD)\n");
- fprintf (stderr, " -y Do not ask for confirmation (dangerous)\n");
+ fprintf (stderr, " -f Fast format (only erase MAD)\n");
+ fprintf (stderr, " -y Do not ask for confirmation
(dangerous)\n");
+ fprintf (stderr, " keyfile Use keys from dump in addition to internal
default keys\n");
}

int
@@ -162,6 +164,30 @@
}
// Remaining args, if any, are in argv[optind .. (argc-1)]

+ memcpy(default_keys, default_keys_int, sizeof(default_keys_int));
+
+ if ((argc - optind) > 0)
+ {
+ int i, rc;
+ char kbuffer[1024] = {0};
+ memset ( kbuffer, 0, sizeof kbuffer);
+ FILE *fp = fopen(argv[optind], "rb");
+ if (fp == NULL)
+ errx(EXIT_FAILURE, "Unable to open file");
+ for (i = 0; (rc = getc(fp)) != EOF && i < 1024; kbuffer[i++] = rc)
{ }
+ fclose(fp);
+
+ i = sizeof(default_keys_int) / 6;
+ for(int s = 0; s<16; s++)
+ {
+ int startblock = s * 4;
+ int pos_a = (startblock + 3) * 16;
+ int pos_b = (startblock + 3) * 16 + 10;
+ memcpy((default_keys + i++), kbuffer + pos_a, 6);
+ memcpy((default_keys + i++), kbuffer + pos_b, 6);
+ }
+ }
+
nfc_connstring devices[8];

size_t device_count;

==============================================================================
Revision: ea496c441d23
Author: Philippe Teuwen <yob...@gmail.com>
Date: Thu Jun 20 05:27:58 2013
Log: Merge remote-tracking branch 'dheidler/master'

* dheidler/master:
mifare-classic-format option: read keys from dump

http://code.google.com/p/libfreefare/source/detail?r=ea496c441d23


Reply all
Reply to author
Forward
0 new messages