ADD: Marshmellows fixes for "lf t55xx" and "lf cmdread" ref: https://github.com/Proxmark/proxmark3/pull/166/files

This commit is contained in:
iceman1001
2016-02-21 17:44:25 +01:00
parent c7962313cc
commit c0f15a05b3
9 changed files with 46 additions and 24 deletions

View File

@@ -613,7 +613,7 @@ int CmdG_Prox_II_Demod(const char *Cmd)
if ((idx+1) % 5 == 0){
//spacer bit - should be 0
if (DemodBuffer[startIdx+idx] != 0) {
if (g_debugMode) PrintAndLog("Error spacer not 0: %d, pos: %d",DemodBuffer[startIdx+idx],startIdx+idx);
if (g_debugMode) PrintAndLog("Error spacer not 0: %u, pos: %u", (unsigned int)DemodBuffer[startIdx+idx],(unsigned int)(startIdx+idx));
return 0;
}
continue;
@@ -628,14 +628,14 @@ int CmdG_Prox_II_Demod(const char *Cmd)
ByteStream[ByteCnt] = ByteStream[ByteCnt] | (DemodBuffer[startIdx+idx]<<bitCnt);
bitCnt++;
if (bitCnt % 8 == 0){
if (g_debugMode) PrintAndLog("byte %d: %02x",ByteCnt,ByteStream[ByteCnt]);
if (g_debugMode) PrintAndLog("byte %u: %02x", (unsigned int)ByteCnt, ByteStream[ByteCnt]);
bitCnt=0;
ByteCnt++;
}
}
for (uint8_t i = 0; i < ByteCnt; i++){
ByteStream[i] ^= xorKey; //xor
if (g_debugMode) PrintAndLog("byte %d after xor: %02x", i, ByteStream[i]);
if (g_debugMode) PrintAndLog("byte %u after xor: %02x", (unsigned int)i, ByteStream[i]);
}
//now ByteStream contains 64 bytes of decrypted raw tag data
//

View File

@@ -1397,21 +1397,18 @@ int CmdT55xxBruteForce(const char *Cmd) {
char buf[9];
char filename[FILE_PATH_SIZE]={0};
int keycnt = 0;
int c;
int ch;
uint8_t stKeyBlock = 20;
uint8_t *keyBlock = NULL, *p = NULL;
keyBlock = calloc(stKeyBlock, 6);
if (keyBlock == NULL) return 1;
uint32_t start_password = 0x00000000; //start password
uint32_t end_password = 0xFFFFFFFF; //end password
bool found = false;
char cmdp = param_getchar(Cmd, 0);
if (cmdp == 'h' || cmdp == 'H') {
free(keyBlock);
return usage_t55xx_bruteforce();
}
if (cmdp == 'h' || cmdp == 'H') return usage_t55xx_bruteforce();
keyBlock = calloc(stKeyBlock, 6);
if (keyBlock == NULL) return 1;
if (cmdp == 'i' || cmdp == 'I') {
@@ -1472,8 +1469,8 @@ int CmdT55xxBruteForce(const char *Cmd) {
for (uint16_t c = 0; c < keycnt; ++c ) {
if (ukbhit()) {
c = getchar();
(void)c;
ch = getchar();
(void)ch;
printf("\naborted via keyboard!\n");
free(keyBlock);
return 0;
@@ -1523,8 +1520,8 @@ int CmdT55xxBruteForce(const char *Cmd) {
printf(".");
fflush(stdout);
if (ukbhit()) {
c = getchar();
(void)c;
ch = getchar();
(void)ch;
printf("\naborted via keyboard!\n");
free(keyBlock);
return 0;

View File

@@ -143,7 +143,11 @@ int GetAskClock(const char str[], bool printAns, bool verbose)
PrintAndLog("Failed to copy from graphbuffer");
return -1;
}
int start = DetectASKClock(grph, size, &clock, 20);
bool st = DetectST(grph, &size, &clock);
int start = 0;
if (st == false) {
start = DetectASKClock(grph, size, &clock, 20);
}
// Only print this message if we're not looping something
if (printAns){
PrintAndLog("Auto-detected clock rate: %d, Best Starting Position: %d", clock, start);