mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-12-31 04:39:49 +08:00
ADD: 'lf search' - added a rudimentary identification of IDTECK tags, will demod to PSK1, if fails it tries to PSK1 inverted demod.
This commit is contained in:
parent
701ad7cb3a
commit
3acac886bc
7 changed files with 80 additions and 3 deletions
|
@ -1889,6 +1889,63 @@ int CmdPSKNexWatch(const char *Cmd)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int CmdPSKIdteck(const char *Cmd) {
|
||||
|
||||
if (!PSKDemod("", false)) {
|
||||
if (g_debugMode) PrintAndLog("DEBUG: Error - Idteck PSKDemod failed");
|
||||
return 0;
|
||||
}
|
||||
size_t size = DemodBufferLen;
|
||||
|
||||
//get binary from PSK1 wave
|
||||
int idx = IdteckDemodPSK(DemodBuffer, &size);
|
||||
if (idx < 0){
|
||||
if (g_debugMode){
|
||||
if (idx == -1)
|
||||
PrintAndLog("DEBUG: Error - Idteck: not enough samples");
|
||||
else if (idx == -2)
|
||||
PrintAndLog("DEBUG: Error - Idteck: preamble not found");
|
||||
else if (idx == -3)
|
||||
PrintAndLog("DEBUG: Error - Idteck: size not correct: %d", size);
|
||||
else
|
||||
PrintAndLog("DEBUG: Error - Idteck: idx: %d",idx);
|
||||
}
|
||||
|
||||
// if didn't find preamble try again inverting
|
||||
if (!PSKDemod("1", false)) {
|
||||
if (g_debugMode) PrintAndLog("DEBUG: Error - Idteck PSKDemod failed");
|
||||
return 0;
|
||||
}
|
||||
idx = IdteckDemodPSK(DemodBuffer, &size);
|
||||
if (idx < 0){
|
||||
if (g_debugMode){
|
||||
if (idx == -1)
|
||||
PrintAndLog("DEBUG: Error - Idteck: not enough samples");
|
||||
else if (idx == -2)
|
||||
PrintAndLog("DEBUG: Error - Idteck: preamble not found");
|
||||
else if (idx == -3)
|
||||
PrintAndLog("DEBUG: Error - Idteck: size not correct: %d", size);
|
||||
else
|
||||
PrintAndLog("DEBUG: Error - Idteck: idx: %d",idx);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
setDemodBuf(DemodBuffer, 64, idx);
|
||||
|
||||
//got a good demod
|
||||
uint32_t id = 0;
|
||||
uint32_t raw1 = bytebits_to_byte(DemodBuffer, 32);
|
||||
uint32_t raw2 = bytebits_to_byte(DemodBuffer+32, 32);
|
||||
|
||||
//parity check (TBD)
|
||||
//checksum check (TBD)
|
||||
|
||||
//output
|
||||
PrintAndLog("IDTECK Tag Found: Card ID %u , Raw: %08X%08X", id, raw1, raw2);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// by marshmellow
|
||||
// takes 3 arguments - clock, invert, maxErr as integers
|
||||
// attempts to demodulate nrz only
|
||||
|
|
|
@ -47,6 +47,7 @@ int CmdFSKrawdemod(const char *Cmd);
|
|||
int CmdPSK1rawDemod(const char *Cmd);
|
||||
int CmdPSK2rawDemod(const char *Cmd);
|
||||
int CmdPSKNexWatch(const char *Cmd);
|
||||
int CmdPSKIdteck(const char *Cmd);
|
||||
int CmdGrid(const char *Cmd);
|
||||
int CmdGetBitStream(const char *Cmd);
|
||||
int CmdHexsamples(const char *Cmd);
|
||||
|
|
|
@ -1087,6 +1087,11 @@ int CmdLFfind(const char *Cmd) {
|
|||
PrintAndLog("\nValid NexWatch ID Found!");
|
||||
return 1;
|
||||
}
|
||||
ans=CmdPSKIdteck("");
|
||||
if (ans>0) {
|
||||
PrintAndLog("\nValid Idteck ID Found!");
|
||||
return 1;
|
||||
}
|
||||
ans=CmdJablotronDemod("");
|
||||
if (ans>0) {
|
||||
PrintAndLog("\nValid Jablotron ID Found!");
|
||||
|
|
|
@ -116,7 +116,7 @@ int GetPrescoBits(uint32_t fullcode, uint8_t *prescoBits) {
|
|||
//see ASKDemod for what args are accepted
|
||||
int CmdPrescoDemod(const char *Cmd) {
|
||||
bool st = true;
|
||||
//if (!ASKDemod(Cmd, false, false, 1)) {
|
||||
|
||||
if (!ASKDemod_ext("32 0 0", FALSE, FALSE, 1, &st)) {
|
||||
if (g_debugMode) PrintAndLog("DEBUG: Error Presco ASKDemod failed");
|
||||
return 0;
|
||||
|
|
|
@ -121,13 +121,13 @@ int CmdVisa2kClone(const char *Cmd) {
|
|||
|
||||
//
|
||||
blocks[2] = id;
|
||||
blocks[3] = visa_chksum( id);
|
||||
blocks[3] = visa_chksum(id);
|
||||
|
||||
PrintAndLog("Preparing to clone Visa2000 to T55x7 with CardId: %u", id);
|
||||
PrintAndLog("Blk | Data ");
|
||||
PrintAndLog("----+------------");
|
||||
for(int i = 0; i<4; ++i)
|
||||
PrintAndLog(" %02d | 0x%08x", i , blocks[i]);
|
||||
PrintAndLog(" %02d | 0x%08x", i , blocks[i]);
|
||||
|
||||
UsbCommand resp;
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0,0,0}};
|
||||
|
|
|
@ -822,6 +822,19 @@ int NedapDemod(uint8_t *dest, size_t *size) {
|
|||
return (int) startIdx;
|
||||
}
|
||||
|
||||
// Find IDTEC PSK1, RF Preamble == 0x4944544B, Demodsize 64bits
|
||||
// by iceman
|
||||
int IdteckDemodPSK(uint8_t *dest, size_t *size) {
|
||||
//make sure buffer has data
|
||||
if (*size < 64*2) return -1;
|
||||
size_t startIdx = 0;
|
||||
uint8_t preamble[] = {0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,0,1,0,1,1};
|
||||
uint8_t errChk = preambleSearch(dest, preamble, sizeof(preamble), size, &startIdx);
|
||||
if (errChk == 0) return -2; //preamble not found
|
||||
if (*size != 64) return -3; // wrong demoded size
|
||||
return (int) startIdx;
|
||||
}
|
||||
|
||||
// by marshmellow
|
||||
// to detect a wave that has heavily clipped (clean) samples
|
||||
uint8_t DetectCleanAskWave(uint8_t dest[], size_t size, uint8_t high, uint8_t low)
|
||||
|
|
|
@ -60,4 +60,5 @@ int NedapDemod(uint8_t *dest, size_t *size);
|
|||
int JablotronDemod(uint8_t *dest, size_t *size);
|
||||
int Visa2kDemod_AM(uint8_t *dest, size_t *size);
|
||||
int NoralsyDemod_AM(uint8_t *dest, size_t *size);
|
||||
int IdteckDemodPSK(uint8_t *dest, size_t *size);
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue