]> git.zerfleddert.de Git - proxmark3-svn/blame - client/cli.c
hack to add missing directory structure for loclass binaries
[proxmark3-svn] / client / cli.c
CommitLineData
a553f267 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
db917a16 9#include <stdio.h>
4cd41f34 10#include "sleep.h"
7fe9b0b7 11#include "ui.h"
12#include "proxusb.h"
13#include "cmdmain.h"
db917a16 14
15#define HANDLE_ERROR if (error_occured) { \
7fe9b0b7 16 error_occured = 0;\
17 break;\
db917a16 18}
19
20int main(int argc, char **argv)
21{
7fe9b0b7 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;
db917a16 58}
Impressum, Datenschutz