From 61e6ff6991169fd072b31a82a7372d6902db4040 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Mon, 2 Mar 2020 14:15:51 +0100 Subject: [PATCH] chg: added hint text for lf clone part2 --- client/cmdlfnoralsy.c | 5 ++++- client/cmdlfpac.c | 5 ++++- client/cmdlfparadox.c | 5 ++++- client/cmdlfpcf7931.c | 47 ++++++++++++++++++++++------------------- client/cmdlfpresco.c | 5 ++++- client/cmdlfpyramid.c | 5 ++++- client/cmdlfsecurakey.c | 5 ++++- client/cmdlfti.c | 2 ++ client/cmdlfverichip.c | 5 ++++- client/cmdlfviking.c | 2 ++ client/cmdlfvisa2000.c | 5 ++++- 11 files changed, 61 insertions(+), 30 deletions(-) diff --git a/client/cmdlfnoralsy.c b/client/cmdlfnoralsy.c index d7728a3d9..bbb7de0c9 100644 --- a/client/cmdlfnoralsy.c +++ b/client/cmdlfnoralsy.c @@ -169,7 +169,10 @@ static int CmdNoralsyClone(const char *Cmd) { PrintAndLogEx(INFO, "Preparing to clone Noralsy to T55x7 with CardId: %u", id); print_blocks(blocks, ARRAYLEN(blocks)); - return clone_t55xx_tag(blocks, ARRAYLEN(blocks)); + int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); + PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(INFO, "Hint: try " _YELLOW_("`lf noralsy read`") "to verify"); + return res; } static int CmdNoralsySim(const char *Cmd) { diff --git a/client/cmdlfpac.c b/client/cmdlfpac.c index 24c549a4b..9ac9aa511 100644 --- a/client/cmdlfpac.c +++ b/client/cmdlfpac.c @@ -239,7 +239,10 @@ static int CmdPacClone(const char *Cmd) { PrintAndLogEx(INFO, "Preparing to clone PAC/Stanley tag to T55x7 with raw hex"); print_blocks(blocks, ARRAYLEN(blocks)); - return clone_t55xx_tag(blocks, ARRAYLEN(blocks)); + int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); + PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(INFO, "Hint: try " _YELLOW_("`lf pac read`") "to verify"); + return res; } static int CmdPacSim(const char *Cmd) { diff --git a/client/cmdlfparadox.c b/client/cmdlfparadox.c index 29e247b59..12c1bc9b8 100644 --- a/client/cmdlfparadox.c +++ b/client/cmdlfparadox.c @@ -169,7 +169,10 @@ static int CmdParadoxClone(const char *Cmd) { PrintAndLogEx(INFO, "Preparing to clone Paradox to T55x7 with raw hex"); print_blocks(blocks, ARRAYLEN(blocks)); - return clone_t55xx_tag(blocks, ARRAYLEN(blocks)); + int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); + PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(INFO, "Hint: try " _YELLOW_("`lf paradox read`") "to verify"); + return res; } static int CmdParadoxSim(const char *Cmd) { diff --git a/client/cmdlfpcf7931.c b/client/cmdlfpcf7931.c index e4a14a47e..ddcad195d 100644 --- a/client/cmdlfpcf7931.c +++ b/client/cmdlfpcf7931.c @@ -11,6 +11,7 @@ #include "cmdlfpcf7931.h" #include +#include #include "cmdparser.h" // command_t #include "comms.h" @@ -36,7 +37,7 @@ int pcf7931_resetConfig() { configPcf.InitDelay = PCF7931_DEFAULT_INITDELAY; configPcf.OffsetWidth = PCF7931_DEFAULT_OFFSET_WIDTH; configPcf.OffsetPosition = PCF7931_DEFAULT_OFFSET_POSITION; - return 0; + return PM3_SUCCESS; } int pcf7931_printConfig() { @@ -44,7 +45,7 @@ int pcf7931_printConfig() { PrintAndLogEx(NORMAL, "Tag initialization delay : %d us", configPcf.InitDelay); PrintAndLogEx(NORMAL, "Offset low pulses width : %d us", configPcf.OffsetWidth); PrintAndLogEx(NORMAL, "Offset low pulses position : %d us", configPcf.OffsetPosition); - return 0; + return PM3_SUCCESS; } static int usage_pcf7931_read() { @@ -54,7 +55,7 @@ static int usage_pcf7931_read() { PrintAndLogEx(NORMAL, " h This help"); PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, " lf pcf7931 read"); - return 0; + return PM3_SUCCESS; } static int usage_pcf7931_write() { @@ -67,7 +68,7 @@ static int usage_pcf7931_write() { PrintAndLogEx(NORMAL, " data one byte of data (hex)"); PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, " lf pcf7931 write 2 1 FF"); - return 0; + return PM3_SUCCESS; } static int usage_pcf7931_config() { @@ -87,30 +88,30 @@ static int usage_pcf7931_config() { PrintAndLogEx(NORMAL, " lf pcf7931 config r"); PrintAndLogEx(NORMAL, " lf pcf7931 config 11223344556677 20000"); PrintAndLogEx(NORMAL, " lf pcf7931 config 11223344556677 17500 -10 30"); - return 0; + return PM3_SUCCESS; } static int CmdLFPCF7931Read(const char *Cmd) { - uint8_t ctmp = param_getchar(Cmd, 0); - if (ctmp == 'H' || ctmp == 'h') return usage_pcf7931_read(); + uint8_t ctmp = tolower(param_getchar(Cmd, 0)); + if (ctmp == 'h') return usage_pcf7931_read(); PacketResponseNG resp; clearCommandBuffer(); SendCommandNG(CMD_LF_PCF7931_READ, NULL, 0); if (!WaitForResponseTimeout(CMD_ACK, &resp, 2500)) { PrintAndLogEx(WARNING, "command execution time out"); - return 1; + return PM3_ETIMEOUT; } - return 0; + return PM3_SUCCESS; } static int CmdLFPCF7931Config(const char *Cmd) { - uint8_t ctmp = param_getchar(Cmd, 0); + uint8_t ctmp = tolower(param_getchar(Cmd, 0)); if (ctmp == 0) return pcf7931_printConfig(); - if (ctmp == 'H' || ctmp == 'h') return usage_pcf7931_config(); - if (ctmp == 'R' || ctmp == 'r') return pcf7931_resetConfig(); + if (ctmp == 'h') return usage_pcf7931_config(); + if (ctmp == 'r') return pcf7931_resetConfig(); if (param_gethex(Cmd, 0, configPcf.Pwd, 14)) return usage_pcf7931_config(); @@ -119,13 +120,13 @@ static int CmdLFPCF7931Config(const char *Cmd) { configPcf.OffsetPosition = (int)(param_get32ex(Cmd, 3, 0, 10) & 0xFFFF); pcf7931_printConfig(); - return 0; + return PM3_SUCCESS; } static int CmdLFPCF7931Write(const char *Cmd) { - uint8_t ctmp = param_getchar(Cmd, 0); - if (strlen(Cmd) < 1 || ctmp == 'h' || ctmp == 'H') return usage_pcf7931_write(); + uint8_t ctmp = tolower(param_getchar(Cmd, 0)); + if (strlen(Cmd) < 1 || ctmp == 'h') return usage_pcf7931_write(); uint8_t block = 0, bytepos = 0, data = 0; @@ -136,9 +137,9 @@ static int CmdLFPCF7931Write(const char *Cmd) { data = param_get8ex(Cmd, 2, 0, 16); - PrintAndLogEx(NORMAL, "Writing block: %d", block); - PrintAndLogEx(NORMAL, " pos: %d", bytepos); - PrintAndLogEx(NORMAL, " data: 0x%02X", data); + PrintAndLogEx(INFO, "Writing block: %d", block); + PrintAndLogEx(INFO, " pos: %d", bytepos); + PrintAndLogEx(INFO, " data: 0x%02X", data); uint32_t buf[10]; // TODO sparse struct, 7 *bytes* then words at offset 4*7! memcpy(buf, configPcf.Pwd, sizeof(configPcf.Pwd)); @@ -147,9 +148,11 @@ static int CmdLFPCF7931Write(const char *Cmd) { buf[9] = configPcf.InitDelay; clearCommandBuffer(); - SendCommandOLD(CMD_LF_PCF7931_WRITE, block, bytepos, data, buf, sizeof(buf)); - //no ack? - return 0; + SendCommandMIX(CMD_LF_PCF7931_WRITE, block, bytepos, data, buf, sizeof(buf)); + + PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(INFO, "Hint: try " _YELLOW_("`lf pcf7931 read`") "to verify"); + return PM3_SUCCESS; } static command_t CommandTable[] = { @@ -163,7 +166,7 @@ static command_t CommandTable[] = { static int CmdHelp(const char *Cmd) { (void)Cmd; // Cmd is not used so far CmdsHelp(CommandTable); - return 0; + return PM3_SUCCESS; } int CmdLFPCF7931(const char *Cmd) { diff --git a/client/cmdlfpresco.c b/client/cmdlfpresco.c index a0619d794..9f00dbdce 100644 --- a/client/cmdlfpresco.c +++ b/client/cmdlfpresco.c @@ -136,7 +136,10 @@ static int CmdPrescoClone(const char *Cmd) { PrintAndLogEx(INFO, "Preparing to clone Presco to T55x7 with SiteCode: %u, UserCode: %u, FullCode: %08x", sitecode, usercode, fullcode); print_blocks(blocks, ARRAYLEN(blocks)); - return clone_t55xx_tag(blocks, ARRAYLEN(blocks)); + int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); + PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(INFO, "Hint: try " _YELLOW_("`lf presco read`") "to verify"); + return res; } // takes base 12 ID converts to hex diff --git a/client/cmdlfpyramid.c b/client/cmdlfpyramid.c index 5737c87b9..14357201a 100644 --- a/client/cmdlfpyramid.c +++ b/client/cmdlfpyramid.c @@ -250,7 +250,10 @@ static int CmdPyramidClone(const char *Cmd) { PrintAndLogEx(INFO, "Preparing to clone Farpointe/Pyramid to T55x7 with Facility Code: %u, Card Number: %u", facilitycode, cardnumber); print_blocks(blocks, ARRAYLEN(blocks)); - return clone_t55xx_tag(blocks, ARRAYLEN(blocks)); + int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); + PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(INFO, "Hint: try " _YELLOW_("`lf pyramid read`") "to verify"); + return res; } static int CmdPyramidSim(const char *Cmd) { diff --git a/client/cmdlfsecurakey.c b/client/cmdlfsecurakey.c index ef4b5be8e..0061d56c4 100644 --- a/client/cmdlfsecurakey.c +++ b/client/cmdlfsecurakey.c @@ -168,7 +168,10 @@ static int CmdSecurakeyClone(const char *Cmd) { PrintAndLogEx(INFO, "Preparing to clone Securakey to T55x7 with raw hex"); print_blocks(blocks, ARRAYLEN(blocks)); - return clone_t55xx_tag(blocks, ARRAYLEN(blocks)); + int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); + PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(INFO, "Hint: try " _YELLOW_("`lf securakey read`") "to verify"); + return res; } static int CmdSecurakeySim(const char *Cmd) { diff --git a/client/cmdlfti.c b/client/cmdlfti.c index cf01abb73..8507fa36a 100644 --- a/client/cmdlfti.c +++ b/client/cmdlfti.c @@ -296,6 +296,8 @@ static int CmdTIWrite(const char *Cmd) { } clearCommandBuffer(); SendCommandMIX(CMD_LF_TI_WRITE, arg0, arg1, arg2, NULL, 0); + PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(INFO, "Hint: try " _YELLOW_("`lf ti read`") "to verify"); return PM3_SUCCESS; } diff --git a/client/cmdlfverichip.c b/client/cmdlfverichip.c index fb2e4e777..91b49b8f4 100644 --- a/client/cmdlfverichip.c +++ b/client/cmdlfverichip.c @@ -121,7 +121,10 @@ static int CmdVerichipClone(const char *Cmd) { PrintAndLogEx(INFO, "Preparing to clone Verichip to T55x7 with raw hex"); print_blocks(blocks, ARRAYLEN(blocks)); - return clone_t55xx_tag(blocks, ARRAYLEN(blocks)); + int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); + PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(INFO, "Hint: try " _YELLOW_("`lf verichip read`") "to verify"); + return res; } static int CmdVerichipSim(const char *Cmd) { diff --git a/client/cmdlfviking.c b/client/cmdlfviking.c index 69d8aee65..407c28f7e 100644 --- a/client/cmdlfviking.c +++ b/client/cmdlfviking.c @@ -117,6 +117,8 @@ static int CmdVikingClone(const char *Cmd) { PrintAndLogEx(ERR, "Error occurred, device did not respond during write operation."); return PM3_ETIMEOUT; } + PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(INFO, "Hint: try " _YELLOW_("`lf viking read`") "to verify"); return resp.status; } diff --git a/client/cmdlfvisa2000.c b/client/cmdlfvisa2000.c index 551a1efbb..1a628e51d 100644 --- a/client/cmdlfvisa2000.c +++ b/client/cmdlfvisa2000.c @@ -184,7 +184,10 @@ static int CmdVisa2kClone(const char *Cmd) { PrintAndLogEx(INFO, "Preparing to clone Visa2000 to T55x7 with CardId: %"PRIu64, id); print_blocks(blocks, ARRAYLEN(blocks)); - return clone_t55xx_tag(blocks, ARRAYLEN(blocks)); + int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); + PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(INFO, "Hint: try " _YELLOW_("`lf visa2000 read`") "to verify"); + return res; } static int CmdVisa2kSim(const char *Cmd) {