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.
This commit is contained in:
iceman1001 2015-03-18 20:32:53 +01:00
commit 251d07dbfb
2 changed files with 36 additions and 3 deletions

View file

@ -1021,7 +1021,7 @@ int CmdLFfind(const char *Cmd)
int ans=0; int ans=0;
char cmdp = param_getchar(Cmd, 0); char cmdp = param_getchar(Cmd, 0);
char testRaw = param_getchar(Cmd, 1); 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("Usage: lf search <0|1> [u]");
PrintAndLog(" <use data from Graphbuffer> , if not set, try reading data from tag."); PrintAndLog(" <use data from Graphbuffer> , if not set, try reading data from tag.");
PrintAndLog(" [Search for Unknown tags] , if not set, reads only known tags."); 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 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 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"); PrintAndLog(" : lf search 1 u = use data from GraphBuffer & search for known and unknown tags");
return 0; return 0;
} }
@ -1042,29 +1041,36 @@ int CmdLFfind(const char *Cmd)
return 0; return 0;
} }
if (cmdp == 'u' || cmdp == 'U') testRaw = 'u'; 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("NOTE: some demods output possible binary\n if it finds something that looks like a tag");
PrintAndLog("False Positives ARE possible\n"); PrintAndLog("False Positives ARE possible\n");
PrintAndLog("\nChecking for known tags:\n"); PrintAndLog("\nChecking for known tags:\n");
ans=CmdFSKdemodIO(""); ans=CmdFSKdemodIO("");
if (ans>0) { if (ans>0) {
PrintAndLog("\nValid IO Prox ID Found!"); PrintAndLog("\nValid IO Prox ID Found!");
return 1; return 1;
} }
ans=CmdFSKdemodPyramid(""); ans=CmdFSKdemodPyramid("");
if (ans>0) { if (ans>0) {
PrintAndLog("\nValid Pyramid ID Found!"); PrintAndLog("\nValid Pyramid ID Found!");
return 1; return 1;
} }
ans=CmdFSKdemodParadox(""); ans=CmdFSKdemodParadox("");
if (ans>0) { if (ans>0) {
PrintAndLog("\nValid Paradox ID Found!"); PrintAndLog("\nValid Paradox ID Found!");
return 1; return 1;
} }
ans=CmdFSKdemodAWID(""); ans=CmdFSKdemodAWID("");
if (ans>0) { if (ans>0) {
PrintAndLog("\nValid AWID ID Found!"); PrintAndLog("\nValid AWID ID Found!");
return 1; return 1;
} }
ans=CmdFSKdemodHID(""); ans=CmdFSKdemodHID("");
if (ans>0) { if (ans>0) {
PrintAndLog("\nValid HID Prox ID Found!"); PrintAndLog("\nValid HID Prox ID Found!");
@ -1091,7 +1097,33 @@ int CmdLFfind(const char *Cmd)
//test unknown tag formats (raw mode) //test unknown tag formats (raw mode)
PrintAndLog("\nChecking for Unknown tags:\n"); PrintAndLog("\nChecking for Unknown tags:\n");
ans=AutoCorrelate(4000, FALSE, FALSE); 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"); // ans=GetFskClock("",FALSE,FALSE); //CmdDetectClockRate("F"); //
if (ans != 0){ //fsk if (ans != 0){ //fsk
ans=FSKrawDemod("",FALSE); ans=FSKrawDemod("",FALSE);

View file

@ -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++){ for (uint8_t extraBitChk=0; extraBitChk<5; extraBitChk++){
errChk = preambleSearch(BitStream+extraBitChk+*startIdx, preamble, sizeof(preamble), size, startIdx); errChk = preambleSearch(BitStream+extraBitChk+*startIdx, preamble, sizeof(preamble), size, startIdx);
if (errChk == 0) return 0; if (errChk == 0) return 0;
if (*size<64) return 0;
if (*size>64) FmtLen = 22; if (*size>64) FmtLen = 22;
idx = *startIdx + 9; idx = *startIdx + 9;
for (i=0; i<FmtLen; i++){ //loop through 10 or 22 sets of 5 bits (50-10p = 40 bits or 88 bits) for (i=0; i<FmtLen; i++){ //loop through 10 or 22 sets of 5 bits (50-10p = 40 bits or 88 bits)