mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 05:13:46 -07:00
FIX: bug in nextwatch demod, which if the found psk bits was smaller than the preamble the client crashed.
REM: removed some debugstatements
This commit is contained in:
parent
2deea574d3
commit
56d0fb8e4d
3 changed files with 14 additions and 9 deletions
|
@ -259,7 +259,6 @@ void setDemodBuf(uint8_t *buff, size_t size, size_t startIdx)
|
||||||
DemodBuffer[i]=buff[startIdx++];
|
DemodBuffer[i]=buff[startIdx++];
|
||||||
}
|
}
|
||||||
DemodBufferLen = size;
|
DemodBufferLen = size;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CmdSetDebugMode(const char *Cmd)
|
int CmdSetDebugMode(const char *Cmd)
|
||||||
|
@ -1761,6 +1760,7 @@ int CmdIndalaDecode(const char *Cmd)
|
||||||
PrintAndLog("Error1: %d",ans);
|
PrintAndLog("Error1: %d",ans);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t invert = 0;
|
uint8_t invert = 0;
|
||||||
size_t size = DemodBufferLen;
|
size_t size = DemodBufferLen;
|
||||||
int startIdx = indala26decode(DemodBuffer, &size, &invert);
|
int startIdx = indala26decode(DemodBuffer, &size, &invert);
|
||||||
|
@ -1800,12 +1800,18 @@ int CmdIndalaDecode(const char *Cmd)
|
||||||
int CmdPSKNexWatch(const char *Cmd)
|
int CmdPSKNexWatch(const char *Cmd)
|
||||||
{
|
{
|
||||||
if (!PSKDemod("", false)) return 0;
|
if (!PSKDemod("", false)) return 0;
|
||||||
|
|
||||||
uint8_t preamble[28] = {0,0,0,0,0,1,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
uint8_t preamble[28] = {0,0,0,0,0,1,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
||||||
size_t startIdx = 0, size = DemodBufferLen;
|
size_t startIdx = 0, size = DemodBufferLen;
|
||||||
|
|
||||||
|
// sanity check.
|
||||||
|
if ( size < sizeof(preamble) + 100) return 0;
|
||||||
|
|
||||||
bool invert = false;
|
bool invert = false;
|
||||||
if (!preambleSearch(DemodBuffer, preamble, sizeof(preamble), &size, &startIdx)){
|
if (!preambleSearch(DemodBuffer, preamble, sizeof(preamble), &size, &startIdx)){
|
||||||
// if didn't find preamble try again inverting
|
// if didn't find preamble try again inverting
|
||||||
if (!PSKDemod("1", false)) return 0;
|
if (!PSKDemod("1", false)) return 0;
|
||||||
|
|
||||||
size = DemodBufferLen;
|
size = DemodBufferLen;
|
||||||
if (!preambleSearch(DemodBuffer, preamble, sizeof(preamble), &size, &startIdx)) return 0;
|
if (!preambleSearch(DemodBuffer, preamble, sizeof(preamble), &size, &startIdx)) return 0;
|
||||||
invert = true;
|
invert = true;
|
||||||
|
@ -1906,7 +1912,6 @@ int CmdPSK1rawDemod(const char *Cmd)
|
||||||
if (g_debugMode) PrintAndLog("Error demoding: %d",ans);
|
if (g_debugMode) PrintAndLog("Error demoding: %d",ans);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintAndLog("PSK1 demoded bitstream:");
|
PrintAndLog("PSK1 demoded bitstream:");
|
||||||
// Now output the bitstream to the scrollback by line of 16 bits
|
// Now output the bitstream to the scrollback by line of 16 bits
|
||||||
printDemodBuff();
|
printDemodBuff();
|
||||||
|
|
|
@ -1687,7 +1687,7 @@ static void brute_force(void)
|
||||||
|
|
||||||
time(&end);
|
time(&end);
|
||||||
double elapsed_time = difftime(end, start);
|
double elapsed_time = difftime(end, start);
|
||||||
PrintAndLog("ICE %.f seconds", elapsed_time);
|
|
||||||
if(keys_found){
|
if(keys_found){
|
||||||
PrintAndLog("Success! Tested %"PRIu32" states, found %u keys after %.f seconds", total_states_tested, keys_found, elapsed_time);
|
PrintAndLog("Success! Tested %"PRIu32" states, found %u keys after %.f seconds", total_states_tested, keys_found, elapsed_time);
|
||||||
PrintAndLog("\nFound key: %012"PRIx64"\n", foundkey);
|
PrintAndLog("\nFound key: %012"PRIx64"\n", foundkey);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue