a553f267 |
1 | //----------------------------------------------------------------------------- |
212ef3a0 |
2 | // Copyright (C) 2009 Michael Gernoth <michael at gernoth.net> |
3 | // |
a553f267 |
4 | // This code is licensed to you under the terms of the GNU GPL, version 2 or, |
5 | // at your option, any later version. See the LICENSE.txt file for the text of |
6 | // the license. |
7 | //----------------------------------------------------------------------------- |
8 | // Snooper binary |
9 | //----------------------------------------------------------------------------- |
10 | |
4cd41f34 |
11 | #include "sleep.h" |
7fe9b0b7 |
12 | #include "ui.h" |
13 | #include "proxusb.h" |
14 | #include "cmdmain.h" |
6658905f |
15 | |
16 | #define HANDLE_ERROR if (error_occured) { \ |
7fe9b0b7 |
17 | error_occured = 0;\ |
18 | break;\ |
6658905f |
19 | } |
20 | |
21 | int main() |
22 | { |
7fe9b0b7 |
23 | usb_init(); |
24 | SetLogFilename("snooper.log"); |
25 | |
26 | return_on_error = 1; |
27 | |
28 | while(1) { |
29 | while (!OpenProxmark(0)) { sleep(1); } |
30 | while (1) { |
31 | UsbCommand cmdbuf; |
6c45a008 |
32 | CommandReceived("hf 14a snoop"); |
7fe9b0b7 |
33 | HANDLE_ERROR; |
34 | ReceiveCommand(&cmdbuf); |
35 | HANDLE_ERROR; |
36 | for (int i = 0; i < 5; ++i) { |
37 | ReceiveCommandPoll(&cmdbuf); |
38 | } |
39 | HANDLE_ERROR; |
6c45a008 |
40 | CommandReceived("hf 14a list"); |
7fe9b0b7 |
41 | HANDLE_ERROR; |
42 | } |
43 | } |
44 | |
45 | CloseProxmark(); |
46 | return 0; |
6658905f |
47 | } |