From: iceman1001 Date: Wed, 18 Mar 2015 19:32:53 +0000 (+0100) Subject: ADD: cmdlf autocorrelations, also gives a hint to how many bytes the possible correl... X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/251d07dbfbce165ddc32be3c3a1e567b1f291602 ADD: cmdlf autocorrelations, also gives a hint to how many bytes the possible correlation is. CHG: "LF SEARCH 1 U" didn't work since the strcmp was too short. Increased length of check. FIX: @marshmellows fix for faulty em410xdecoding of length less than 64. --- diff --git a/client/cmdlf.c b/client/cmdlf.c index 988bda36..46927f74 100644 --- a/client/cmdlf.c +++ b/client/cmdlf.c @@ -1021,7 +1021,7 @@ int CmdLFfind(const char *Cmd) int ans=0; char cmdp = param_getchar(Cmd, 0); char testRaw = param_getchar(Cmd, 1); - if (strlen(Cmd) > 2 || cmdp == 'h' || cmdp == 'H') { + if (strlen(Cmd) > 3 || cmdp == 'h' || cmdp == 'H') { PrintAndLog("Usage: lf search <0|1> [u]"); PrintAndLog(" , if not set, try reading data from tag."); PrintAndLog(" [Search for Unknown tags] , if not set, reads only known tags."); @@ -1030,7 +1030,6 @@ int CmdLFfind(const char *Cmd) PrintAndLog(" : lf search 1 = use data from GraphBuffer & search for known tags"); PrintAndLog(" : lf search u = try reading data from tag & search for known and unknown tags"); PrintAndLog(" : lf search 1 u = use data from GraphBuffer & search for known and unknown tags"); - return 0; } @@ -1042,29 +1041,36 @@ int CmdLFfind(const char *Cmd) return 0; } if (cmdp == 'u' || cmdp == 'U') testRaw = 'u'; + PrintAndLog("NOTE: some demods output possible binary\n if it finds something that looks like a tag"); PrintAndLog("False Positives ARE possible\n"); PrintAndLog("\nChecking for known tags:\n"); + ans=CmdFSKdemodIO(""); + if (ans>0) { PrintAndLog("\nValid IO Prox ID Found!"); return 1; } + ans=CmdFSKdemodPyramid(""); if (ans>0) { PrintAndLog("\nValid Pyramid ID Found!"); return 1; } + ans=CmdFSKdemodParadox(""); if (ans>0) { PrintAndLog("\nValid Paradox ID Found!"); return 1; } + ans=CmdFSKdemodAWID(""); if (ans>0) { PrintAndLog("\nValid AWID ID Found!"); return 1; } + ans=CmdFSKdemodHID(""); if (ans>0) { PrintAndLog("\nValid HID Prox ID Found!"); @@ -1091,7 +1097,33 @@ int CmdLFfind(const char *Cmd) //test unknown tag formats (raw mode) PrintAndLog("\nChecking for Unknown tags:\n"); ans=AutoCorrelate(4000, FALSE, FALSE); - if (ans > 0) PrintAndLog("Possible Auto Correlation of %d repeating samples",ans); + + if (ans > 0) { + + PrintAndLog("Possible Auto Correlation of %d repeating samples",ans); + + if ( ans % 8 == 0) { + int bytes = (ans / 8); + PrintAndLog("Possible %d bytes", bytes); + int blocks = 0; + if ( bytes % 2 == 0) { + blocks = (bytes / 2); + PrintAndLog("Possible 2 blocks, width %d", blocks); + } + if ( bytes % 4 == 0) { + blocks = (bytes / 4); + PrintAndLog("Possible 4 blocks, width %d", blocks); + } + if ( bytes % 8 == 0) { + blocks = (bytes / 8); + PrintAndLog("Possible 8 blocks, width %d", blocks); + } + if ( bytes % 16 == 0) { + blocks = (bytes / 16); + PrintAndLog("Possible 16 blocks, width %d", blocks); + } + } + } ans=GetFskClock("",FALSE,FALSE); //CmdDetectClockRate("F"); // if (ans != 0){ //fsk ans=FSKrawDemod("",FALSE); diff --git a/common/lfdemod.c b/common/lfdemod.c index 12f380d5..5b90f1c4 100644 --- a/common/lfdemod.c +++ b/common/lfdemod.c @@ -142,6 +142,7 @@ uint8_t Em410xDecode(uint8_t *BitStream, size_t *size, size_t *startIdx, uint32_ for (uint8_t extraBitChk=0; extraBitChk<5; extraBitChk++){ errChk = preambleSearch(BitStream+extraBitChk+*startIdx, preamble, sizeof(preamble), size, startIdx); if (errChk == 0) return 0; + if (*size<64) return 0; if (*size>64) FmtLen = 22; idx = *startIdx + 9; for (i=0; i