Update cmdlft55xx.c

Clean up output
This commit is contained in:
mwalker33 2020-09-26 18:22:18 +10:00
parent e05a10f3e5
commit ff21ca77f9

View file

@ -3007,7 +3007,8 @@ static int CmdT55xxChkPwds(const char *Cmd) {
uint8_t cmdp = 0; uint8_t cmdp = 0;
bool errors = false; bool errors = false;
bool useCardPassword = false; bool useCardPassword = false;
uint32_t cardPassword = 0x00000000; uint32_t cardPassword = 0x00;
uint64_t cardID = 0x00;
while (param_getchar(Cmd, cmdp) != 0x00 && !errors) { while (param_getchar(Cmd, cmdp) != 0x00 && !errors) {
switch (tolower(param_getchar(Cmd, cmdp))) { switch (tolower(param_getchar(Cmd, cmdp))) {
@ -3036,7 +3037,9 @@ static int CmdT55xxChkPwds(const char *Cmd) {
case 'e': case 'e':
// White cloner password based on EM4100 ID // White cloner password based on EM4100 ID
useCardPassword = true; useCardPassword = true;
cardPassword = lf_t55xx_white_pwdgen (param_get64ex(Cmd,cmdp + 1,0,16) & 0xFFFFFFFF); cardID = param_get64ex(Cmd,cmdp + 1,0,16);
uint32_t card32Bit = cardID & 0xFFFFFFFF;
cardPassword = lf_t55xx_white_pwdgen (card32Bit);
cmdp += 2; cmdp += 2;
break; break;
default: default:
@ -3104,7 +3107,7 @@ static int CmdT55xxChkPwds(const char *Cmd) {
// try calculated password // try calculated password
if (useCardPassword) { if (useCardPassword) {
PrintAndLogEx(INFO, "Testing %08"PRIX32, cardPassword); PrintAndLogEx(INFO, "Testing %08"PRIX32" generated ", cardPassword);
for (dl_mode = downlink_mode; dl_mode <= 3; dl_mode++) { for (dl_mode = downlink_mode; dl_mode <= 3; dl_mode++) {
if (!AcquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, true, cardPassword, dl_mode)) { if (!AcquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, true, cardPassword, dl_mode)) {
@ -3113,7 +3116,7 @@ static int CmdT55xxChkPwds(const char *Cmd) {
found = tryDetectModulationEx(dl_mode, T55XX_PrintConfig, 0, cardPassword); found = tryDetectModulationEx(dl_mode, T55XX_PrintConfig, 0, cardPassword);
if (found) { if (found) {
PrintAndLogEx(SUCCESS, "Found valid password: [ " _GREEN_("%08"PRIX32) " ]", cardPassword); PrintAndLogEx(SUCCESS, "Found valid password : [ " _GREEN_("%08"PRIX32) " ]", cardPassword);
dl_mode = 4; // Exit other downlink mode checks dl_mode = 4; // Exit other downlink mode checks
} }
@ -3122,7 +3125,7 @@ static int CmdT55xxChkPwds(const char *Cmd) {
} }
} }
if (use_pwd_file) { if ((!found) && (use_pwd_file)) {
uint32_t keycount = 0; uint32_t keycount = 0;
int res = loadFileDICTIONARY_safe(filename, (void **) &keyBlock, 4, &keycount); int res = loadFileDICTIONARY_safe(filename, (void **) &keyBlock, 4, &keycount);
@ -3167,9 +3170,10 @@ static int CmdT55xxChkPwds(const char *Cmd) {
dl_mode = 4; dl_mode = 4;
} }
} }
if (!found) PrintAndLogEx(WARNING, "Check pwd failed");
} }
if (!found) PrintAndLogEx(WARNING, "Check pwd failed");
free(keyBlock); free(keyBlock);
out: out: