mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 02:27:26 -07:00
use PrintAndLogEx() instead of PrintAndLog()
This commit is contained in:
parent
2cea36c3b5
commit
c80c992ff3
1 changed files with 65 additions and 65 deletions
130
client/cmdlfio.c
130
client/cmdlfio.c
|
@ -13,51 +13,51 @@
|
|||
static int CmdHelp(const char *Cmd);
|
||||
|
||||
int usage_lf_io_read(void) {
|
||||
PrintAndLog("Enables IOProx compatible reader mode printing details of scanned tags.");
|
||||
PrintAndLog("By default, values are printed and logged until the button is pressed or another USB command is issued.");
|
||||
PrintAndLog("If the [1] option is provided, reader mode is exited after reading a single card.");
|
||||
PrintAndLog("");
|
||||
PrintAndLog("Usage: lf io read [h] [1]");
|
||||
PrintAndLog("Options:");
|
||||
PrintAndLog(" h : This help");
|
||||
PrintAndLog(" 1 : (optional) stop after reading a single card");
|
||||
PrintAndLog("");
|
||||
PrintAndLog("Examples:");
|
||||
PrintAndLog(" lf io read");
|
||||
PrintAndLog(" lf io read 1");
|
||||
PrintAndLogEx(NORMAL, "Enables IOProx compatible reader mode printing details of scanned tags.");
|
||||
PrintAndLogEx(NORMAL, "By default, values are printed and logged until the button is pressed or another USB command is issued.");
|
||||
PrintAndLogEx(NORMAL, "If the [1] option is provided, reader mode is exited after reading a single card.");
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(NORMAL, "Usage: lf io read [h] [1]");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
PrintAndLogEx(NORMAL, " h : This help");
|
||||
PrintAndLogEx(NORMAL, " 1 : (optional) stop after reading a single card");
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(NORMAL, "Examples:");
|
||||
PrintAndLogEx(NORMAL, " lf io read");
|
||||
PrintAndLogEx(NORMAL, " lf io read 1");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int usage_lf_io_sim(void) {
|
||||
PrintAndLog("Enables simulation of IOProx card with specified facility-code and card number.");
|
||||
PrintAndLog("Simulation runs until the button is pressed or another USB command is issued.");
|
||||
PrintAndLog("");
|
||||
PrintAndLog("Usage: lf io sim [h] <version> <facility-code> <card-number>");
|
||||
PrintAndLog("Options:");
|
||||
PrintAndLog(" h : This help");
|
||||
PrintAndLog(" <version> : 8bit version");
|
||||
PrintAndLog(" <facility-code> : 8bit value facility code");
|
||||
PrintAndLog(" <card number> : 16bit value card number");
|
||||
PrintAndLog("");
|
||||
PrintAndLog("Examples:");
|
||||
PrintAndLog(" lf io sim 26 101 1337");
|
||||
PrintAndLogEx(NORMAL, "Enables simulation of IOProx card with specified facility-code and card number.");
|
||||
PrintAndLogEx(NORMAL, "Simulation runs until the button is pressed or another USB command is issued.");
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(NORMAL, "Usage: lf io sim [h] <version> <facility-code> <card-number>");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
PrintAndLogEx(NORMAL, " h : This help");
|
||||
PrintAndLogEx(NORMAL, " <version> : 8bit version");
|
||||
PrintAndLogEx(NORMAL, " <facility-code> : 8bit value facility code");
|
||||
PrintAndLogEx(NORMAL, " <card number> : 16bit value card number");
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(NORMAL, "Examples:");
|
||||
PrintAndLogEx(NORMAL, " lf io sim 26 101 1337");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int usage_lf_io_clone(void) {
|
||||
PrintAndLog("Enables cloning of IOProx card with specified facility-code and card number onto T55x7.");
|
||||
PrintAndLog("The T55x7 must be on the antenna when issuing this command. T55x7 blocks are calculated and printed in the process.");
|
||||
PrintAndLog("");
|
||||
PrintAndLog("Usage: lf io clone [h] <version> <facility-code> <card-number> [Q5]");
|
||||
PrintAndLog("Options:");
|
||||
PrintAndLog(" h : This help");
|
||||
PrintAndLog(" <version> : 8bit version");
|
||||
PrintAndLog(" <facility-code> : 8bit value facility code");
|
||||
PrintAndLog(" <card number> : 16bit value card number");
|
||||
PrintAndLog(" Q5 : optional - clone to Q5 (T5555) instead of T55x7 chip");
|
||||
PrintAndLog("");
|
||||
PrintAndLog("Examples:");
|
||||
PrintAndLog(" lf io clone 26 101 1337");
|
||||
PrintAndLogEx(NORMAL, "Enables cloning of IOProx card with specified facility-code and card number onto T55x7.");
|
||||
PrintAndLogEx(NORMAL, "The T55x7 must be on the antenna when issuing this command. T55x7 blocks are calculated and printed in the process.");
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(NORMAL, "Usage: lf io clone [h] <version> <facility-code> <card-number> [Q5]");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
PrintAndLogEx(NORMAL, " h : This help");
|
||||
PrintAndLogEx(NORMAL, " <version> : 8bit version");
|
||||
PrintAndLogEx(NORMAL, " <facility-code> : 8bit value facility code");
|
||||
PrintAndLogEx(NORMAL, " <card number> : 16bit value card number");
|
||||
PrintAndLogEx(NORMAL, " Q5 : optional - clone to Q5 (T5555) instead of T55x7 chip");
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(NORMAL, "Examples:");
|
||||
PrintAndLogEx(NORMAL, " lf io clone 26 101 1337");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ int CmdIOProxDemod(const char *Cmd) {
|
|||
uint8_t bits[MAX_GRAPH_TRACE_LEN]={0};
|
||||
size_t size = getFromGraphBuf(bits);
|
||||
if (size < 65) {
|
||||
if (g_debugMode)PrintAndLog("DEBUG: Error - IO prox not enough samples in GraphBuffer");
|
||||
if (g_debugMode)PrintAndLogEx(DEBUG, "DEBUG: Error - IO prox not enough samples in GraphBuffer");
|
||||
return 0;
|
||||
}
|
||||
//get binary from fsk wave
|
||||
|
@ -95,19 +95,19 @@ int CmdIOProxDemod(const char *Cmd) {
|
|||
if (idx < 0){
|
||||
if (g_debugMode){
|
||||
if (idx == -1){
|
||||
PrintAndLog("DEBUG: Error - IO prox not enough samples");
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - IO prox not enough samples");
|
||||
} else if (idx == -2) {
|
||||
PrintAndLog("DEBUG: Error - IO prox just noise detected");
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - IO prox just noise detected");
|
||||
} else if (idx == -3) {
|
||||
PrintAndLog("DEBUG: Error - IO prox error during fskdemod");
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - IO prox error during fskdemod");
|
||||
} else if (idx == -4) {
|
||||
PrintAndLog("DEBUG: Error - IO prox preamble not found");
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - IO prox preamble not found");
|
||||
} else if (idx == -5) {
|
||||
PrintAndLog("DEBUG: Error - IO size not correct, size %d", size);
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - IO size not correct, size %d", size);
|
||||
} else if (idx == -6) {
|
||||
PrintAndLog("DEBUG: Error - IO prox separator bits not found");
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - IO prox separator bits not found");
|
||||
} else {
|
||||
PrintAndLog("DEBUG: Error - IO prox error demoding fsk %d", idx);
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - IO prox error demoding fsk %d", idx);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -117,8 +117,8 @@ int CmdIOProxDemod(const char *Cmd) {
|
|||
|
||||
if (idx==0){
|
||||
if (g_debugMode){
|
||||
PrintAndLog("DEBUG: Error - IO prox data not found - FSK Bits: %d", size);
|
||||
if (size > 92) PrintAndLog("%s", sprint_bin_break(bits, 92, 16));
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - IO prox data not found - FSK Bits: %d", size);
|
||||
if (size > 92) PrintAndLogEx(NORMAL, "%s", sprint_bin_break(bits, 92, 16));
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
@ -133,13 +133,13 @@ int CmdIOProxDemod(const char *Cmd) {
|
|||
//XSF(version)facility:codeone+codetwo (raw)
|
||||
|
||||
if (g_debugMode) {
|
||||
PrintAndLog("%d%d%d%d%d%d%d%d %d", bits[idx], bits[idx+1], bits[idx+2], bits[idx+3], bits[idx+4], bits[idx+5], bits[idx+6], bits[idx+7], bits[idx+8]);
|
||||
PrintAndLog("%d%d%d%d%d%d%d%d %d", bits[idx+9], bits[idx+10], bits[idx+11],bits[idx+12],bits[idx+13],bits[idx+14],bits[idx+15],bits[idx+16],bits[idx+17]);
|
||||
PrintAndLog("%d%d%d%d%d%d%d%d %d facility", bits[idx+18], bits[idx+19], bits[idx+20],bits[idx+21],bits[idx+22],bits[idx+23],bits[idx+24],bits[idx+25],bits[idx+26]);
|
||||
PrintAndLog("%d%d%d%d%d%d%d%d %d version", bits[idx+27], bits[idx+28], bits[idx+29],bits[idx+30],bits[idx+31],bits[idx+32],bits[idx+33],bits[idx+34],bits[idx+35]);
|
||||
PrintAndLog("%d%d%d%d%d%d%d%d %d code1", bits[idx+36], bits[idx+37], bits[idx+38],bits[idx+39],bits[idx+40],bits[idx+41],bits[idx+42],bits[idx+43],bits[idx+44]);
|
||||
PrintAndLog("%d%d%d%d%d%d%d%d %d code2", bits[idx+45], bits[idx+46], bits[idx+47],bits[idx+48],bits[idx+49],bits[idx+50],bits[idx+51],bits[idx+52],bits[idx+53]);
|
||||
PrintAndLog("%d%d%d%d%d%d%d%d %d%d checksum", bits[idx+54],bits[idx+55],bits[idx+56],bits[idx+57],bits[idx+58],bits[idx+59],bits[idx+60],bits[idx+61],bits[idx+62],bits[idx+63]);
|
||||
PrintAndLogEx(NORMAL, "%d%d%d%d%d%d%d%d %d", bits[idx], bits[idx+1], bits[idx+2], bits[idx+3], bits[idx+4], bits[idx+5], bits[idx+6], bits[idx+7], bits[idx+8]);
|
||||
PrintAndLogEx(NORMAL, "%d%d%d%d%d%d%d%d %d", bits[idx+9], bits[idx+10], bits[idx+11],bits[idx+12],bits[idx+13],bits[idx+14],bits[idx+15],bits[idx+16],bits[idx+17]);
|
||||
PrintAndLogEx(NORMAL, "%d%d%d%d%d%d%d%d %d facility", bits[idx+18], bits[idx+19], bits[idx+20],bits[idx+21],bits[idx+22],bits[idx+23],bits[idx+24],bits[idx+25],bits[idx+26]);
|
||||
PrintAndLogEx(NORMAL, "%d%d%d%d%d%d%d%d %d version", bits[idx+27], bits[idx+28], bits[idx+29],bits[idx+30],bits[idx+31],bits[idx+32],bits[idx+33],bits[idx+34],bits[idx+35]);
|
||||
PrintAndLogEx(NORMAL, "%d%d%d%d%d%d%d%d %d code1", bits[idx+36], bits[idx+37], bits[idx+38],bits[idx+39],bits[idx+40],bits[idx+41],bits[idx+42],bits[idx+43],bits[idx+44]);
|
||||
PrintAndLogEx(NORMAL, "%d%d%d%d%d%d%d%d %d code2", bits[idx+45], bits[idx+46], bits[idx+47],bits[idx+48],bits[idx+49],bits[idx+50],bits[idx+51],bits[idx+52],bits[idx+53]);
|
||||
PrintAndLogEx(NORMAL, "%d%d%d%d%d%d%d%d %d%d checksum", bits[idx+54],bits[idx+55],bits[idx+56],bits[idx+57],bits[idx+58],bits[idx+59],bits[idx+60],bits[idx+61],bits[idx+62],bits[idx+63]);
|
||||
}
|
||||
|
||||
uint32_t code = bytebits_to_byte(bits+idx,32);
|
||||
|
@ -163,16 +163,16 @@ int CmdIOProxDemod(const char *Cmd) {
|
|||
snprintf(crcStr, 3, "ok");
|
||||
retval = 1;
|
||||
} else {
|
||||
if (g_debugMode) PrintAndLog("DEBUG: Error - IO prox crc failed");
|
||||
if (g_debugMode) PrintAndLogEx(DEBUG, "DEBUG: Error - IO prox crc failed");
|
||||
|
||||
snprintf(crcStr, sizeof(crcStr), "failed 0x%02X != 0x%02X", crc, calccrc);
|
||||
retval = 0;
|
||||
}
|
||||
|
||||
PrintAndLog("IO Prox XSF(%02d)%02x:%05d (%08x%08x) [crc %s]", version, facilitycode, number, code, code2, crcStr);
|
||||
PrintAndLogEx(NORMAL, "IO Prox XSF(%02d)%02x:%05d (%08x%08x) [crc %s]", version, facilitycode, number, code, code2, crcStr);
|
||||
|
||||
if (g_debugMode){
|
||||
PrintAndLog("DEBUG: IO prox idx: %d, Len: %d, Printing demod buffer:", idx, size);
|
||||
PrintAndLogEx(DEBUG, "DEBUG: IO prox idx: %d, Len: %d, Printing demod buffer:", idx, size);
|
||||
printDemodBuff();
|
||||
}
|
||||
return retval;
|
||||
|
@ -241,7 +241,7 @@ int getIOProxBits(uint8_t version, uint8_t fc, uint16_t cn, uint8_t *bits) {
|
|||
|
||||
memcpy(bits, pre, sizeof(pre));
|
||||
|
||||
printf("IO raw bits:\n %s \n", sprint_bin(bits, 64));
|
||||
PrintAndLogEx(NORMAL, "IO raw bits:\n %s \n", sprint_bin(bits, 64));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -263,7 +263,7 @@ int CmdIOProxSim(const char *Cmd) {
|
|||
|
||||
if ((cn & 0xFFFF) != cn) {
|
||||
cn &= 0xFFFF;
|
||||
PrintAndLog("Card Number Truncated to 16-bits (IOProx): %u", cn);
|
||||
PrintAndLogEx(NORMAL, "Card Number Truncated to 16-bits (IOProx): %u", cn);
|
||||
}
|
||||
|
||||
// clock 64, FSK2a fcHIGH 10 | fcLOW 8
|
||||
|
@ -272,11 +272,11 @@ int CmdIOProxSim(const char *Cmd) {
|
|||
arg1 = high << 8 | low;
|
||||
arg2 = invert << 8 | clk;
|
||||
|
||||
PrintAndLog("Emulating IOProx Version: %u FC: %u; CN: %u\n", version, fc, cn);
|
||||
PrintAndLog("Press pm3-button to abort simulation or run another command");
|
||||
PrintAndLogEx(NORMAL, "Emulating IOProx Version: %u FC: %u; CN: %u\n", version, fc, cn);
|
||||
PrintAndLogEx(NORMAL, "Press pm3-button to abort simulation or run another command");
|
||||
|
||||
if ( !getIOProxBits(version, fc, cn, bits)) {
|
||||
PrintAndLog("Error with tag bitstream generation.");
|
||||
PrintAndLogEx(WARNING, "Error with tag bitstream generation.");
|
||||
return 1;
|
||||
}
|
||||
// IOProx uses: fcHigh: 10, fcLow: 8, clk: 64, invert: 1
|
||||
|
@ -309,11 +309,11 @@ int CmdIOProxClone(const char *Cmd) {
|
|||
|
||||
if ((cn & 0xFFFF) != cn) {
|
||||
cn &= 0xFFFF;
|
||||
PrintAndLog("Card Number Truncated to 16-bits (IOProx): %u", cn);
|
||||
PrintAndLogEx(NORMAL, "Card Number Truncated to 16-bits (IOProx): %u", cn);
|
||||
}
|
||||
|
||||
if ( !getIOProxBits(version, fc, cn, bits)) {
|
||||
PrintAndLog("Error with tag bitstream generation.");
|
||||
PrintAndLogEx(WARNING, "Error with tag bitstream generation.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -323,7 +323,7 @@ int CmdIOProxClone(const char *Cmd) {
|
|||
blocks[1] = bytebits_to_byte(bits, 32);
|
||||
blocks[2] = bytebits_to_byte(bits + 32, 32);
|
||||
|
||||
PrintAndLog("Preparing to clone IOProx to T55x7 with Version: %u FC: %u, CN: %u", version, fc, cn);
|
||||
PrintAndLogEx(NORMAL, "Preparing to clone IOProx to T55x7 with Version: %u FC: %u, CN: %u", version, fc, cn);
|
||||
print_blocks(blocks, 3);
|
||||
|
||||
//UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0,0,0}};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue