mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-27 10:29:18 +08:00
lf keri demod - when doing invert of bits, do before decoding
This commit is contained in:
parent
be8d2fbd25
commit
ce50c50fcd
1 changed files with 21 additions and 17 deletions
|
@ -123,17 +123,6 @@ int demodKeri(bool verbose) {
|
||||||
setDemodBuff(DemodBuffer, size, idx);
|
setDemodBuff(DemodBuffer, size, idx);
|
||||||
setClockGrid(g_DemodClock, g_DemodStartIdx + (idx * g_DemodClock));
|
setClockGrid(g_DemodClock, g_DemodStartIdx + (idx * g_DemodClock));
|
||||||
|
|
||||||
//got a good demod
|
|
||||||
uint32_t raw1 = bytebits_to_byte(DemodBuffer, 32);
|
|
||||||
uint32_t raw2 = bytebits_to_byte(DemodBuffer + 32, 32);
|
|
||||||
|
|
||||||
//get internal id
|
|
||||||
// uint32_t ID = bytebits_to_byte(DemodBuffer + 29, 32);
|
|
||||||
// Due to the 3 sync bits being at the start of the capture
|
|
||||||
// We can take the last 32bits as the internal ID.
|
|
||||||
uint32_t ID = raw2;
|
|
||||||
ID &= 0x7FFFFFFF;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
000000000000000000000000000001XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX111
|
000000000000000000000000000001XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX111
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^1###############################^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^1###############################^^^
|
||||||
|
@ -148,25 +137,40 @@ int demodKeri(bool verbose) {
|
||||||
Might be a hash of FC & CN to generate Internal ID
|
Might be a hash of FC & CN to generate Internal ID
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PrintAndLogEx(SUCCESS, "KERI - Internal ID: " _GREEN_("%u") ", Raw: %08X%08X", ID, raw1, raw2);
|
|
||||||
/*
|
/*
|
||||||
Descramble Data.
|
Descramble Data.
|
||||||
*/
|
*/
|
||||||
uint32_t fc = 0;
|
uint32_t fc = 0;
|
||||||
uint32_t cardid = 0;
|
uint32_t cardid = 0;
|
||||||
|
//got a good demod
|
||||||
// Just need to the low 32 bits without the 111 trailer
|
uint32_t raw1 = bytebits_to_byte(DemodBuffer, 32);
|
||||||
CmdKeriMSScramble(Descramble, &fc, &cardid, &raw2);
|
uint32_t raw2 = bytebits_to_byte(DemodBuffer + 32, 32);
|
||||||
|
|
||||||
PrintAndLogEx(SUCCESS, "Descrambled MS - FC: " _GREEN_("%d") " Card: " _GREEN_("%d"), fc, cardid);
|
|
||||||
|
|
||||||
if (invert) {
|
if (invert) {
|
||||||
PrintAndLogEx(INFO, "Had to Invert - probably KERI");
|
PrintAndLogEx(INFO, "Had to Invert - probably KERI");
|
||||||
for (size_t i = 0; i < size; i++)
|
for (size_t i = 0; i < size; i++)
|
||||||
DemodBuffer[i] ^= 1;
|
DemodBuffer[i] ^= 1;
|
||||||
|
|
||||||
|
raw1 = bytebits_to_byte(DemodBuffer, 32);
|
||||||
|
raw2 = bytebits_to_byte(DemodBuffer + 32, 32);
|
||||||
|
|
||||||
CmdPrintDemodBuff("x");
|
CmdPrintDemodBuff("x");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//get internal id
|
||||||
|
// uint32_t ID = bytebits_to_byte(DemodBuffer + 29, 32);
|
||||||
|
// Due to the 3 sync bits being at the start of the capture
|
||||||
|
// We can take the last 32bits as the internal ID.
|
||||||
|
uint32_t ID = raw2;
|
||||||
|
ID &= 0x7FFFFFFF;
|
||||||
|
|
||||||
|
PrintAndLogEx(SUCCESS, "KERI - Internal ID: " _GREEN_("%u") ", Raw: %08X%08X", ID, raw1, raw2);
|
||||||
|
|
||||||
|
// Just need to the low 32 bits without the 111 trailer
|
||||||
|
CmdKeriMSScramble(Descramble, &fc, &cardid, &raw2);
|
||||||
|
|
||||||
|
PrintAndLogEx(SUCCESS, "Descrambled MS - FC: " _GREEN_("%d") " Card: " _GREEN_("%d"), fc, cardid);
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue