X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/bb73c58d9a5501426646b8fcfff87331ea3312a6..a0a61c91ccefed75187e810cca0e3bcb319ecdcf:/client/cmddata.c?ds=sidebyside diff --git a/client/cmddata.c b/client/cmddata.c index 12ac7bf9..1e7947ff 100644 --- a/client/cmddata.c +++ b/client/cmddata.c @@ -253,19 +253,17 @@ void setDemodBuf(uint8_t *buff, size_t size, size_t startIdx) if ( size >= MAX_DEMOD_BUF_LEN) size = MAX_DEMOD_BUF_LEN; - - size_t i = 0; - for (; i < size; i++){ + + for (size_t i = 0; i < size; i++) DemodBuffer[i]=buff[startIdx++]; - } + DemodBufferLen = size; } -int CmdSetDebugMode(const char *Cmd) -{ - int demod=0; +int CmdSetDebugMode(const char *Cmd) { + int demod = 0; sscanf(Cmd, "%i", &demod); - g_debugMode=(uint8_t)demod; + g_debugMode = (uint8_t)demod; return 1; } @@ -1462,6 +1460,7 @@ int CmdFSKdemodAWID(const char *Cmd) uint32_t code1 = 0; uint32_t code2 = 0; uint8_t fmtLen = bytebits_to_byte(BitStream, 8); + switch(fmtLen) { case 26: fc = bytebits_to_byte(BitStream + 9, 8); @@ -1469,6 +1468,22 @@ int CmdFSKdemodAWID(const char *Cmd) code1 = bytebits_to_byte(BitStream + 8,fmtLen); PrintAndLog("AWID Found - BitLength: %d, FC: %d, Card: %u - Wiegand: %x, Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, rawHi2, rawHi, rawLo); break; + case 34: + fc = bytebits_to_byte(BitStream + 9, 8); + cardnum = bytebits_to_byte(BitStream + 17, 24); + code1 = bytebits_to_byte(BitStream + 8, (fmtLen-32) ); + code2 = bytebits_to_byte(BitStream + 8 + (fmtLen-32), 32); + PrintAndLog("AWID Found - BitLength: %d, FC: %d, Card: %u - Wiegand: %x%08x, Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, code2, rawHi2, rawHi, rawLo); + break; + case 37: + fc = bytebits_to_byte(BitStream + 9, 13); + cardnum = bytebits_to_byte(BitStream + 22, 18); + code1 = bytebits_to_byte(BitStream + 8, (fmtLen-32) ); + code2 = bytebits_to_byte(BitStream + 8 + (fmtLen-32), 32); + PrintAndLog("AWID Found - BitLength: %d, FC: %d, Card: %u - Wiegand: %x%08x, Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, code2, rawHi2, rawHi, rawLo); + break; + // case 40: + // break; case 50: fc = bytebits_to_byte(BitStream + 9, 16); cardnum = bytebits_to_byte(BitStream + 25, 32); @@ -1691,12 +1706,7 @@ int CmdFDXBdemodBI(const char *Cmd){ if (g_debugMode) PrintAndLog("DEBUG: Error - FDXB error removeParity:: %d", size); return 0; } - if (g_debugMode) { - char *bin = sprint_bin_break(BitStream,size,16); - PrintAndLog("DEBUG BinStream:\n%s",bin); - } PrintAndLog("\nFDX-B / ISO 11784/5 Animal Tag ID Found:"); - if (g_debugMode) PrintAndLog("Start marker %d; Size %d", preambleIndex, size); //got a good demod uint64_t NationalCode = ((uint64_t)(bytebits_to_byteLSBF(BitStream+32,6)) << 32) | bytebits_to_byteLSBF(BitStream,32); @@ -1717,11 +1727,17 @@ int CmdFDXBdemodBI(const char *Cmd){ PrintAndLog("Animal ID: %04u-%012llu", countryCode, NationalCode); PrintAndLog("National Code: %012llu", NationalCode); PrintAndLog("CountryCode: %04u", countryCode); - PrintAndLog("Extended Data: %s", dataBlockBit ? "True" : "False"); - PrintAndLog("reserved Code: %u", reservedCode); - PrintAndLog("Animal Tag: %s", animalBit ? "True" : "False"); + + PrintAndLog("Reserved/RFU: %u", reservedCode); + PrintAndLog("Animal Tag: %s", animalBit ? "True" : "False"); + PrintAndLog("Has extended data: %s [0x%X]", dataBlockBit ? "True" : "False", extended); PrintAndLog("CRC: 0x%04X - [%04X] - %s", crc16, calcCrc, (calcCrc == crc16) ? "Passed" : "Failed"); - PrintAndLog("Extended: 0x%X\n", extended); + + if (g_debugMode) { + PrintAndLog("Start marker %d; Size %d", preambleIndex, size); + char *bin = sprint_bin_break(BitStream,size,16); + PrintAndLog("DEBUG BinStream:\n%s",bin); + } return 1; } @@ -1802,21 +1818,24 @@ int CmdIndalaDecode(const char *Cmd) if (invert) if (g_debugMode) PrintAndLog("DEBUG: Error - Indala had to invert bits"); - PrintAndLog("BitLen: %d",DemodBufferLen); //convert UID to HEX uint32_t uid1, uid2, uid3, uid4, uid5, uid6, uid7; uid1 = bytebits_to_byte(DemodBuffer,32); uid2 = bytebits_to_byte(DemodBuffer+32,32); if (DemodBufferLen==64){ - PrintAndLog("Indala UID=%s (%x%08x)", sprint_bin_break(DemodBuffer,DemodBufferLen,16), uid1, uid2); + PrintAndLog("Indala Found - Bitlength %d, UID = (%x%08x)\n%s", + DemodBufferLen, uid1, uid2, sprint_bin_break(DemodBuffer,DemodBufferLen,32) + ); } else { uid3 = bytebits_to_byte(DemodBuffer+64,32); uid4 = bytebits_to_byte(DemodBuffer+96,32); uid5 = bytebits_to_byte(DemodBuffer+128,32); uid6 = bytebits_to_byte(DemodBuffer+160,32); uid7 = bytebits_to_byte(DemodBuffer+192,32); - PrintAndLog("Indala UID=%s (%x%08x%08x%08x%08x%08x%08x)", - sprint_bin_break(DemodBuffer,DemodBufferLen,16), uid1, uid2, uid3, uid4, uid5, uid6, uid7); + PrintAndLog("Indala Found - Bitlength %d, UID = (%x%08x%08x%08x%08x%08x%08x)\n%s", + DemodBufferLen, + uid1, uid2, uid3, uid4, uid5, uid6, uid7, sprint_bin_break(DemodBuffer,DemodBufferLen,32) + ); } if (g_debugMode){ PrintAndLog("DEBUG: Indala - printing demodbuffer:");