| 1 | //----------------------------------------------------------------------------- |
| 2 | // Copyright (C) 2009 Michael Gernoth <michael at gernoth.net> |
| 3 | // |
| 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 | |
| 11 | #include "sleep.h" |
| 12 | #include "ui.h" |
| 13 | #include "proxusb.h" |
| 14 | #include "cmdmain.h" |
| 15 | |
| 16 | #define HANDLE_ERROR if (error_occured) { \ |
| 17 | error_occured = 0;\ |
| 18 | break;\ |
| 19 | } |
| 20 | |
| 21 | int main() |
| 22 | { |
| 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; |
| 32 | CommandReceived("hf 14a snoop"); |
| 33 | HANDLE_ERROR; |
| 34 | ReceiveCommand(&cmdbuf); |
| 35 | HANDLE_ERROR; |
| 36 | for (int i = 0; i < 5; ++i) { |
| 37 | ReceiveCommandPoll(&cmdbuf); |
| 38 | } |
| 39 | HANDLE_ERROR; |
| 40 | CommandReceived("hf 14a list"); |
| 41 | HANDLE_ERROR; |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | CloseProxmark(); |
| 46 | return 0; |
| 47 | } |