X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/2dcf60f3df145625781982040ae9c80d30e40482..bb522918374599054615270d45b1baeaef6f3d66:/client/cmdlft55xx.c diff --git a/client/cmdlft55xx.c b/client/cmdlft55xx.c index f28f84ce..f30bc5ce 100644 --- a/client/cmdlft55xx.c +++ b/client/cmdlft55xx.c @@ -150,6 +150,7 @@ int usage_t55xx_wakup(){ int usage_t55xx_bruteforce(){ PrintAndLog("This command uses A) bruteforce to scan a number range"); PrintAndLog(" B) a dictionary attack"); + PrintAndLog("press 'enter' to cancel the command"); PrintAndLog("Usage: lf t55xx bruteforce [h] [i <*.dic>]"); PrintAndLog(" password must be 4 bytes (8 hex symbols)"); PrintAndLog("Options:"); @@ -166,6 +167,7 @@ int usage_t55xx_bruteforce(){ } int usage_t55xx_recoverpw(){ PrintAndLog("This command uses a few tricks to try to recover mangled password"); + PrintAndLog("press 'enter' to cancel the command"); PrintAndLog("WARNING: this may brick non-password protected chips!"); PrintAndLog("Usage: lf t55xx recoverpw [password]"); PrintAndLog(" password must be 4 bytes (8 hex symbols)"); @@ -195,8 +197,8 @@ static int CmdHelp(const char *Cmd); void printT5xxHeader(uint8_t page){ PrintAndLog("Reading Page %d:", page); - PrintAndLog("blk | hex data | binary"); - PrintAndLog("----+----------+---------------------------------"); + PrintAndLog("blk | hex data | binary | ascii"); + PrintAndLog("----+----------+----------------------------------+-------"); } int CmdT55xxSetConfig(const char *Cmd) { @@ -674,13 +676,46 @@ bool tryDetectModulation(){ return TRUE; } + bool retval = FALSE; if ( hits > 1) { PrintAndLog("Found [%d] possible matches for modulation.",hits); for(int i=0; i FILE_PATH_SIZE) len = FILE_PATH_SIZE; memcpy(filename, Cmd+2, len); - FILE * f = fopen( filename , "r"); - + FILE * f = fopen( filename , "r"); if ( !f ) { PrintAndLog("File: %s: not found or locked.", filename); free(keyBlock); @@ -1519,11 +1565,14 @@ int CmdT55xxBruteForce(const char *Cmd) { // loop uint64_t testpwd = 0x00; for (uint16_t c = 0; c < keycnt; ++c ) { - - if (ukbhit()) { - ch = getchar(); - (void)ch; - printf("\naborted via keyboard!\n"); + + if ( offline ) { + printf("Device offline\n"); + free(keyBlock); + return 2; + } + + if (IsCancelled()) { free(keyBlock); return 0; } @@ -1531,8 +1580,7 @@ int CmdT55xxBruteForce(const char *Cmd) { testpwd = bytes_to_num(keyBlock + 4*c, 4); PrintAndLog("Testing %08X", testpwd); - - + if ( !AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, TRUE, testpwd)) { PrintAndLog("Aquireing data from device failed. Quitting"); free(keyBlock); @@ -1540,7 +1588,6 @@ int CmdT55xxBruteForce(const char *Cmd) { } found = tryDetectModulation(); - if ( found ) { PrintAndLog("Found valid password: [%08X]", testpwd); free(keyBlock); @@ -1571,10 +1618,8 @@ int CmdT55xxBruteForce(const char *Cmd) { printf("."); fflush(stdout); - if (ukbhit()) { - ch = getchar(); - (void)ch; - printf("\naborted via keyboard!\n"); + + if (IsCancelled()) { free(keyBlock); return 0; } @@ -1610,7 +1655,8 @@ int tryOnePassword(uint32_t password) { if (tryDetectModulation()) return 1; - else return 0; + else + return 0; } int CmdT55xxRecoverPW(const char *Cmd) { @@ -1635,6 +1681,8 @@ int CmdT55xxRecoverPW(const char *Cmd) { else if (found == -1) return 0; bit++; + + if (IsCancelled()) return 0; } // now try to use partial original password, since block 7 should have been completely @@ -1657,7 +1705,9 @@ int CmdT55xxRecoverPW(const char *Cmd) { else if (found == -1) return 0; bit++; - prev_password=curr_password; + prev_password = curr_password; + + if (IsCancelled()) return 0; } // from high bit to low @@ -1677,7 +1727,9 @@ int CmdT55xxRecoverPW(const char *Cmd) { else if (found == -1) return 0; bit++; - prev_password=curr_password; + prev_password = curr_password; + + if (IsCancelled()) return 0; } done: PrintAndLog("");