data autocorr additions

This commit is contained in:
marshmellow42 2015-03-13 12:23:26 -04:00
parent 5279085ae7
commit 9f7bbd24c9
3 changed files with 24 additions and 9 deletions

View file

@ -66,6 +66,7 @@ CMDSRCS = nonce2key/crapto1.c\
loclass/elite_crack.c\
loclass/fileutils.c\
mifarehost.c\
crc.c \
crc16.c \
iso14443crc.c \
iso15693tools.c \

View file

@ -774,20 +774,34 @@ int AutoCorrelate(int window, bool SaveGrph, bool verbose)
return Correlation;
}
int usage_data_autocorr(void)
{
//print help
PrintAndLog("Usage: data autocorr [window] [g]");
PrintAndLog("Options: ");
PrintAndLog(" h This help");
PrintAndLog(" [window] window length for correlation - default = 4000");
PrintAndLog(" g save back to GraphBuffer (overwrite)");
return 0;
}
int CmdAutoCorr(const char *Cmd)
{
int window = atoi(Cmd);
char cmdp = param_getchar(Cmd, 0);
if (cmdp == 'h' || cmdp == 'H')
return usage_data_autocorr();
int window = 4000; //set default
char grph=0;
bool updateGrph = FALSE;
sscanf(Cmd, "%i %c", &window, &grph);
if (window == 0) {
PrintAndLog("needs a window");
return 0;
}
if (window >= GraphTraceLen) {
PrintAndLog("window must be smaller than trace (%d samples)",
GraphTraceLen);
return 0;
}
return AutoCorrelate(window, TRUE, TRUE);
if (grph == 'g') updateGrph=TRUE;
return AutoCorrelate(window, updateGrph, TRUE);
}
int CmdBitsamples(const char *Cmd)
@ -1471,7 +1485,7 @@ int CmdFSKdemodPyramid(const char *Cmd)
csBuff[i] = bytebits_to_byte(BitStream + idx + 16 + (i*8), 8);
}
//check checksum calc
int checkCS = CRC8Maxim(csBuff,13);
uint32_t checkCS = CRC8Maxim(csBuff,13);
//get raw ID before removing parities
uint32_t rawLo = bytebits_to_byte(BitStream+idx+96,32);
@ -2625,7 +2639,7 @@ static command_t CommandTable[] =
{"askgproxiidemod",CmdG_Prox_II_Demod,1, "Demodulate a G Prox II tag from GraphBuffer"},
//{"askmandemod", Cmdaskmandemod, 1, "[clock] [invert<0|1>] [maxErr] -- Attempt to demodulate ASK/Manchester tags and output binary (args optional)"},
//{"askrawdemod", Cmdaskrawdemod, 1, "[clock] [invert<0|1>] -- Attempt to demodulate ASK tags and output bin (args optional)"},
{"autocorr", CmdAutoCorr, 1, "<window length> -- Autocorrelation over window"},
{"autocorr", CmdAutoCorr, 1, "[window length] [g] -- Autocorrelation over window - g to save back to GraphBuffer (overwrite)"},
{"biphaserawdecode",CmdBiphaseDecodeRaw,1,"[offset] [invert<0|1>] Biphase decode bin stream in DemodBuffer (offset = 0|1 bits to shift the decode start)"},
{"bitsamples", CmdBitsamples, 0, "Get raw samples as bitstring"},
//{"bitstream", CmdBitstream, 1, "[clock rate] -- Convert waveform into a bitstream"},

View file

@ -1539,7 +1539,7 @@ int CmdHF14AMfCLoad(const char *Cmd)
char buf[64] = {0x00};
uint8_t buf8[64] = {0x00};
uint8_t fillFromEmulator = 0;
int i, len, blockNum, flags;
int i, len, blockNum, flags=0;
if (param_getchar(Cmd, 0) == 'h' || param_getchar(Cmd, 0)== 0x00) {
PrintAndLog("It loads magic Chinese card from the file `filename.eml`");