mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 22:03:42 -07:00
use PrintAndLogEx() instead of PrintAndLog()
This commit is contained in:
parent
92a42c2189
commit
7e125b9bfb
1 changed files with 70 additions and 70 deletions
140
client/cmdhf.c
140
client/cmdhf.c
|
@ -13,52 +13,52 @@
|
||||||
static int CmdHelp(const char *Cmd);
|
static int CmdHelp(const char *Cmd);
|
||||||
|
|
||||||
int usage_hf_list(){
|
int usage_hf_list(){
|
||||||
PrintAndLog("List protocol data in trace buffer.");
|
PrintAndLogEx(NORMAL, "List protocol data in trace buffer.");
|
||||||
PrintAndLog("Usage: hf list <protocol> [f][c]");
|
PrintAndLogEx(NORMAL, "Usage: hf list <protocol> [f][c]");
|
||||||
PrintAndLog(" f - show frame delay times as well");
|
PrintAndLogEx(NORMAL, " f - show frame delay times as well");
|
||||||
PrintAndLog(" c - mark CRC bytes");
|
PrintAndLogEx(NORMAL, " c - mark CRC bytes");
|
||||||
PrintAndLog("Supported <protocol> values:");
|
PrintAndLogEx(NORMAL, "Supported <protocol> values:");
|
||||||
PrintAndLog(" raw - just show raw data without annotations");
|
PrintAndLogEx(NORMAL, " raw - just show raw data without annotations");
|
||||||
PrintAndLog(" 14a - interpret data as iso14443a communications");
|
PrintAndLogEx(NORMAL, " 14a - interpret data as iso14443a communications");
|
||||||
PrintAndLog(" mf - interpret data as iso14443a communications and decrypt crypto1 stream");
|
PrintAndLogEx(NORMAL, " mf - interpret data as iso14443a communications and decrypt crypto1 stream");
|
||||||
PrintAndLog(" 14b - interpret data as iso14443b communications");
|
PrintAndLogEx(NORMAL, " 14b - interpret data as iso14443b communications");
|
||||||
PrintAndLog(" 15 - interpret data as iso15693 communications");
|
PrintAndLogEx(NORMAL, " 15 - interpret data as iso15693 communications");
|
||||||
PrintAndLog(" des - interpret data as DESFire communications");
|
PrintAndLogEx(NORMAL, " des - interpret data as DESFire communications");
|
||||||
#ifdef WITH_EMV
|
#ifdef WITH_EMV
|
||||||
PrintAndLog(" emv - interpret data as EMV / communications");
|
PrintAndLogEx(NORMAL, " emv - interpret data as EMV / communications");
|
||||||
#endif
|
#endif
|
||||||
PrintAndLog(" iclass - interpret data as iclass communications");
|
PrintAndLogEx(NORMAL, " iclass - interpret data as iclass communications");
|
||||||
PrintAndLog(" topaz - interpret data as topaz communications");
|
PrintAndLogEx(NORMAL, " topaz - interpret data as topaz communications");
|
||||||
PrintAndLog(" 7816 - interpret data as iso7816-4 communications");
|
PrintAndLogEx(NORMAL, " 7816 - interpret data as iso7816-4 communications");
|
||||||
PrintAndLog(" legic - interpret data as LEGIC communications");
|
PrintAndLogEx(NORMAL, " legic - interpret data as LEGIC communications");
|
||||||
PrintAndLog(" felica - interpret data as ISO18092 / FeliCa communications");
|
PrintAndLogEx(NORMAL, " felica - interpret data as ISO18092 / FeliCa communications");
|
||||||
PrintAndLog("");
|
PrintAndLogEx(NORMAL, "");
|
||||||
PrintAndLog("Examples:");
|
PrintAndLogEx(NORMAL, "Examples:");
|
||||||
PrintAndLog(" hf list 14a f");
|
PrintAndLogEx(NORMAL, " hf list 14a f");
|
||||||
PrintAndLog(" hf list iclass");
|
PrintAndLogEx(NORMAL, " hf list iclass");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int usage_hf_search(){
|
int usage_hf_search(){
|
||||||
PrintAndLog("Usage: hf search");
|
PrintAndLogEx(NORMAL, "Usage: hf search");
|
||||||
PrintAndLog("Will try to find a HF read out of the unknown tag. Stops when found.");
|
PrintAndLogEx(NORMAL, "Will try to find a HF read out of the unknown tag. Stops when found.");
|
||||||
PrintAndLog("Options:");
|
PrintAndLogEx(NORMAL, "Options:");
|
||||||
PrintAndLog(" h - This help");
|
PrintAndLogEx(NORMAL, " h - This help");
|
||||||
PrintAndLog("");
|
PrintAndLogEx(NORMAL, "");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int usage_hf_snoop(){
|
int usage_hf_snoop(){
|
||||||
PrintAndLog("Usage: hf snoop <skip pairs> <skip triggers>");
|
PrintAndLogEx(NORMAL, "Usage: hf snoop <skip pairs> <skip triggers>");
|
||||||
PrintAndLog("The high frequence snoop will assign all available memory on device for snooped data");
|
PrintAndLogEx(NORMAL, "The high frequence snoop will assign all available memory on device for snooped data");
|
||||||
PrintAndLog("User the 'data samples' command to download from device, and 'data plot' to look at it");
|
PrintAndLogEx(NORMAL, "User the 'data samples' command to download from device, and 'data plot' to look at it");
|
||||||
PrintAndLog("Press button to quit the snooping.");
|
PrintAndLogEx(NORMAL, "Press button to quit the snooping.");
|
||||||
PrintAndLog("Options:");
|
PrintAndLogEx(NORMAL, "Options:");
|
||||||
PrintAndLog(" h - This help");
|
PrintAndLogEx(NORMAL, " h - This help");
|
||||||
PrintAndLog(" <skip pairs> - skip sample pairs");
|
PrintAndLogEx(NORMAL, " <skip pairs> - skip sample pairs");
|
||||||
PrintAndLog(" <skip triggers> - skip number of triggers");
|
PrintAndLogEx(NORMAL, " <skip triggers> - skip number of triggers");
|
||||||
PrintAndLog("");
|
PrintAndLogEx(NORMAL, "");
|
||||||
PrintAndLog("Examples:");
|
PrintAndLogEx(NORMAL, "Examples:");
|
||||||
PrintAndLog(" hf snoop");
|
PrintAndLogEx(NORMAL, " hf snoop");
|
||||||
PrintAndLog(" hf snoop 1000 0");
|
PrintAndLogEx(NORMAL, " hf snoop 1000 0");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, ui
|
||||||
int num_lines = MIN((data_len - 1)/18 + 1, 18);
|
int num_lines = MIN((data_len - 1)/18 + 1, 18);
|
||||||
for (int j = 0; j < num_lines ; j++) {
|
for (int j = 0; j < num_lines ; j++) {
|
||||||
if (j == 0) {
|
if (j == 0) {
|
||||||
PrintAndLog(" %10u | %10u | %s |%-72s | %s| %s",
|
PrintAndLogEx(NORMAL, " %10u | %10u | %s |%-72s | %s| %s",
|
||||||
(timestamp - first_timestamp),
|
(timestamp - first_timestamp),
|
||||||
(EndOfTransmissionTimestamp - first_timestamp),
|
(EndOfTransmissionTimestamp - first_timestamp),
|
||||||
(isResponse ? "Tag" : "Rdr"),
|
(isResponse ? "Tag" : "Rdr"),
|
||||||
|
@ -257,7 +257,7 @@ uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, ui
|
||||||
(j == num_lines-1) ? crc : " ",
|
(j == num_lines-1) ? crc : " ",
|
||||||
(j == num_lines-1) ? explanation : "");
|
(j == num_lines-1) ? explanation : "");
|
||||||
} else {
|
} else {
|
||||||
PrintAndLog(" | | |%-72s | %s| %s",
|
PrintAndLogEx(NORMAL, " | | |%-72s | %s| %s",
|
||||||
line[j],
|
line[j],
|
||||||
(j == num_lines-1) ? crc : " ",
|
(j == num_lines-1) ? crc : " ",
|
||||||
(j == num_lines-1) ? explanation : "");
|
(j == num_lines-1) ? explanation : "");
|
||||||
|
@ -270,7 +270,7 @@ uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, ui
|
||||||
annotateIso14443a(explanation, sizeof(explanation), mfData, mfDataLen);
|
annotateIso14443a(explanation, sizeof(explanation), mfData, mfDataLen);
|
||||||
}
|
}
|
||||||
uint8_t crcc = iso14443A_CRC_check(isResponse, mfData, mfDataLen);
|
uint8_t crcc = iso14443A_CRC_check(isResponse, mfData, mfDataLen);
|
||||||
PrintAndLog(" | | * |%-72s | %-4s| %s",
|
PrintAndLogEx(NORMAL, " | | * |%-72s | %-4s| %s",
|
||||||
sprint_hex_inrow_spaces(mfData, mfDataLen, 2),
|
sprint_hex_inrow_spaces(mfData, mfDataLen, 2),
|
||||||
(crcc == 0 ? "!crc" : (crcc == 1 ? " ok " : " ")),
|
(crcc == 0 ? "!crc" : (crcc == 1 ? " ok " : " ")),
|
||||||
explanation);
|
explanation);
|
||||||
|
@ -280,7 +280,7 @@ uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, ui
|
||||||
|
|
||||||
if (showWaitCycles && !isResponse && next_record_is_response(tracepos, trace)) {
|
if (showWaitCycles && !isResponse && next_record_is_response(tracepos, trace)) {
|
||||||
uint32_t next_timestamp = *((uint32_t *)(trace + tracepos));
|
uint32_t next_timestamp = *((uint32_t *)(trace + tracepos));
|
||||||
PrintAndLog(" %10u | %10u | %s |fdt (Frame Delay Time): %d",
|
PrintAndLogEx(NORMAL, " %10u | %10u | %s |fdt (Frame Delay Time): %d",
|
||||||
(EndOfTransmissionTimestamp - first_timestamp),
|
(EndOfTransmissionTimestamp - first_timestamp),
|
||||||
(next_timestamp - first_timestamp),
|
(next_timestamp - first_timestamp),
|
||||||
" ",
|
" ",
|
||||||
|
@ -292,8 +292,8 @@ uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, ui
|
||||||
|
|
||||||
void printFelica(uint16_t traceLen, uint8_t *trace) {
|
void printFelica(uint16_t traceLen, uint8_t *trace) {
|
||||||
|
|
||||||
PrintAndLog(" Gap | Src | Data | CRC | Annotation |");
|
PrintAndLogEx(NORMAL, " Gap | Src | Data | CRC | Annotation |");
|
||||||
PrintAndLog("--------|-----|---------------------------------|----------|-------------------|");
|
PrintAndLogEx(NORMAL, "--------|-----|---------------------------------|----------|-------------------|");
|
||||||
uint16_t tracepos = 0;
|
uint16_t tracepos = 0;
|
||||||
|
|
||||||
while( tracepos < traceLen) {
|
while( tracepos < traceLen) {
|
||||||
|
@ -382,7 +382,7 @@ void printFelica(uint16_t traceLen, uint8_t *trace) {
|
||||||
int num_lines = MIN((len )/16 + 1, 16);
|
int num_lines = MIN((len )/16 + 1, 16);
|
||||||
for (int j = 0; j < num_lines ; j++) {
|
for (int j = 0; j < num_lines ; j++) {
|
||||||
if (j == 0) {
|
if (j == 0) {
|
||||||
PrintAndLog("%7d | %s |%-32s |%02x %02x %s| %s",
|
PrintAndLogEx(NORMAL, "%7d | %s |%-32s |%02x %02x %s| %s",
|
||||||
gap,
|
gap,
|
||||||
(isResponse ? "Tag" : "Rdr"),
|
(isResponse ? "Tag" : "Rdr"),
|
||||||
line[j],
|
line[j],
|
||||||
|
@ -391,12 +391,12 @@ void printFelica(uint16_t traceLen, uint8_t *trace) {
|
||||||
(crc_ok) ? "OK" : "NG",
|
(crc_ok) ? "OK" : "NG",
|
||||||
expbuf);
|
expbuf);
|
||||||
} else {
|
} else {
|
||||||
PrintAndLog(" | |%-32s | | ", line[j]);
|
PrintAndLogEx(NORMAL, " | |%-32s | | ", line[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tracepos += len + 1;
|
tracepos += len + 1;
|
||||||
}
|
}
|
||||||
PrintAndLog("");
|
PrintAndLogEx(NORMAL, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
int CmdHFList(const char *Cmd) {
|
int CmdHFList(const char *Cmd) {
|
||||||
|
@ -451,7 +451,7 @@ int CmdHFList(const char *Cmd) {
|
||||||
UsbCommand response;
|
UsbCommand response;
|
||||||
GetFromBigBuf(trace, USB_CMD_DATA_SIZE, 0);
|
GetFromBigBuf(trace, USB_CMD_DATA_SIZE, 0);
|
||||||
if ( !WaitForResponseTimeout(CMD_ACK, &response, 4000) ) {
|
if ( !WaitForResponseTimeout(CMD_ACK, &response, 4000) ) {
|
||||||
PrintAndLog("timeout while waiting for reply.");
|
PrintAndLogEx(FAILED, "timeout while waiting for reply.");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,7 +459,7 @@ int CmdHFList(const char *Cmd) {
|
||||||
if (traceLen > USB_CMD_DATA_SIZE) {
|
if (traceLen > USB_CMD_DATA_SIZE) {
|
||||||
uint8_t *p = realloc(trace, traceLen);
|
uint8_t *p = realloc(trace, traceLen);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
PrintAndLog("Cannot allocate memory for trace");
|
PrintAndLogEx(FAILED, "Cannot allocate memory for trace");
|
||||||
free(trace);
|
free(trace);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
@ -468,26 +468,26 @@ int CmdHFList(const char *Cmd) {
|
||||||
WaitForResponse(CMD_ACK, NULL);
|
WaitForResponse(CMD_ACK, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintAndLog("Recorded Activity (TraceLen = %d bytes)", traceLen);
|
PrintAndLogEx(NORMAL, "Recorded Activity (TraceLen = %d bytes)", traceLen);
|
||||||
PrintAndLog("");
|
PrintAndLogEx(NORMAL, "");
|
||||||
if (protocol == FELICA) {
|
if (protocol == FELICA) {
|
||||||
printFelica(traceLen, trace);
|
printFelica(traceLen, trace);
|
||||||
} else {
|
} else {
|
||||||
PrintAndLog("Start = Start of Start Bit, End = End of last modulation. Src = Source of Transfer");
|
PrintAndLogEx(NORMAL, "Start = Start of Start Bit, End = End of last modulation. Src = Source of Transfer");
|
||||||
if ( protocol == ISO_14443A || protocol == PROTO_MIFARE)
|
if ( protocol == ISO_14443A || protocol == PROTO_MIFARE)
|
||||||
PrintAndLog("iso14443a - All times are in carrier periods (1/13.56Mhz)");
|
PrintAndLogEx(NORMAL, "iso14443a - All times are in carrier periods (1/13.56Mhz)");
|
||||||
if ( protocol == ICLASS )
|
if ( protocol == ICLASS )
|
||||||
PrintAndLog("iClass - Timings are not as accurate");
|
PrintAndLogEx(NORMAL, "iClass - Timings are not as accurate");
|
||||||
if ( protocol == LEGIC )
|
if ( protocol == LEGIC )
|
||||||
PrintAndLog("LEGIC - Timings are in ticks (1us == 1.5ticks)");
|
PrintAndLogEx(NORMAL, "LEGIC - Timings are in ticks (1us == 1.5ticks)");
|
||||||
if ( protocol == ISO_15693 )
|
if ( protocol == ISO_15693 )
|
||||||
PrintAndLog("ISO15693 - Timings are not as accurate");
|
PrintAndLogEx(NORMAL, "ISO15693 - Timings are not as accurate");
|
||||||
if ( protocol == FELICA )
|
if ( protocol == FELICA )
|
||||||
PrintAndLog("ISO18092 / FeliCa - Timings are not as accurate");
|
PrintAndLogEx(NORMAL, "ISO18092 / FeliCa - Timings are not as accurate");
|
||||||
|
|
||||||
PrintAndLog("");
|
PrintAndLogEx(NORMAL, "");
|
||||||
PrintAndLog(" Start | End | Src | Data (! denotes parity error) | CRC | Annotation");
|
PrintAndLogEx(NORMAL, " Start | End | Src | Data (! denotes parity error) | CRC | Annotation");
|
||||||
PrintAndLog("------------+------------+-----+-------------------------------------------------------------------------+-----+--------------------");
|
PrintAndLogEx(NORMAL, "------------+------------+-----+-------------------------------------------------------------------------+-----+--------------------");
|
||||||
|
|
||||||
ClearAuthData();
|
ClearAuthData();
|
||||||
while(tracepos < traceLen) {
|
while(tracepos < traceLen) {
|
||||||
|
@ -503,53 +503,53 @@ int CmdHFSearch(const char *Cmd){
|
||||||
char cmdp = param_getchar(Cmd, 0);
|
char cmdp = param_getchar(Cmd, 0);
|
||||||
if (cmdp == 'h' || cmdp == 'H') return usage_hf_search();
|
if (cmdp == 'h' || cmdp == 'H') return usage_hf_search();
|
||||||
|
|
||||||
PrintAndLog("");
|
PrintAndLogEx(NORMAL, "");
|
||||||
int ans = CmdHF14AInfo("s");
|
int ans = CmdHF14AInfo("s");
|
||||||
if (ans > 0) {
|
if (ans > 0) {
|
||||||
PrintAndLog("\nValid ISO14443-A Tag Found\n");
|
PrintAndLogEx(NORMAL, "\nValid ISO14443-A Tag Found\n");
|
||||||
return ans;
|
return ans;
|
||||||
}
|
}
|
||||||
ans = HF15Reader("", false);
|
ans = HF15Reader("", false);
|
||||||
if (ans) {
|
if (ans) {
|
||||||
PrintAndLog("\nValid ISO15693 Tag Found\n");
|
PrintAndLogEx(NORMAL, "\nValid ISO15693 Tag Found\n");
|
||||||
return ans;
|
return ans;
|
||||||
}
|
}
|
||||||
ans = HFLegicReader("", false);
|
ans = HFLegicReader("", false);
|
||||||
if ( ans == 0) {
|
if ( ans == 0) {
|
||||||
PrintAndLog("\nValid LEGIC Tag Found\n");
|
PrintAndLogEx(NORMAL, "\nValid LEGIC Tag Found\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
ans = CmdHFTopazReader("s");
|
ans = CmdHFTopazReader("s");
|
||||||
if (ans == 0) {
|
if (ans == 0) {
|
||||||
PrintAndLog("\nValid Topaz Tag Found\n");
|
PrintAndLogEx(NORMAL, "\nValid Topaz Tag Found\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
// 14b and iclass is the longest test (put last)
|
// 14b and iclass is the longest test (put last)
|
||||||
ans = HF14BReader(false); //CmdHF14BReader("s");
|
ans = HF14BReader(false); //CmdHF14BReader("s");
|
||||||
if (ans) {
|
if (ans) {
|
||||||
PrintAndLog("\nValid ISO14443-B Tag Found\n");
|
PrintAndLogEx(NORMAL, "\nValid ISO14443-B Tag Found\n");
|
||||||
return ans;
|
return ans;
|
||||||
}
|
}
|
||||||
ans = HFiClassReader("", false, false);
|
ans = HFiClassReader("", false, false);
|
||||||
if (ans) {
|
if (ans) {
|
||||||
PrintAndLog("\nValid iClass Tag (or PicoPass Tag) Found\n");
|
PrintAndLogEx(NORMAL, "\nValid iClass Tag (or PicoPass Tag) Found\n");
|
||||||
return ans;
|
return ans;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ans = CmdHFFelicaReader("s");
|
ans = CmdHFFelicaReader("s");
|
||||||
if (ans) {
|
if (ans) {
|
||||||
PrintAndLog("\nValid ISO18092 / FeliCa Found\n");
|
PrintAndLogEx(NORMAL, "\nValid ISO18092 / FeliCa Found\n");
|
||||||
return ans;
|
return ans;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PrintAndLog("\nno known/supported 13.56 MHz tags found\n");
|
PrintAndLogEx(NORMAL, "\nno known/supported 13.56 MHz tags found\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CmdHFTune(const char *Cmd) {
|
int CmdHFTune(const char *Cmd) {
|
||||||
PrintAndLog("[+] Measuring HF antenna, press button to exit");
|
PrintAndLogEx(SUCCESS, "Measuring HF antenna, press button to exit");
|
||||||
UsbCommand c = {CMD_MEASURE_ANTENNA_TUNING_HF};
|
UsbCommand c = {CMD_MEASURE_ANTENNA_TUNING_HF};
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommand(&c);
|
SendCommand(&c);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue