unshadow clock.. the mysterious variable

This commit is contained in:
iceman1001 2019-04-08 09:42:27 +02:00
parent 854536b155
commit 2fc54ca667
3 changed files with 16 additions and 16 deletions

View file

@ -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.

View file

@ -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}};

View file

@ -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;