]> git.zerfleddert.de Git - proxmark3-svn/blob - client/cli.c
Fix FMCN setting so it actually matches datasheet
[proxmark3-svn] / client / cli.c
1 //-----------------------------------------------------------------------------
2 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
3 // at your option, any later version. See the LICENSE.txt file for the text of
4 // the license.
5 //-----------------------------------------------------------------------------
6 // Command line binary
7 //-----------------------------------------------------------------------------
8
9 #include <stdio.h>
10 #include "sleep.h"
11 #include "ui.h"
12 #include "proxusb.h"
13 #include "cmdmain.h"
14
15 #define HANDLE_ERROR if (error_occured) { \
16 error_occured = 0;\
17 break;\
18 }
19
20 int main(int argc, char **argv)
21 {
22 if (argc != 3 && argc != 4)
23 {
24 printf("\n\tusage: cli <command 1> <command 2> [logfile (default cli.log)]\n");
25 printf("\n");
26 printf("\texample: cli hi14asnoop hi14alist h14a.log\n");
27 printf("\n");
28 return -1;
29 }
30
31 usb_init();
32 if (argc == 4)
33 SetLogFilename(argv[3]);
34 else
35 SetLogFilename("cli.log");
36
37 return_on_error = 1;
38
39 while (1) {
40 while (!OpenProxmark(0)) { sleep(1); }
41 while (1) {
42 UsbCommand cmdbuf;
43 CommandReceived(argv[1]);
44 HANDLE_ERROR;
45 ReceiveCommand(&cmdbuf);
46 HANDLE_ERROR;
47 for (int i = 0; i < 5; ++i) {
48 ReceiveCommandPoll(&cmdbuf);
49 }
50 HANDLE_ERROR;
51 CommandReceived(argv[2]);
52 HANDLE_ERROR;
53 }
54 }
55
56 CloseProxmark();
57 return 0;
58 }
Impressum, Datenschutz