]>
git.zerfleddert.de Git - proxmark3-svn/blob - client/loclass/main.c
1 /*****************************************************************************
2 * This file is part of iClassCipher. It is a reconstructon of the cipher engine
3 * used in iClass, and RFID techology.
5 * The implementation is based on the work performed by
6 * Flavio D. Garcia, Gerhard de Koning Gans, Roel Verdult and
7 * Milosch Meriac in the paper "Dismantling IClass".
9 * Copyright (C) 2014 Martin Holst Swende
11 * This is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as published
13 * by the Free Software Foundation.
15 * This file is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with IClassCipher. If not, see <http://www.gnu.org/licenses/>.
22 ****************************************************************************/
25 #include <cipherutils.h>
31 #include "cipherutils.h"
34 #include "fileutils.h"
35 #include "elite_crack.h"
39 int errors
= testCipherUtils();
41 errors
+= doKeyTests(0);
42 errors
+= testElite();
47 prnlog("Usage: iclazz [options]");
49 prnlog("-t Perform self-test");
50 prnlog("-h Show this help");
51 prnlog("-f <filename> Bruteforce iclass dumpfile");
52 prnlog(" An iclass dumpfile is assumed to consist of an arbitrary number of malicious CSNs, and their protocol responses");
53 prnlog(" The the binary format of the file is expected to be as follows: ");
54 prnlog(" <8 byte CSN><8 byte CC><4 byte NR><4 byte MAC>");
55 prnlog(" <8 byte CSN><8 byte CC><4 byte NR><4 byte MAC>");
56 prnlog(" <8 byte CSN><8 byte CC><4 byte NR><4 byte MAC>");
57 prnlog(" ... totalling N*24 bytes");
58 prnlog(" Check iclass_dump.bin for an example");
63 int main (int argc
, char **argv
)
65 prnlog("IClass Cipher version 1.2, Copyright (C) 2014 Martin Holst Swende\n");
66 prnlog("Comes with ABSOLUTELY NO WARRANTY");
67 prnlog("This is free software, and you are welcome to use, abuse and repackage, please keep the credits\n");
68 char *fileName
= NULL
;
70 while ((c
= getopt (argc
, argv
, "thf:")) != -1)
79 return bruteforceFileNoKeys(fileName
);
82 fprintf (stderr
, "Option -%c requires an argument.\n", optopt
);
83 else if (isprint (optopt
))
84 fprintf (stderr
, "Unknown option `-%c'.\n", optopt
);
87 "Unknown option character `\\x%x'.\n",