]>
Commit | Line | Data |
---|---|---|
a553f267 | 1 | //----------------------------------------------------------------------------- |
2 | // Copyright (C) 2010 iZsh <izsh at fail0verflow.com> | |
4f131b53 | 3 | // Merlok - 2017 |
a553f267 | 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 | ||
ad939de5 | 12 | #include "cmdhf.h" |
13 | ||
0d2624a0 | 14 | #include "usb_cmd.h" |
ad939de5 | 15 | #include "comms.h" |
7fe9b0b7 | 16 | #include "ui.h" |
17 | #include "cmdparser.h" | |
7fe9b0b7 | 18 | #include "cmdhf14a.h" |
19 | #include "cmdhf14b.h" | |
20 | #include "cmdhf15.h" | |
5acd09bd | 21 | #include "cmdhfepa.h" |
7fe9b0b7 | 22 | #include "cmdhflegic.h" |
cee5a30d | 23 | #include "cmdhficlass.h" |
9ca155ba | 24 | #include "cmdhfmf.h" |
dc3e2acf | 25 | #include "cmdhfmfp.h" |
5ee70129 | 26 | #include "cmdhfmfu.h" |
05ddb52c | 27 | #include "cmdhftopaz.h" |
4f131b53 | 28 | #include "cmdhflist.h" |
39cc1c87 | 29 | #include "cmdhffido.h" |
7fe9b0b7 | 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 | } | |
4c3de57a | 39 | |
8ceb6b03 | 40 | int CmdHFSearch(const char *Cmd){ |
41 | int ans = 0; | |
6ce0e538 | 42 | PrintAndLog(""); |
fe842bed | 43 | ans = CmdHF14AInfo("s"); |
6ce0e538 | 44 | if (ans > 0) { |
45 | PrintAndLog("\nValid ISO14443A Tag Found - Quiting Search\n"); | |
46 | return ans; | |
ff4fdb32 | 47 | } |
aa53efc3 | 48 | ans = HFiClassReader("", false, false); |
ff4fdb32 | 49 | if (ans) { |
aa53efc3 | 50 | PrintAndLog("\nValid iClass Tag (or PicoPass Tag) Found - Quiting Search\n"); |
ff4fdb32 | 51 | return ans; |
52 | } | |
979c7655 | 53 | ans = HF15Reader("", false); |
6ce0e538 | 54 | if (ans) { |
979c7655 | 55 | PrintAndLog("\nValid ISO15693 Tag Found - Quiting Search\n"); |
6ce0e538 | 56 | return ans; |
57 | } | |
979c7655 | 58 | //14b is longest test currently (and rarest chip type) ... put last |
59 | ans = HF14BInfo(false); | |
6ce0e538 | 60 | if (ans) { |
979c7655 | 61 | PrintAndLog("\nValid ISO14443B Tag Found - Quiting Search\n"); |
6ce0e538 | 62 | return ans; |
63 | } | |
ff4fdb32 | 64 | PrintAndLog("\nno known/supported 13.56 MHz tags found\n"); |
8ceb6b03 | 65 | return 0; |
66 | } | |
7fe9b0b7 | 67 | |
0472d76d | 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 | ||
7fe9b0b7 | 76 | static command_t CommandTable[] = |
77 | { | |
05ddb52c | 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... }"}, | |
dc3e2acf | 87 | {"mfp", CmdHFMFP, 1, "{ MIFARE Plus RFIDs... }"}, |
05ddb52c | 88 | {"topaz", CmdHFTopaz, 1, "{ TOPAZ (NFC Type 1) RFIDs... }"}, |
39cc1c87 | 89 | {"fido", CmdHFFido, 1, "{ FIDO and FIDO2 authenticators... }"}, |
05ddb52c | 90 | {"tune", CmdHFTune, 0, "Continuously measure HF antenna tuning"}, |
91 | {"list", CmdHFList, 1, "List protocol data in trace buffer"}, | |
7624e8b2 | 92 | {"search", CmdHFSearch, 1, "Search for known HF tags [preliminary]"}, |
b2fe0e77 | 93 | {"snoop", CmdHFSnoop, 0, "<samples to skip (10000)> <triggers to skip (1)> Generic HF Snoop"}, |
05ddb52c | 94 | {NULL, NULL, 0, NULL} |
7fe9b0b7 | 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 | } |