]> git.zerfleddert.de Git - proxmark3-svn/blame - client/cmdhf.c
CHG: Minor tweaks, the tracing dissappeared, the spindelay for powering up too...
[proxmark3-svn] / client / cmdhf.c
CommitLineData
a553f267 1//-----------------------------------------------------------------------------
2// Copyright (C) 2010 iZsh <izsh at fail0verflow.com>
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// High frequency commands
9//-----------------------------------------------------------------------------
10
7fe9b0b7 11#include <stdio.h>
4c3de57a 12#include <string.h>
902cb3c0 13#include "proxmark3.h"
7fe9b0b7 14#include "graph.h"
15#include "ui.h"
16#include "cmdparser.h"
17#include "cmdhf.h"
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"
5ee70129 25#include "cmdhfmfu.h"
0ec548dc 26#include "cmdhfmfdes.h"
27#include "cmdhftopaz.h"
b67f7ec3 28#include "protocols.h"
7fe9b0b7 29
30static int CmdHelp(const char *Cmd);
31
e3f9c50d 32int CmdHFTune(const char *Cmd) {
38e41917 33 PrintAndLog("Measuring HF antenna, press button to exit");
34 UsbCommand c = {CMD_MEASURE_ANTENNA_TUNING_HF};
35 clearCommandBuffer();
36 SendCommand(&c);
37 return 0;
7fe9b0b7 38}
4c3de57a 39
c71c5ee1 40int applyIso14443a(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize) {
41 switch ( cmd[0] ){
42 case ISO14443A_CMD_WUPA: snprintf(exp,size,"WUPA"); break;
43 case ISO14443A_CMD_ANTICOLL_OR_SELECT:{
44 // 93 20 = Anticollision (usage: 9320 - answer: 4bytes UID+1byte UID-bytes-xor)
45 // 93 70 = Select (usage: 9370+5bytes 9320 answer - answer: 1byte SAK)
46 if(cmd[1] == 0x70)
47 snprintf(exp,size,"SELECT_UID");
48 else
49 snprintf(exp,size,"ANTICOLL");
50 break;
51 }
52 case ISO14443A_CMD_ANTICOLL_OR_SELECT_2:{
53 //95 20 = Anticollision of cascade level2
54 //95 70 = Select of cascade level2
55 if(cmd[2] == 0x70)
56 snprintf(exp,size,"SELECT_UID-2");
57 else
58 snprintf(exp,size,"ANTICOLL-2");
59 break;
60 }
61 case ISO14443A_CMD_REQA: snprintf(exp,size,"REQA"); break;
62 case ISO14443A_CMD_READBLOCK: snprintf(exp,size,"READBLOCK(%d)",cmd[1]); break;
63 case ISO14443A_CMD_WRITEBLOCK: snprintf(exp,size,"WRITEBLOCK(%d)",cmd[1]); break;
64 case ISO14443A_CMD_HALT: snprintf(exp,size,"HALT"); break;
65 case ISO14443A_CMD_RATS: snprintf(exp,size,"RATS"); break;
66 case MIFARE_CMD_INC: snprintf(exp,size,"INC(%d)",cmd[1]); break;
67 case MIFARE_CMD_DEC: snprintf(exp,size,"DEC(%d)",cmd[1]); break;
68 case MIFARE_CMD_RESTORE: snprintf(exp,size,"RESTORE(%d)",cmd[1]); break;
69 case MIFARE_CMD_TRANSFER: snprintf(exp,size,"TRANSFER(%d)",cmd[1]); break;
70 case MIFARE_AUTH_KEYA:{
71 if ( cmdsize > 3)
72 snprintf(exp,size,"AUTH-A(%d)",cmd[1]);
73 else
74 // case MIFARE_ULEV1_VERSION : both 0x60.
75 snprintf(exp,size,"EV1 VERSION");
76 break;
77 }
78 case MIFARE_AUTH_KEYB: snprintf(exp,size,"AUTH-B(%d)",cmd[1]); break;
79 case MIFARE_MAGICWUPC1: snprintf(exp,size,"MAGIC WUPC1"); break;
80 case MIFARE_MAGICWUPC2: snprintf(exp,size,"MAGIC WUPC2"); break;
81 case MIFARE_MAGICWIPEC: snprintf(exp,size,"MAGIC WIPEC"); break;
82 case MIFARE_ULC_AUTH_1 : snprintf(exp,size,"AUTH "); break;
83 case MIFARE_ULC_AUTH_2 : snprintf(exp,size,"AUTH_ANSW"); break;
84 case MIFARE_ULEV1_AUTH :
85 if ( cmdsize == 7 )
86 snprintf(exp,size,"PWD-AUTH KEY: 0x%02x%02x%02x%02x", cmd[1], cmd[2], cmd[3], cmd[4] );
87 else
88 snprintf(exp,size,"PWD-AUTH");
89 break;
90 case MIFARE_ULEV1_FASTREAD : {
91 if ( cmdsize >=3 && cmd[2] <= 0xE6)
92 snprintf(exp,size,"READ RANGE (%d-%d)",cmd[1],cmd[2]);
93 else
94 snprintf(exp,size,"?");
95 break;
96 }
97 case MIFARE_ULC_WRITE : {
98 if ( cmd[1] < 0x21 )
99 snprintf(exp,size,"WRITEBLOCK(%d)",cmd[1]);
100 else
101 snprintf(exp,size,"?");
102 break;
103 }
104 case MIFARE_ULEV1_READ_CNT :{
105 if ( cmd[1] < 5 )
106 snprintf(exp,size,"READ CNT(%d)",cmd[1]);
107 else
108 snprintf(exp,size,"?");
109 break;
110 }
111 case MIFARE_ULEV1_INCR_CNT : {
112 if ( cmd[1] < 5 )
113 snprintf(exp,size,"INCR(%d)",cmd[1]);
114 else
115 snprintf(exp,size,"?");
116 break;
117 }
118 case MIFARE_ULEV1_READSIG : snprintf(exp,size,"READ_SIG"); break;
119 case MIFARE_ULEV1_CHECKTEAR : snprintf(exp,size,"CHK_TEARING(%d)",cmd[1]); break;
120 case MIFARE_ULEV1_VCSL : snprintf(exp,size,"VCSL"); break;
121 default: return 0;
4c3de57a 122 }
7e08450d 123 return 1;
124}
125
c71c5ee1 126void annotateIso14443a(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize) {
7e08450d 127 applyIso14443a(exp, size, cmd, cmdsize);
4c3de57a
MHS
128}
129
c71c5ee1 130void annotateIclass(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize) {
131 switch (cmd[0]) {
132 case ICLASS_CMD_ACTALL: snprintf(exp,size,"ACTALL"); break;
133 case ICLASS_CMD_READ_OR_IDENTIFY:{
134 if(cmdsize > 1){
135 snprintf(exp,size,"READ(%d)",cmd[1]);
136 }else{
137 snprintf(exp,size,"IDENTIFY");
138 }
139 break;
4df54240 140 }
c71c5ee1 141 case ICLASS_CMD_SELECT: snprintf(exp,size,"SELECT"); break;
142 case ICLASS_CMD_PAGESEL: snprintf(exp,size,"PAGESEL(%d)", cmd[1]); break;
143 case ICLASS_CMD_READCHECK_KC:snprintf(exp,size,"READCHECK[Kc](%d)", cmd[1]); break;
144 case ICLASS_CMD_READCHECK_KD:snprintf(exp,size,"READCHECK[Kd](%d)", cmd[1]); break;
145 case ICLASS_CMD_CHECK: snprintf(exp,size,"CHECK"); break;
146 case ICLASS_CMD_DETECT: snprintf(exp,size,"DETECT"); break;
147 case ICLASS_CMD_HALT: snprintf(exp,size,"HALT"); break;
148 case ICLASS_CMD_UPDATE: snprintf(exp,size,"UPDATE(%d)",cmd[1]); break;
149 case ICLASS_CMD_ACT: snprintf(exp,size,"ACT"); break;
150 case ICLASS_CMD_READ4: snprintf(exp,size,"READ4(%d)",cmd[1]); break;
151 default: snprintf(exp,size,"?"); break;
4c3de57a
MHS
152 }
153 return;
154}
155
c71c5ee1 156void annotateIso15693(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize) {
157 if(cmd[0] == 0x26) {
4df54240 158 switch(cmd[1]){
c71c5ee1 159 case ISO15693_INVENTORY :snprintf(exp, size, "INVENTORY");break;
160 case ISO15693_STAYQUIET :snprintf(exp, size, "STAY_QUIET");break;
161 default :snprintf(exp,size,"?"); break;
4df54240 162 }
c71c5ee1 163 } else if(cmd[0] == 0x02) {
164 switch (cmd[1]) {
165 case ISO15693_READBLOCK :snprintf(exp, size, "READBLOCK");break;
166 case ISO15693_WRITEBLOCK :snprintf(exp, size, "WRITEBLOCK");break;
167 case ISO15693_LOCKBLOCK :snprintf(exp, size, "LOCKBLOCK");break;
168 case ISO15693_READ_MULTI_BLOCK :snprintf(exp, size, "READ_MULTI_BLOCK");break;
169 case ISO15693_SELECT :snprintf(exp, size, "SELECT");break;
170 case ISO15693_RESET_TO_READY :snprintf(exp, size, "RESET_TO_READY");break;
171 case ISO15693_WRITE_AFI :snprintf(exp, size, "WRITE_AFI");break;
172 case ISO15693_LOCK_AFI :snprintf(exp, size, "LOCK_AFI");break;
173 case ISO15693_WRITE_DSFID :snprintf(exp, size, "WRITE_DSFID");break;
174 case ISO15693_LOCK_DSFID :snprintf(exp, size, "LOCK_DSFID");break;
175 case ISO15693_GET_SYSTEM_INFO :snprintf(exp, size, "GET_SYSTEM_INFO");break;
176 case ISO15693_READ_MULTI_SECSTATUS :snprintf(exp, size, "READ_MULTI_SECSTATUS");break;
177 default: snprintf(exp,size,"?"); break;
4df54240
MHS
178 }
179 }
180}
08e8317c 181
c71c5ee1 182void annotateTopaz(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize){
0ec548dc 183 switch(cmd[0]) {
184 case TOPAZ_REQA :snprintf(exp, size, "REQA");break;
185 case TOPAZ_WUPA :snprintf(exp, size, "WUPA");break;
186 case TOPAZ_RID :snprintf(exp, size, "RID");break;
187 case TOPAZ_RALL :snprintf(exp, size, "RALL");break;
188 case TOPAZ_READ :snprintf(exp, size, "READ");break;
189 case TOPAZ_WRITE_E :snprintf(exp, size, "WRITE-E");break;
190 case TOPAZ_WRITE_NE :snprintf(exp, size, "WRITE-NE");break;
191 case TOPAZ_RSEG :snprintf(exp, size, "RSEG");break;
192 case TOPAZ_READ8 :snprintf(exp, size, "READ8");break;
193 case TOPAZ_WRITE_E8 :snprintf(exp, size, "WRITE-E8");break;
194 case TOPAZ_WRITE_NE8 :snprintf(exp, size, "WRITE-NE8");break;
c5f8c67a 195 default :snprintf(exp,size,"?"); break;
0ec548dc 196 }
197}
198
5b59bf20 199// iso 7816-3
c5f8c67a 200void annotateIso7816(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize){
5b59bf20 201 // S-block
202 if ( (cmd[0] & 0xC0) && (cmdsize == 3) ) {
203 switch ( (cmd[0] & 0x3f) ) {
204 case 0x00 : snprintf(exp, size, "S-block RESYNCH req"); break;
205 case 0x20 : snprintf(exp, size, "S-block RESYNCH resp"); break;
206 case 0x01 : snprintf(exp, size, "S-block IFS req"); break;
207 case 0x21 : snprintf(exp, size, "S-block IFS resp"); break;
208 case 0x02 : snprintf(exp, size, "S-block ABORT req"); break;
209 case 0x22 : snprintf(exp, size, "S-block ABORT resp"); break;
210 case 0x03 : snprintf(exp, size, "S-block WTX reqt"); break;
211 case 0x23 : snprintf(exp, size, "S-block WTX resp"); break;
212 default : snprintf(exp, size, "S-block"); break;
213 }
214 }
215 // R-block (ack)
216 else if ( ((cmd[0] & 0xD0) == 0x80) && ( cmdsize > 2) ) {
f445df40 217 if ( (cmd[0] & 0x10) == 0 )
218 snprintf(exp, size, "R-block ACK");
219 else
220 snprintf(exp, size, "R-block NACK");
5b59bf20 221 }
222 // I-block
223 else {
c5f8c67a 224
5b59bf20 225 int pos = (cmd[0] == 2 || cmd[0] == 3) ? 2 : 3;
226 switch ( cmd[pos] ){
227 case ISO7816_READ_BINARY :snprintf(exp, size, "READ BIN");break;
228 case ISO7816_WRITE_BINARY :snprintf(exp, size, "WRITE BIN");break;
229 case ISO7816_UPDATE_BINARY :snprintf(exp, size, "UPDATE BIN");break;
230 case ISO7816_ERASE_BINARY :snprintf(exp, size, "ERASE BIN");break;
231 case ISO7816_READ_RECORDS :snprintf(exp, size, "READ RECORDS");break;
232 case ISO7816_WRITE_RECORDS :snprintf(exp, size, "WRITE RECORDS");break;
233 case ISO7816_APPEND_RECORD :snprintf(exp, size, "APPEND RECORD");break;
234 case ISO7816_UPDATE_RECORD :snprintf(exp, size, "UPDATE RECORD");break;
235 case ISO7816_GET_DATA :snprintf(exp, size, "GET DATA");break;
236 case ISO7816_PUT_DATA :snprintf(exp, size, "PUT DATA");break;
237 case ISO7816_SELECT_FILE :snprintf(exp, size, "SELECT FILE");break;
238 case ISO7816_VERIFY :snprintf(exp, size, "VERIFY");break;
239 case ISO7816_INTERNAL_AUTHENTICATION :snprintf(exp, size, "INTERNAL AUTH");break;
240 case ISO7816_EXTERNAL_AUTHENTICATION :snprintf(exp, size, "EXTERNAL AUTH");break;
241 case ISO7816_GET_CHALLENGE :snprintf(exp, size, "GET CHALLENGE");break;
242 case ISO7816_MANAGE_CHANNEL :snprintf(exp, size, "MANAGE CHANNEL");break;
243 default :snprintf(exp,size,"?"); break;
244 }
245 }
c5f8c67a 246}
0ec548dc 247
7e08450d 248// MIFARE DESFire
249void annotateMfDesfire(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize){
250
251 // it's basically a ISO14443a tag, so try annotation from there
252 if (!applyIso14443a(exp, size, cmd, cmdsize)){
253 //PrintAndLog("rest");
254 //PrintAndLog("(%d)",cmd[0]);
255 // S-block 11xxx010
256 if ( (cmd[0] & 0xC0) && (cmdsize == 3) ) {
257 switch ( (cmd[0] & 0x30) ) {
258 case 0x30 : snprintf(exp, size, "S-block DESELECT"); break;
259 case 0x00 : snprintf(exp, size, "S-block WTX"); break;
260 default : snprintf(exp, size, "S-block"); break;
261 }
262 }
263 // R-block (ack) 101xx01x
264 else if ( ((cmd[0] & 0xB0) == 0xA0) && ( cmdsize > 2) ) {
265 if ( (cmd[0] & 0x10) == 0 )
266 snprintf(exp, size, "R-block ACK(%d)", (cmd[0] & 0x01));
267 else
268 snprintf(exp, size, "R-block NACK(%d)", (cmd[0] & 0x01));
269 }
270 // I-block 000xCN1x
271 else if ( (cmd[0] & 0xC0) == 0x00){
272 // PCB [CID] [NAD] [INF] CRC CRC
273 int pos = 1;
274 if ( (cmd[0] & 0x08) == 0x08) // cid byte following
275 pos = pos + 1;
276 if ( (cmd[0] & 0x04) == 0x04) // nad byte following
277 pos = pos + 1;
278 //PrintAndLog("[%d]",pos);
279 switch ( cmd[pos] ){
280 case MFDES_CREATE_APPLICATION :snprintf(exp, size, "CREATE APPLICATION");break;
281 case MFDES_DELETE_APPLICATION :snprintf(exp, size, "DELETE APPLICATION");break;
282 case MFDES_GET_APPLICATION_IDS :snprintf(exp, size, "GET APPLICATION IDS");break;
283 case MFDES_SELECT_APPLICATION :snprintf(exp, size, "SELECT APPLICATION");break;
284 case MFDES_FORMAT_PICC :snprintf(exp, size, "FORMAT PICC");break;
285 case MFDES_GET_VERSION :snprintf(exp, size, "GET VERSION");break;
286 case MFDES_READ_DATA :snprintf(exp, size, "READ DATA");break;
287 case MFDES_WRITE_DATA :snprintf(exp, size, "WRITE DATA");break;
288 case MFDES_GET_VALUE :snprintf(exp, size, "GET VALUE");break;
289 case MFDES_CREDIT :snprintf(exp, size, "CREDIT");break;
290 case MFDES_DEBIT :snprintf(exp, size, "DEBIT");break;
291 case MFDES_LIMITED_CREDIT :snprintf(exp, size, "LIMITED CREDIT");break;
292 case MFDES_WRITE_RECORD :snprintf(exp, size, "WRITE RECORD");break;
293 case MFDES_READ_RECORDS :snprintf(exp, size, "READ RECORDS");break;
294 case MFDES_CLEAR_RECORD_FILE :snprintf(exp, size, "CLEAR RECORD FILE");break;
295 case MFDES_COMMIT_TRANSACTION :snprintf(exp, size, "COMMIT TRANSACTION");break;
296 case MFDES_ABORT_TRANSACTION :snprintf(exp, size, "ABORT TRANSACTION");break;
297 case MFDES_GET_FREE_MEMORY :snprintf(exp, size, "GET FREE MEMORY");break;
298 case MFDES_GET_FILE_IDS :snprintf(exp, size, "GET FILE IDS");break;
299 case MFDES_GET_ISOFILE_IDS :snprintf(exp, size, "GET ISOFILE IDS");break;
300 case MFDES_GET_FILE_SETTINGS :snprintf(exp, size, "GET FILE SETTINGS");break;
301 case MFDES_CHANGE_FILE_SETTINGS :snprintf(exp, size, "CHANGE FILE SETTINGS");break;
302 case MFDES_CREATE_STD_DATA_FILE :snprintf(exp, size, "CREATE STD DATA FILE");break;
303 case MFDES_CREATE_BACKUP_DATA_FILE :snprintf(exp, size, "CREATE BACKUP DATA FILE");break;
304 case MFDES_CREATE_VALUE_FILE :snprintf(exp, size, "CREATE VALUE FILE");break;
305 case MFDES_CREATE_LINEAR_RECORD_FILE :snprintf(exp, size, "CREATE LINEAR RECORD FILE");break;
306 case MFDES_CREATE_CYCLIC_RECORD_FILE :snprintf(exp, size, "CREATE CYCLIC RECORD FILE");break;
307 case MFDES_DELETE_FILE :snprintf(exp, size, "DELETE FILE");break;
308 case MFDES_AUTHENTICATE :snprintf(exp, size, "AUTH NATIVE (keyNo %d)", cmd[pos+1]);break; // AUTHENTICATE_NATIVE
309 case MFDES_AUTHENTICATE_ISO :snprintf(exp, size, "AUTH ISO (keyNo %d)", cmd[pos+1]);break; // AUTHENTICATE_STANDARD
310 case MFDES_AUTHENTICATE_AES :snprintf(exp, size, "AUTH AES (keyNo %d)", cmd[pos+1]);break;
311 case MFDES_CHANGE_KEY_SETTINGS :snprintf(exp, size, "CHANGE KEY SETTINGS");break;
312 case MFDES_GET_KEY_SETTINGS :snprintf(exp, size, "GET KEY SETTINGS");break;
313 case MFDES_CHANGE_KEY :snprintf(exp, size, "CHANGE KEY");break;
314 case MFDES_GET_KEY_VERSION :snprintf(exp, size, "GET KEY VERSION");break;
315 case MFDES_AUTHENTICATION_FRAME :snprintf(exp, size, "AUTH FRAME / NEXT FRAME");break;
316 default :break;
317 }
318 }else{
319 // anything else
320 snprintf(exp,size,"?");
321 }
322 }
323}
324
08e8317c
MHS
325/**
32606 00 = INITIATE
3270E xx = SELECT ID (xx = Chip-ID)
3280B = Get UID
32908 yy = Read Block (yy = block number)
33009 yy dd dd dd dd = Write Block (yy = block number; dd dd dd dd = data to be written)
3310C = Reset to Inventory
3320F = Completion
3330A 11 22 33 44 55 66 = Authenticate (11 22 33 44 55 66 = data to authenticate)
334**/
335
c71c5ee1 336void annotateIso14443b(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize) {
41fdd0f0 337 switch(cmd[0]){
e3f9c50d 338 case ISO14443B_REQB : {
339
340 switch ( cmd[2] & 0x07 ) {
b9e66427 341 case 0: snprintf(exp, size,"1 slot ");break;
342 case 1: snprintf(exp, size,"2 slots ");break;
343 case 2: snprintf(exp, size,"4 slots ");break;
344 case 3: snprintf(exp, size,"8 slots ");break;
345 default: snprintf(exp, size,"16 slots ");break;
7bcddfab 346 }
a644fef0 347 if ( (cmd[2] & 0x8) )
e3f9c50d 348 snprintf(exp, size,"WUPB");
7bcddfab 349 else
350 snprintf(exp, size,"REQB");
e3f9c50d 351 break;
352 }
c5f8c67a 353 case ISO14443B_ATTRIB : snprintf(exp,size,"ATTRIB");break;
354 case ISO14443B_HALT : snprintf(exp,size,"HALT");break;
355 case ISO14443B_INITIATE : snprintf(exp,size,"INITIATE");break;
356 case ISO14443B_SELECT : snprintf(exp,size,"SELECT(%d)",cmd[1]);break;
357 case ISO14443B_GET_UID : snprintf(exp,size,"GET UID");break;
358 case ISO14443B_READ_BLK : snprintf(exp,size,"READ_BLK(%d)", cmd[1]);break;
359 case ISO14443B_WRITE_BLK : snprintf(exp,size,"WRITE_BLK(%d)",cmd[1]);break;
360 case ISO14443B_RESET : snprintf(exp,size,"RESET");break;
361 case ISO14443B_COMPLETION : snprintf(exp,size,"COMPLETION");break;
362 case ISO14443B_AUTHENTICATE : snprintf(exp,size,"AUTHENTICATE");break;
363 case ISO14443B_PING : snprintf(exp,size,"PING");break;
364 case ISO14443B_PONG : snprintf(exp,size,"PONG");break;
365 default : snprintf(exp,size ,"?");break;
41fdd0f0 366 }
41fdd0f0
MHS
367}
368
c71c5ee1 369// LEGIC
370// 1 = read
371// 0 = write
372// Quite simpel tag
7c91c8bf 373void annotateLegic(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize){
374 uint8_t bitsend = cmd[0];
faabfafe 375 switch (bitsend){
376 case 7:
377 snprintf(exp, size, "IV 0x%02X", cmd[1]);
378 break;
379 case 6: {
7c91c8bf 380 switch ( cmd[1] ) {
381 case LEGIC_MIM_22: snprintf(exp, size, "MIM22"); break;
382 case LEGIC_MIM_256: snprintf(exp, size, "MIM256"); break;
383 case LEGIC_MIM_1024: snprintf(exp, size, "MIM1024"); break;
384 case LEGIC_ACK_22: snprintf(exp, size, "ACK 22"); break;
385 case LEGIC_ACK_256: snprintf(exp, size, "ACK 256/1024"); break;
386 }
faabfafe 387 break;
388 }
389 case 9:
390 case 11: {
391 uint8_t cmdBit = (cmd[1] & 1);
392 uint8_t address = (cmd[2] << 7) | cmd[1] >> 1;
393
394 if (cmdBit == LEGIC_READ)
395 snprintf(exp, size, "READ Byte(%d)", address);
396
397 if (cmdBit == LEGIC_WRITE )
398 snprintf(exp, size, "WRITE Byte(%d)", address);
399 break;
400 }
401 case 12:
402 default:
403 break;
e619ddc0 404 }
c71c5ee1 405}
e619ddc0 406
41fdd0f0 407/**
0ec548dc 408 * @brief iso14443A_CRC_check Checks CRC in command or response
409 * @param isResponse
410 * @param data
411 * @param len
412 * @return 0 : CRC-command, CRC not ok
413 * 1 : CRC-command, CRC ok
414 * 2 : Not crc-command
415 */
416
417uint8_t iso14443A_CRC_check(bool isResponse, uint8_t* data, uint8_t len)
418{
419 uint8_t b1,b2;
420
421 if(len <= 2) return 2;
422
423 if(isResponse & (len < 6)) return 2;
424
425 ComputeCrc14443(CRC_14443_A, data, len-2, &b1, &b2);
426 if (b1 != data[len-2] || b2 != data[len-1]) {
427 return 0;
428 } else {
429 return 1;
430 }
431}
432
433
434/**
435 * @brief iso14443B_CRC_check Checks CRC in command or response
41fdd0f0
MHS
436 * @param isResponse
437 * @param data
438 * @param len
439 * @return 0 : CRC-command, CRC not ok
440 * 1 : CRC-command, CRC ok
441 * 2 : Not crc-command
442 */
443
444uint8_t iso14443B_CRC_check(bool isResponse, uint8_t* data, uint8_t len)
445{
446 uint8_t b1,b2;
447
448 if(len <= 2) return 2;
449
450 ComputeCrc14443(CRC_14443_B, data, len-2, &b1, &b2);
451 if(b1 != data[len-2] || b2 != data[len-1]) {
452 return 0;
0ec548dc 453 }
74c7ff47 454 return 1;
41fdd0f0
MHS
455}
456
49726b40
MHS
457/**
458 * @brief iclass_CRC_Ok Checks CRC in command or response
459 * @param isResponse
460 * @param data
461 * @param len
462 * @return 0 : CRC-command, CRC not ok
463 * 1 : CRC-command, CRC ok
464 * 2 : Not crc-command
465 */
41fdd0f0 466uint8_t iclass_CRC_check(bool isResponse, uint8_t* data, uint8_t len)
49726b40
MHS
467{
468 if(len < 4) return 2;//CRC commands (and responses) are all at least 4 bytes
469
470 uint8_t b1, b2;
471
472 if(!isResponse)//Commands to tag
473 {
474 /**
475 These commands should have CRC. Total length leftmost
476 4 READ
477 4 READ4
478 12 UPDATE - unsecured, ends with CRC16
479 14 UPDATE - secured, ends with signature instead
480 4 PAGESEL
481 **/
482 if(len == 4 || len == 12)//Covers three of them
483 {
484 //Don't include the command byte
485 ComputeCrc14443(CRC_ICLASS, (data+1), len-3, &b1, &b2);
486 return b1 == data[len -2] && b2 == data[len-1];
487 }
488 return 2;
489 }else{
490 /**
491 These tag responses should have CRC. Total length leftmost
492
493 10 READ data[8] crc[2]
494 34 READ4 data[32]crc[2]
495 10 UPDATE data[8] crc[2]
496 10 SELECT csn[8] crc[2]
497 10 IDENTIFY asnb[8] crc[2]
498 10 PAGESEL block1[8] crc[2]
499 10 DETECT csn[8] crc[2]
500
501 These should not
502
503 4 CHECK chip_response[4]
504 8 READCHECK data[8]
505 1 ACTALL sof[1]
506 1 ACT sof[1]
507
508 In conclusion, without looking at the command; any response
509 of length 10 or 34 should have CRC
510 **/
511 if(len != 10 && len != 34) return true;
512
513 ComputeCrc14443(CRC_ICLASS, data, len-2, &b1, &b2);
514 return b1 == data[len -2] && b2 == data[len-1];
515 }
516}
4c3de57a 517
c71c5ee1 518uint8_t legic_CRC_check(bool isResponse, uint8_t* data, uint8_t len){
519 if (len > 2) return 2;
e619ddc0 520
521 uint8_t calccrc = CRC8Legic(data, len);
522
c71c5ee1 523 return 0;
524 // crc_init(&legic_crc, 4, 0x19 >> 1, 0x5, 0);
525 // crc_clear(&legic_crc);
526 // crc_update(&legic_crc, 1, 1); /* CMD_READ */
527 // crc_update(&legic_crc, byte_index, cmd_sz-1);
528 // crc_update(&legic_crc, value, 8);
529 // return crc_finish(&legic_crc);
530}
0ec548dc 531
532bool is_last_record(uint16_t tracepos, uint8_t *trace, uint16_t traceLen)
4c3de57a 533{
0ec548dc 534 return(tracepos + sizeof(uint32_t) + sizeof(uint16_t) + sizeof(uint16_t) >= traceLen);
535}
536
537
538bool next_record_is_response(uint16_t tracepos, uint8_t *trace)
539{
540 uint16_t next_records_datalen = *((uint16_t *)(trace + tracepos + sizeof(uint32_t) + sizeof(uint16_t)));
541
542 return(next_records_datalen & 0x8000);
543}
544
545
546bool merge_topaz_reader_frames(uint32_t timestamp, uint32_t *duration, uint16_t *tracepos, uint16_t traceLen, uint8_t *trace, uint8_t *frame, uint8_t *topaz_reader_command, uint16_t *data_len)
547{
548
549#define MAX_TOPAZ_READER_CMD_LEN 16
4c3de57a 550
0ec548dc 551 uint32_t last_timestamp = timestamp + *duration;
552
553 if ((*data_len != 1) || (frame[0] == TOPAZ_WUPA) || (frame[0] == TOPAZ_REQA)) return false;
554
555 memcpy(topaz_reader_command, frame, *data_len);
556
557 while (!is_last_record(*tracepos, trace, traceLen) && !next_record_is_response(*tracepos, trace)) {
558 uint32_t next_timestamp = *((uint32_t *)(trace + *tracepos));
559 *tracepos += sizeof(uint32_t);
560 uint16_t next_duration = *((uint16_t *)(trace + *tracepos));
561 *tracepos += sizeof(uint16_t);
562 uint16_t next_data_len = *((uint16_t *)(trace + *tracepos)) & 0x7FFF;
563 *tracepos += sizeof(uint16_t);
564 uint8_t *next_frame = (trace + *tracepos);
565 *tracepos += next_data_len;
566 if ((next_data_len == 1) && (*data_len + next_data_len <= MAX_TOPAZ_READER_CMD_LEN)) {
567 memcpy(topaz_reader_command + *data_len, next_frame, next_data_len);
568 *data_len += next_data_len;
569 last_timestamp = next_timestamp + next_duration;
570 } else {
571 // rewind and exit
572 *tracepos = *tracepos - next_data_len - sizeof(uint16_t) - sizeof(uint16_t) - sizeof(uint32_t);
573 break;
574 }
575 uint16_t next_parity_len = (next_data_len-1)/8 + 1;
576 *tracepos += next_parity_len;
577 }
578
579 *duration = last_timestamp - timestamp;
580
581 return true;
582}
583
584
585uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, uint8_t protocol, bool showWaitCycles, bool markCRCBytes)
586{
587 bool isResponse;
588 uint16_t data_len, parity_len;
589 uint32_t duration;
590 uint8_t topaz_reader_command[9];
4c3de57a
MHS
591 uint32_t timestamp, first_timestamp, EndOfTransmissionTimestamp;
592 char explanation[30] = {0};
593
f71f4deb 594 if (tracepos + sizeof(uint32_t) + sizeof(uint16_t) + sizeof(uint16_t) > traceLen) return traceLen;
595
4c3de57a
MHS
596 first_timestamp = *((uint32_t *)(trace));
597 timestamp = *((uint32_t *)(trace + tracepos));
4c3de57a
MHS
598
599 tracepos += 4;
600 duration = *((uint16_t *)(trace + tracepos));
601 tracepos += 2;
602 data_len = *((uint16_t *)(trace + tracepos));
603 tracepos += 2;
604
605 if (data_len & 0x8000) {
606 data_len &= 0x7fff;
607 isResponse = true;
608 } else {
609 isResponse = false;
610 }
611 parity_len = (data_len-1)/8 + 1;
612
f71f4deb 613 if (tracepos + data_len + parity_len > traceLen) {
614 return traceLen;
4c3de57a 615 }
4c3de57a
MHS
616 uint8_t *frame = trace + tracepos;
617 tracepos += data_len;
618 uint8_t *parityBytes = trace + tracepos;
619 tracepos += parity_len;
620
0ec548dc 621 if (protocol == TOPAZ && !isResponse) {
622 // topaz reader commands come in 1 or 9 separate frames with 7 or 8 Bits each.
623 // merge them:
624 if (merge_topaz_reader_frames(timestamp, &duration, &tracepos, traceLen, trace, frame, topaz_reader_command, &data_len)) {
625 frame = topaz_reader_command;
626 }
627 }
628
27eabcdc
MHS
629 //Check the CRC status
630 uint8_t crcStatus = 2;
631
632 if (data_len > 2) {
0ec548dc 633 switch (protocol) {
634 case ICLASS:
63146229 635 crcStatus = iclass_CRC_check(isResponse, frame, data_len);
0ec548dc 636 break;
637 case ISO_14443B:
638 case TOPAZ:
63146229 639 crcStatus = iso14443B_CRC_check(isResponse, frame, data_len);
0ec548dc 640 break;
641 case ISO_14443A:
7e08450d 642 case MFDES:
0ec548dc 643 crcStatus = iso14443A_CRC_check(isResponse, frame, data_len);
c71c5ee1 644 break;
0ec548dc 645 default:
646 break;
27eabcdc 647 }
c71c5ee1 648 } else if ( data_len == 2 && protocol == LEGIC ){
649 crcStatus = legic_CRC_check(isResponse, frame, data_len);
27eabcdc
MHS
650 }
651 //0 CRC-command, CRC not ok
652 //1 CRC-command, CRC ok
653 //2 Not crc-command
9e8255d4 654
4c3de57a
MHS
655 //--- Draw the data column
656 char line[16][110];
9e8255d4
MHS
657
658 for (int j = 0; j < data_len && j/16 < 16; j++) {
659
4c3de57a
MHS
660 int oddparity = 0x01;
661 int k;
662
663 for (k=0 ; k<8 ; k++) {
664 oddparity ^= (((frame[j] & 0xFF) >> k) & 0x01);
665 }
4c3de57a 666 uint8_t parityBits = parityBytes[j>>3];
774560e3 667 if (protocol != ISO_14443B && protocol != ISO_7816_4 && (isResponse || protocol == ISO_14443A) && (oddparity != ((parityBits >> (7-(j&0x0007))) & 0x01))) {
9e8255d4 668 snprintf(line[j/16]+(( j % 16) * 4),110, "%02x! ", frame[j]);
4c3de57a 669 } else {
8b9393d3 670 snprintf(line[j/16]+(( j % 16) * 4),110, "%02x ", frame[j]);
9e8255d4 671 }
22e24700 672
27eabcdc 673 }
0ec548dc 674
675 if (markCRCBytes) {
63146229 676 //CRC-command
677 if(crcStatus == 0 || crcStatus == 1) {
0ec548dc 678 char *pos1 = line[(data_len-2)/16]+(((data_len-2) % 16) * 4);
63146229 679 (*pos1) = '[';
0ec548dc 680 char *pos2 = line[(data_len)/16]+(((data_len) % 16) * 4);
681 sprintf(pos2, "%c", ']');
682 }
9e8255d4 683 }
0ec548dc 684
7c91c8bf 685 if (data_len == 0 ) {
63146229 686 sprintf(line[0],"<empty trace - possible error>");
7c91c8bf 687 return tracepos;
688 }
774560e3 689
7c91c8bf 690 // Draw the CRC column
49726b40 691 char *crc = (crcStatus == 0 ? "!crc" : (crcStatus == 1 ? " ok " : " "));
4c3de57a
MHS
692
693 EndOfTransmissionTimestamp = timestamp + duration;
694
7c91c8bf 695 // Always annotate LEGIC read/tag
696 if ( protocol == LEGIC )
697 annotateLegic(explanation,sizeof(explanation),frame,data_len);
698
e619ddc0 699 if (!isResponse) {
0ec548dc 700 switch(protocol) {
701 case ICLASS: annotateIclass(explanation,sizeof(explanation),frame,data_len); break;
702 case ISO_14443A: annotateIso14443a(explanation,sizeof(explanation),frame,data_len); break;
7e08450d 703 case MFDES: annotateMfDesfire(explanation,sizeof(explanation),frame,data_len); break;
0ec548dc 704 case ISO_14443B: annotateIso14443b(explanation,sizeof(explanation),frame,data_len); break;
705 case TOPAZ: annotateTopaz(explanation,sizeof(explanation),frame,data_len); break;
c5f8c67a 706 case ISO_7816_4: annotateIso7816(explanation,sizeof(explanation),frame,data_len); break;
7c91c8bf 707
0ec548dc 708 default: break;
709 }
4c3de57a
MHS
710 }
711
9e8255d4
MHS
712 int num_lines = MIN((data_len - 1)/16 + 1, 16);
713 for (int j = 0; j < num_lines ; j++) {
4c3de57a 714 if (j == 0) {
1b12afbd 715 PrintAndLog(" %10u | %10u | %s |%-64s | %s| %s",
4c3de57a
MHS
716 (timestamp - first_timestamp),
717 (EndOfTransmissionTimestamp - first_timestamp),
718 (isResponse ? "Tag" : "Rdr"),
719 line[j],
720 (j == num_lines-1) ? crc : " ",
721 (j == num_lines-1) ? explanation : "");
722 } else {
63146229 723 PrintAndLog(" | | |%-64s | %s| %s",
4c3de57a 724 line[j],
63146229 725 (j == num_lines-1) ? crc : " ",
4c3de57a
MHS
726 (j == num_lines-1) ? explanation : "");
727 }
728 }
729
0ec548dc 730 if (is_last_record(tracepos, trace, traceLen)) return traceLen;
f71f4deb 731
0ec548dc 732 if (showWaitCycles && !isResponse && next_record_is_response(tracepos, trace)) {
4c3de57a 733 uint32_t next_timestamp = *((uint32_t *)(trace + tracepos));
1b12afbd 734 PrintAndLog(" %10u | %10u | %s |fdt (Frame Delay Time): %d",
4c3de57a
MHS
735 (EndOfTransmissionTimestamp - first_timestamp),
736 (next_timestamp - first_timestamp),
737 " ",
738 (next_timestamp - EndOfTransmissionTimestamp));
739 }
f71f4deb 740
4c3de57a
MHS
741 return tracepos;
742}
743
afa86e5c 744int usage_hf_list(){
745 PrintAndLog("List protocol data in trace buffer.");
746 PrintAndLog("Usage: hf list <protocol> [f][c]");
747 PrintAndLog(" f - show frame delay times as well");
748 PrintAndLog(" c - mark CRC bytes");
749 PrintAndLog("Supported <protocol> values:");
750 PrintAndLog(" raw - just show raw data without annotations");
751 PrintAndLog(" 14a - interpret data as iso14443a communications");
752 PrintAndLog(" 14b - interpret data as iso14443b communications");
c71c5ee1 753 PrintAndLog(" des - interpret data as DESFire communications");
afa86e5c 754 PrintAndLog(" iclass - interpret data as iclass communications");
755 PrintAndLog(" topaz - interpret data as topaz communications");
756 PrintAndLog(" 7816 - interpret data as iso7816-4 communications");
c71c5ee1 757 PrintAndLog(" legic - interpret data as LEGIC communications");
afa86e5c 758 PrintAndLog("");
759 PrintAndLog("example: hf list 14a f");
760 PrintAndLog(" hf list iclass");
761 return 0;
762}
763int usage_hf_search(){
764 PrintAndLog("Usage: hf search");
765 PrintAndLog("Will try to find a HF read out of the unknown tag. Stops when found.");
766 PrintAndLog("Options:");
767 PrintAndLog(" h - This help");
768 PrintAndLog("");
769 return 0;
770}
771int usage_hf_snoop(){
772 PrintAndLog("Usage: hf snoop <skip pairs> <skip triggers>");
773 PrintAndLog("The high frequence snoop will assign all available memory on device for snooped data");
774 PrintAndLog("User the 'data samples' command to download from device, and 'data plot' to look at it");
775 PrintAndLog("Press button to quit the snooping.");
776 PrintAndLog("Options:");
777 PrintAndLog(" h - This help");
778 PrintAndLog(" <skip pairs> - skip sample pairs");
779 PrintAndLog(" <skip triggers> - skip number of triggers");
780 PrintAndLog("");
781 PrintAndLog("example: hf snoop");
782 PrintAndLog(" hf snoop 1000 0");
783 return 0;
784}
f71f4deb 785
c71c5ee1 786int CmdHFList(const char *Cmd) {
38e41917 787 clearCommandBuffer();
788
4c3de57a 789 bool showWaitCycles = false;
0ec548dc 790 bool markCRCBytes = false;
afa86e5c 791 char type[10] = {0};
792 //int tlen = param_getstr(Cmd,0,type);
0ec548dc 793 char param1 = param_getchar(Cmd, 1);
794 char param2 = param_getchar(Cmd, 2);
4c3de57a 795 bool errors = false;
b689b842 796 uint8_t protocol = 0;
4c3de57a 797
afa86e5c 798 //Validate params H or empty
799 if (strlen(Cmd) < 1 || param1 == 'h' || param1 == 'H') return usage_hf_list();
800
801 //Validate params F,C
802 if(
803 (param1 != 0 && param1 != 'f' && param1 != 'c') ||
804 (param2 != 0 && param2 != 'f' && param2 != 'c')
805 ) {
806 return usage_hf_list();
4c3de57a 807 }
b689b842 808
afa86e5c 809 param_getstr(Cmd,0,type);
810
811 // validate type of output
812 if(strcmp(type, "iclass") == 0) protocol = ICLASS;
813 else if(strcmp(type, "14a") == 0) protocol = ISO_14443A;
814 else if(strcmp(type, "14b") == 0) protocol = ISO_14443B;
815 else if(strcmp(type, "topaz")== 0) protocol = TOPAZ;
7e08450d 816 else if(strcmp(type, "7816")== 0) protocol = ISO_7816_4;
c71c5ee1 817 else if(strcmp(type,"des")== 0) protocol = MFDES;
818 else if(strcmp(type,"legic")==0) protocol = LEGIC;
afa86e5c 819 else if(strcmp(type, "raw")== 0) protocol = -1;//No crc, no annotations
820 else errors = true;
4c3de57a 821
afa86e5c 822 if (errors) return usage_hf_list();
4c3de57a 823
afa86e5c 824 if (param1 == 'f' || param2 == 'f') showWaitCycles = true;
825 if (param1 == 'c' || param2 == 'c') markCRCBytes = true;
4c3de57a 826
f71f4deb 827 uint8_t *trace;
4c3de57a 828 uint16_t tracepos = 0;
f71f4deb 829 trace = malloc(USB_CMD_DATA_SIZE);
830
831 // Query for the size of the trace
832 UsbCommand response;
833 GetFromBigBuf(trace, USB_CMD_DATA_SIZE, 0);
834 WaitForResponse(CMD_ACK, &response);
835 uint16_t traceLen = response.arg[2];
836 if (traceLen > USB_CMD_DATA_SIZE) {
837 uint8_t *p = realloc(trace, traceLen);
838 if (p == NULL) {
839 PrintAndLog("Cannot allocate memory for trace");
840 free(trace);
841 return 2;
842 }
843 trace = p;
844 GetFromBigBuf(trace, traceLen, 0);
845 WaitForResponse(CMD_ACK, NULL);
846 }
847
848 PrintAndLog("Recorded Activity (TraceLen = %d bytes)", traceLen);
4c3de57a
MHS
849 PrintAndLog("");
850 PrintAndLog("Start = Start of Start Bit, End = End of last modulation. Src = Source of Transfer");
851 PrintAndLog("iso14443a - All times are in carrier periods (1/13.56Mhz)");
852 PrintAndLog("iClass - Timings are not as accurate");
853 PrintAndLog("");
aa60d156 854 PrintAndLog(" Start | End | Src | Data (! denotes parity error) | CRC | Annotation |");
855 PrintAndLog("------------|------------|-----|-----------------------------------------------------------------|-----|--------------------|");
4c3de57a 856
c71c5ee1 857 while(tracepos < traceLen) {
0ec548dc 858 tracepos = printTraceLine(tracepos, traceLen, trace, protocol, showWaitCycles, markCRCBytes);
4c3de57a 859 }
f71f4deb 860
861 free(trace);
4c3de57a
MHS
862 return 0;
863}
864
b6901e17 865int CmdHFSearch(const char *Cmd){
afa86e5c 866
867 char cmdp = param_getchar(Cmd, 0);
868 if (cmdp == 'h' || cmdp == 'H') return usage_hf_search();
869
63146229 870 PrintAndLog("");
afa86e5c 871 int ans = CmdHF14AReader("s");
872
63146229 873 if (ans > 0) {
c98ab351 874 PrintAndLog("\nValid ISO14443-A Tag Found - Quiting Search\n");
63146229 875 return ans;
876 }
e3f9c50d 877 ans = CmdHF14BReader("s");
22e24700 878 if (ans) {
c98ab351 879 PrintAndLog("\nValid ISO14443-B Tag Found - Quiting Search\n");
22e24700 880 return ans;
881 }
63146229 882 ans = HFiClassReader("", false, false);
883 if (ans) {
884 PrintAndLog("\nValid iClass Tag (or PicoPass Tag) Found - Quiting Search\n");
885 return ans;
886 }
887 ans = HF15Reader("", false);
888 if (ans) {
889 PrintAndLog("\nValid ISO15693 Tag Found - Quiting Search\n");
890 return ans;
891 }
1f3d5401 892 ans = CmdHFTopazReader("s");
3607b5a9 893 if (ans == 0) {
894 PrintAndLog("\nValid Topaz Tag Found - Quiting Search\n");
895 return 1;
896 }
3e750be3 897 ans = HFLegicInfo("", false);
898 if ( ans == 0) {
899 PrintAndLog("\nValid LEGIC Tag Found - Quiting Search\n");
900 return 1;
901 }
902
22e24700 903 PrintAndLog("\nno known/supported 13.56 MHz tags found\n");
b6901e17 904 return 0;
905}
7fe9b0b7 906
c71c5ee1 907int CmdHFSnoop(const char *Cmd) {
afa86e5c 908 char cmdp = param_getchar(Cmd, 0);
909 if (cmdp == 'h' || cmdp == 'H') return usage_hf_snoop();
910
911 int skippairs = param_get32ex(Cmd, 0, 0, 10);
912 int skiptriggers = param_get32ex(Cmd, 1, 0, 10);
913
e3f9c50d 914 UsbCommand c = {CMD_HF_SNIFFER, {skippairs, skiptriggers, 0}};
38e41917 915 clearCommandBuffer();
1d0ccbe0 916 SendCommand(&c);
917 return 0;
918}
919
38e41917 920static command_t CommandTable[] = {
921 {"help", CmdHelp, 1, "This help"},
922 {"14a", CmdHF14A, 1, "{ ISO14443A RFIDs... }"},
923 {"14b", CmdHF14B, 1, "{ ISO14443B RFIDs... }"},
924 {"15", CmdHF15, 1, "{ ISO15693 RFIDs... }"},
925 {"epa", CmdHFEPA, 1, "{ German Identification Card... }"},
5147ec69 926 {"legic", CmdHFLegic, 1, "{ LEGIC RFIDs... }"},
38e41917 927 {"iclass", CmdHFiClass, 1, "{ ICLASS RFIDs... }"},
928 {"mf", CmdHFMF, 1, "{ MIFARE RFIDs... }"},
929 {"mfu", CmdHFMFUltra, 1, "{ MIFARE Ultralight RFIDs... }"},
930 {"mfdes", CmdHFMFDes, 1, "{ MIFARE Desfire RFIDs... }"},
931 {"topaz", CmdHFTopaz, 1, "{ TOPAZ (NFC Type 1) RFIDs... }"},
932 {"tune", CmdHFTune, 0, "Continuously measure HF antenna tuning"},
933 {"list", CmdHFList, 1, "List protocol data in trace buffer"},
934 {"search", CmdHFSearch, 1, "Search for known HF tags [preliminary]"},
935 {"snoop", CmdHFSnoop, 0, "<samples to skip (10000)> <triggers to skip (1)> Generic LF/HF Snoop in Testing stage"},
4c3de57a 936 {NULL, NULL, 0, NULL}
7fe9b0b7 937};
938
4c36581b 939int CmdHF(const char *Cmd) {
940 clearCommandBuffer();
941 CmdsParse(CommandTable, Cmd);
942 return 0;
7fe9b0b7 943}
944
4c36581b 945int CmdHelp(const char *Cmd) {
946 CmdsHelp(CommandTable);
947 return 0;
7fe9b0b7 948}
Impressum, Datenschutz