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
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);
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!");
//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;
//
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}};
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)
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