From 2fc54ca66718966125b841f4d7063bfd151a50dd Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Mon, 8 Apr 2019 09:42:27 +0200 Subject: [PATCH] unshadow clock.. the mysterious variable --- client/cmdlfem4x.c | 18 +++++++++--------- client/cmdlfguard.c | 4 ++-- client/cmdsmartcard.c | 10 +++++----- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/client/cmdlfem4x.c b/client/cmdlfem4x.c index e9998269d..c51124c76 100644 --- a/client/cmdlfem4x.c +++ b/client/cmdlfem4x.c @@ -438,19 +438,19 @@ int CmdEM410xSim(const char *Cmd) { uint8_t uid[5] = {0x00}; /* clock is 64 in EM410x tags */ - uint8_t clock = 64; + uint8_t clock1 = 64; if (param_gethex(Cmd, 0, uid, 10)) { PrintAndLogEx(FAILED, "UID must include 10 HEX symbols"); return 0; } - param_getdec(Cmd, 1, &clock); + param_getdec(Cmd, 1, &clock1); - PrintAndLogEx(SUCCESS, "Starting simulating UID %02X%02X%02X%02X%02X clock: %d", uid[0], uid[1], uid[2], uid[3], uid[4], clock); + PrintAndLogEx(SUCCESS, "Starting simulating UID %02X%02X%02X%02X%02X clock: %d", uid[0], uid[1], uid[2], uid[3], uid[4], clock1); PrintAndLogEx(SUCCESS, "Press pm3-button to abort simulation"); - ConstructEM410xEmulGraph(Cmd, clock); + ConstructEM410xEmulGraph(Cmd, clock1); CmdLFSim("0"); //240 start_gap. return 0; @@ -465,7 +465,7 @@ int CmdEM410xBrute(const char *Cmd) { uint8_t *uidBlock = NULL, *p = NULL; uint8_t uid[5] = {0x00}; /* clock is 64 in EM410x tags */ - uint8_t clock = 64; + uint8_t clock1 = 64; /* default pause time: 1 second */ uint32_t delay = 1000; @@ -475,9 +475,9 @@ int CmdEM410xBrute(const char *Cmd) { cmdp = tolower(param_getchar(Cmd, 1)); if (cmdp == 'd') { delay = param_get32ex(Cmd, 2, 1000, 10); - param_getdec(Cmd, 4, &clock); + param_getdec(Cmd, 4, &clock1); } else if (cmdp == 'c') { - param_getdec(Cmd, 2, &clock); + param_getdec(Cmd, 2, &clock1); delay = param_get32ex(Cmd, 4, 1000, 10); } @@ -554,9 +554,9 @@ int CmdEM410xBrute(const char *Cmd) { } sprintf(testuid, "%010" PRIX64, bytes_to_num(uidBlock + 5 * c, 5)); - PrintAndLogEx(NORMAL, "Bruteforce %d / %d: simulating UID %s, clock %d", c + 1, uidcnt, testuid, clock); + PrintAndLogEx(NORMAL, "Bruteforce %d / %d: simulating UID %s, clock %d", c + 1, uidcnt, testuid, clock1); - ConstructEM410xEmulGraph(testuid, clock); + ConstructEM410xEmulGraph(testuid, clock1); CmdLFSim("0"); //240 start_gap. diff --git a/client/cmdlfguard.c b/client/cmdlfguard.c index 1f89a87ef..e4776935e 100644 --- a/client/cmdlfguard.c +++ b/client/cmdlfguard.c @@ -312,7 +312,7 @@ int CmdGuardClone(const char *Cmd) { int CmdGuardSim(const char *Cmd) { // Guard uses: clk: 64, invert: 0, encoding: 2 (ASK Biphase) - uint8_t clock = 64, encoding = 2, separator = 0, invert = 0; + uint8_t clock1 = 64, encoding = 2, separator = 0, invert = 0; uint32_t facilitycode = 0, cardnumber = 0, fc = 0, cn = 0, fmtlen = 0; char cmdp = param_getchar(Cmd, 0); @@ -336,7 +336,7 @@ int CmdGuardSim(const char *Cmd) { PrintAndLogEx(SUCCESS, "Simulating Guardall - Facility Code: %u, CardNumber: %u", facilitycode, cardnumber); uint64_t arg1, arg2; - arg1 = (clock << 8) | encoding; + arg1 = (clock1 << 8) | encoding; arg2 = (invert << 8) | separator; UsbCommand c = {CMD_ASK_SIM_TAG, {arg1, arg2, size}}; diff --git a/client/cmdsmartcard.c b/client/cmdsmartcard.c index 6d99dc98c..56352b2fd 100644 --- a/client/cmdsmartcard.c +++ b/client/cmdsmartcard.c @@ -884,14 +884,14 @@ int CmdSmartReader(const char *Cmd) { int CmdSmartSetClock(const char *Cmd) { uint8_t cmdp = 0; bool errors = false; - uint8_t clock = 0; + uint8_t clock1 = 0; while (param_getchar(Cmd, cmdp) != 0x00 && !errors) { switch (tolower(param_getchar(Cmd, cmdp))) { case 'h': return usage_sm_setclock(); case 'c': - clock = param_get8ex(Cmd, cmdp + 1, 2, 10); - if (clock > 2) + clock1 = param_get8ex(Cmd, cmdp + 1, 2, 10); + if (clock1 > 2) errors = true; cmdp += 2; @@ -906,7 +906,7 @@ int CmdSmartSetClock(const char *Cmd) { //Validations if (errors || cmdp == 0) return usage_sm_setclock(); - UsbCommand c = {CMD_SMART_SETCLOCK, {clock, 0, 0}}; + UsbCommand c = {CMD_SMART_SETCLOCK, {clock1, 0, 0}}; clearCommandBuffer(); SendCommand(&c); UsbCommand resp; @@ -921,7 +921,7 @@ int CmdSmartSetClock(const char *Cmd) { return 1; } - switch (clock) { + switch (clock1) { case 0: PrintAndLogEx(SUCCESS, "Clock changed to 16mhz giving 10800 baudrate"); break;