]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
ADD: 'lf search' - added a rudimentary identification of IDTECK tags, will demod...
authoriceman1001 <iceman@iuse.se>
Wed, 11 Jan 2017 23:04:36 +0000 (00:04 +0100)
committericeman1001 <iceman@iuse.se>
Wed, 11 Jan 2017 23:04:36 +0000 (00:04 +0100)
client/cmddata.c
client/cmddata.h
client/cmdlf.c
client/cmdlfpresco.c
client/cmdlfvisa2000.c
common/lfdemod.c
common/lfdemod.h

index 1e7947ffcd63c6e45c1d2966f9bd26463aa06960..f1e89f6395c37180eef6686faca16ed23422b767 100644 (file)
@@ -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
index 67bf3316bb4b23c99c5785eefe11281e148b6169..b0ff5bd06327cacd1f30197c181f8271c01d80e6 100644 (file)
@@ -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);
index e1cb1bdf865c08dc33f3123d29a6fac10d60a87d..fdf454c50d76fec7967ea9b2b013d9fb16f83ada 100644 (file)
@@ -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!");
index 8a9f8c5d7df610290cd54157cefa542af1fb7f40..36f99107bc8eddb493104c7b32c8d971b0508e3f 100644 (file)
@@ -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;
index b74a318a1924f9c171481f89c569c6b32cfbfc2b..9eca4052f988a85cef6e8752b8febca6efa79eb6 100644 (file)
@@ -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}};
index c35ce561881757cc4b3d15c7114c3187f86acf0d..4613270383ed737511d525e739f5da7692579588 100644 (file)
@@ -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)
index 11634d00e62e9b74ceb5c159174cd0f6d68e0bf1..7bd3ce405faf85e3758dd676eb21738527bb1a07 100644 (file)
@@ -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
Impressum, Datenschutz