]>
Commit | Line | Data |
---|---|---|
1 | //----------------------------------------------------------------------------- | |
2 | // Copyright (C) 2010 iZsh <izsh at fail0verflow.com> | |
3 | // Merlok - 2017 | |
4 | // | |
5 | // This code is licensed to you under the terms of the GNU GPL, version 2 or, | |
6 | // at your option, any later version. See the LICENSE.txt file for the text of | |
7 | // the license. | |
8 | //----------------------------------------------------------------------------- | |
9 | // High frequency commands | |
10 | //----------------------------------------------------------------------------- | |
11 | ||
12 | #include "cmdhf.h" | |
13 | ||
14 | #include "usb_cmd.h" | |
15 | #include "comms.h" | |
16 | #include "ui.h" | |
17 | #include "cmdparser.h" | |
18 | #include "cmdhf14a.h" | |
19 | #include "cmdhf14b.h" | |
20 | #include "cmdhf15.h" | |
21 | #include "cmdhfepa.h" | |
22 | #include "cmdhflegic.h" | |
23 | #include "cmdhficlass.h" | |
24 | #include "cmdhfmf.h" | |
25 | #include "cmdhfmfp.h" | |
26 | #include "cmdhfmfu.h" | |
27 | #include "cmdhftopaz.h" | |
28 | #include "cmdhflist.h" | |
29 | #include "cmdhffido.h" | |
30 | ||
31 | static int CmdHelp(const char *Cmd); | |
32 | ||
33 | int CmdHFTune(const char *Cmd) | |
34 | { | |
35 | UsbCommand c={CMD_MEASURE_ANTENNA_TUNING_HF}; | |
36 | SendCommand(&c); | |
37 | return 0; | |
38 | } | |
39 | ||
40 | int CmdHFSearch(const char *Cmd){ | |
41 | int ans = 0; | |
42 | PrintAndLog(""); | |
43 | ans = CmdHF14AInfo("s"); | |
44 | if (ans > 0) { | |
45 | PrintAndLog("\nValid ISO14443A Tag Found - Quiting Search\n"); | |
46 | return ans; | |
47 | } | |
48 | ans = HFiClassReader("", false, false); | |
49 | if (ans) { | |
50 | PrintAndLog("\nValid iClass Tag (or PicoPass Tag) Found - Quiting Search\n"); | |
51 | return ans; | |
52 | } | |
53 | ans = HF15Reader("", false); | |
54 | if (ans) { | |
55 | PrintAndLog("\nValid ISO15693 Tag Found - Quiting Search\n"); | |
56 | return ans; | |
57 | } | |
58 | //14b is longest test currently (and rarest chip type) ... put last | |
59 | ans = HF14BInfo(false); | |
60 | if (ans) { | |
61 | PrintAndLog("\nValid ISO14443B Tag Found - Quiting Search\n"); | |
62 | return ans; | |
63 | } | |
64 | PrintAndLog("\nno known/supported 13.56 MHz tags found\n"); | |
65 | return 0; | |
66 | } | |
67 | ||
68 | int CmdHFSnoop(const char *Cmd) | |
69 | { | |
70 | char * pEnd; | |
71 | UsbCommand c = {CMD_HF_SNIFFER, {strtol(Cmd, &pEnd,0),strtol(pEnd, &pEnd,0),0}}; | |
72 | SendCommand(&c); | |
73 | return 0; | |
74 | } | |
75 | ||
76 | static command_t CommandTable[] = | |
77 | { | |
78 | {"help", CmdHelp, 1, "This help"}, | |
79 | {"14a", CmdHF14A, 1, "{ ISO14443A RFIDs... }"}, | |
80 | {"14b", CmdHF14B, 1, "{ ISO14443B RFIDs... }"}, | |
81 | {"15", CmdHF15, 1, "{ ISO15693 RFIDs... }"}, | |
82 | {"epa", CmdHFEPA, 1, "{ German Identification Card... }"}, | |
83 | {"legic", CmdHFLegic, 0, "{ LEGIC RFIDs... }"}, | |
84 | {"iclass", CmdHFiClass, 1, "{ ICLASS RFIDs... }"}, | |
85 | {"mf", CmdHFMF, 1, "{ MIFARE RFIDs... }"}, | |
86 | {"mfu", CmdHFMFUltra, 1, "{ MIFARE Ultralight RFIDs... }"}, | |
87 | {"mfp", CmdHFMFP, 1, "{ MIFARE Plus RFIDs... }"}, | |
88 | {"topaz", CmdHFTopaz, 1, "{ TOPAZ (NFC Type 1) RFIDs... }"}, | |
89 | {"fido", CmdHFFido, 1, "{ FIDO and FIDO2 authenticators... }"}, | |
90 | {"tune", CmdHFTune, 0, "Continuously measure HF antenna tuning"}, | |
91 | {"list", CmdHFList, 1, "List protocol data in trace buffer"}, | |
92 | {"search", CmdHFSearch, 1, "Search for known HF tags [preliminary]"}, | |
93 | {"snoop", CmdHFSnoop, 0, "<samples to skip (10000)> <triggers to skip (1)> Generic HF Snoop"}, | |
94 | {NULL, NULL, 0, NULL} | |
95 | }; | |
96 | ||
97 | int CmdHF(const char *Cmd) | |
98 | { | |
99 | CmdsParse(CommandTable, Cmd); | |
100 | return 0; | |
101 | } | |
102 | ||
103 | int CmdHelp(const char *Cmd) | |
104 | { | |
105 | CmdsHelp(CommandTable); | |
106 | return 0; | |
107 | } |