mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-05-12 11:18:11 -07:00
lf psk/nrz split, add maxErr argument
changed psk to use wave lengths instead of peaks split out NRZ from psk demod added maxErr argument to raw demods (except fsk)
This commit is contained in:
+2
-2
@@ -724,7 +724,7 @@ void CmdEM410xdemod(int findone, int *high, int *low, int ledcontrol)
|
||||
uint8_t *dest = BigBuf_get_addr();
|
||||
|
||||
size_t size=0, idx=0;
|
||||
int clk=0, invert=0, errCnt=0;
|
||||
int clk=0, invert=0, errCnt=0, maxErr=20;
|
||||
uint64_t lo=0;
|
||||
// Configure to go in 125Khz listen mode
|
||||
LFSetupFPGAForADC(95, true);
|
||||
@@ -738,7 +738,7 @@ void CmdEM410xdemod(int findone, int *high, int *low, int ledcontrol)
|
||||
size = BigBuf_max_traceLen();
|
||||
//Dbprintf("DEBUG: Buffer got");
|
||||
//askdemod and manchester decode
|
||||
errCnt = askmandemod(dest, &size, &clk, &invert);
|
||||
errCnt = askmandemod(dest, &size, &clk, &invert, maxErr);
|
||||
//Dbprintf("DEBUG: ASK Got");
|
||||
WDT_HIT();
|
||||
|
||||
|
||||
+336
-75
File diff suppressed because it is too large
Load Diff
+8
-2
@@ -17,6 +17,7 @@ int CmdData(const char *Cmd);
|
||||
void printDemodBuff();
|
||||
int CmdAmp(const char *Cmd);
|
||||
int Cmdaskdemod(const char *Cmd);
|
||||
int CmdAskEM410xDemod(const char *Cmd);
|
||||
int Cmdaskrawdemod(const char *Cmd);
|
||||
int Cmdaskmandemod(const char *Cmd);
|
||||
int CmdAutoCorr(const char *Cmd);
|
||||
@@ -26,15 +27,19 @@ int CmdBitstream(const char *Cmd);
|
||||
int CmdBuffClear(const char *Cmd);
|
||||
int CmdDec(const char *Cmd);
|
||||
int CmdDetectClockRate(const char *Cmd);
|
||||
int CmdDetectNRZClockRate(const char *Cmd);
|
||||
int CmdDetectPSKClockRate(const char *Cmd);
|
||||
int CmdFSKdemodAWID(const char *Cmd);
|
||||
int CmdFSKdemod(const char *Cmd);
|
||||
int CmdFSKdemodHID(const char *Cmd);
|
||||
int CmdFSKdemodIO(const char *Cmd);
|
||||
int CmdFSKdemodParadox(const char *Cmd);
|
||||
int CmdFSKdemodPyramid(const char *Cmd);
|
||||
int CmdFSKfcDetect(const char *Cmd);
|
||||
int CmdFSKrawdemod(const char *Cmd);
|
||||
int CmdDetectNRZpskClockRate(const char *Cmd);
|
||||
int CmdpskNRZrawDemod(const char *Cmd);
|
||||
int CmdDetectPskClockRate(const char *Cmd);
|
||||
int CmdPSK1rawDemod(const char *Cmd);
|
||||
int CmdPSK2rawDemod(const char *Cmd);
|
||||
int CmdGrid(const char *Cmd);
|
||||
int CmdHexsamples(const char *Cmd);
|
||||
int CmdHide(const char *Cmd);
|
||||
@@ -46,6 +51,7 @@ int Cmdmandecoderaw(const char *Cmd);
|
||||
int CmdManchesterDemod(const char *Cmd);
|
||||
int CmdManchesterMod(const char *Cmd);
|
||||
int CmdNorm(const char *Cmd);
|
||||
int CmdNRZrawDemod(const char *Cmd);
|
||||
int CmdPlot(const char *Cmd);
|
||||
int CmdSamples(const char *Cmd);
|
||||
int CmdTuneSamples(const char *Cmd);
|
||||
|
||||
+39
-9
@@ -559,13 +559,17 @@ int CmdLFfind(const char *Cmd)
|
||||
{
|
||||
int ans=0;
|
||||
char cmdp = param_getchar(Cmd, 0);
|
||||
|
||||
if (strlen(Cmd) > 1 || cmdp == 'h' || cmdp == 'H') {
|
||||
PrintAndLog("Usage: lf search <0|1>");
|
||||
PrintAndLog(" <use data from Graphbuffer>, if not set, try reading data from tag.");
|
||||
char testRaw = param_getchar(Cmd, 1);
|
||||
if (strlen(Cmd) > 2 || cmdp == 'h' || cmdp == 'H') {
|
||||
PrintAndLog("Usage: lf search <0|1> [u]");
|
||||
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("");
|
||||
PrintAndLog(" sample: lf search");
|
||||
PrintAndLog(" : lf search 1");
|
||||
PrintAndLog(" sample: lf search = try reading data from tag & 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 1 u = use data from GraphBuffer & search for known and unknown tags");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -576,8 +580,9 @@ int CmdLFfind(const char *Cmd)
|
||||
PrintAndLog("Data in Graphbuffer was too small.");
|
||||
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) {
|
||||
@@ -610,12 +615,37 @@ int CmdLFfind(const char *Cmd)
|
||||
PrintAndLog("\nValid Indala ID Found!");
|
||||
return 1;
|
||||
}
|
||||
ans=Cmdaskmandemod("");
|
||||
ans=CmdAskEM410xDemod("");
|
||||
if (ans>0) {
|
||||
PrintAndLog("\nValid EM410x ID Found!");
|
||||
return 1;
|
||||
}
|
||||
PrintAndLog("No Known Tags Found!\n");
|
||||
PrintAndLog("\nNo Known Tags Found!\n");
|
||||
if (testRaw=='u' || testRaw=='U'){
|
||||
//test unknown tag formats (raw mode)
|
||||
PrintAndLog("\nChecking for Unknown tags:\n");
|
||||
ans=CmdFSKfcDetect("");
|
||||
if (ans == 1){ //fsk
|
||||
ans=CmdFSKrawdemod("");
|
||||
if (ans>0) {
|
||||
PrintAndLog("\nUnknown FSK Modulated Tag Found!");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
ans=Cmdaskmandemod("");
|
||||
if (ans>0) {
|
||||
PrintAndLog("\nUnknown ASK Modulated and Manchester encoded Tag Found!");
|
||||
return 1;
|
||||
}
|
||||
ans=CmdPSK1rawDemod("");
|
||||
if (ans>0) {
|
||||
PrintAndLog("Possible unknown PSK1 Modulated Tag Found above!\n\nCould also be PSK2 - try 'data psk2rawdemod'");
|
||||
PrintAndLog("\nCould also be PSK3 - [currently not supported]");
|
||||
PrintAndLog("\nCould also be NRZ - try 'data nrzrawdemod");
|
||||
return 1;
|
||||
}
|
||||
PrintAndLog("\nNo Data Found!\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+29
-5
@@ -66,8 +66,7 @@ void setGraphBuf(uint8_t *buff, size_t size)
|
||||
}
|
||||
size_t getFromGraphBuf(uint8_t *buff)
|
||||
{
|
||||
if ( buff == NULL ) return 0;
|
||||
|
||||
if (buff == NULL ) return 0;
|
||||
uint32_t i;
|
||||
for (i=0;i<GraphTraceLen;++i){
|
||||
if (GraphBuffer[i]>127) GraphBuffer[i]=127; //trim
|
||||
@@ -95,7 +94,7 @@ int GetClock(const char *str, int peak, int verbose)
|
||||
PrintAndLog("Failed to copy from graphbuffer");
|
||||
return -1;
|
||||
}
|
||||
clock = DetectASKClock(grph,size,0);
|
||||
clock = DetectASKClock(grph,size,0,20);
|
||||
// Only print this message if we're not looping something
|
||||
if (!verbose){
|
||||
PrintAndLog("Auto-detected clock rate: %d", clock);
|
||||
@@ -136,7 +135,7 @@ void DetectHighLowInGraph(int *high, int *low, bool addFuzz) {
|
||||
}
|
||||
}
|
||||
|
||||
int GetNRZpskClock(const char *str, int peak, int verbose)
|
||||
int GetPskClock(const char *str, int peak, int verbose)
|
||||
{
|
||||
int clock;
|
||||
sscanf(str, "%i", &clock);
|
||||
@@ -152,7 +151,32 @@ int GetNRZpskClock(const char *str, int peak, int verbose)
|
||||
PrintAndLog("Failed to copy from graphbuffer");
|
||||
return -1;
|
||||
}
|
||||
clock = DetectpskNRZClock(grph,size,0);
|
||||
clock = DetectPSKClock(grph,size,0);
|
||||
// Only print this message if we're not looping something
|
||||
if (!verbose){
|
||||
PrintAndLog("Auto-detected clock rate: %d", clock);
|
||||
}
|
||||
}
|
||||
return clock;
|
||||
}
|
||||
|
||||
int GetNrzClock(const char *str, int peak, int verbose)
|
||||
{
|
||||
int clock;
|
||||
sscanf(str, "%i", &clock);
|
||||
if (!strcmp(str, ""))
|
||||
clock = 0;
|
||||
|
||||
// Auto-detect clock
|
||||
if (!clock)
|
||||
{
|
||||
uint8_t grph[MAX_GRAPH_TRACE_LEN]={0};
|
||||
size_t size = getFromGraphBuf(grph);
|
||||
if ( size == 0 ) {
|
||||
PrintAndLog("Failed to copy from graphbuffer");
|
||||
return -1;
|
||||
}
|
||||
clock = DetectNRZClock(grph,size,0);
|
||||
// Only print this message if we're not looping something
|
||||
if (!verbose){
|
||||
PrintAndLog("Auto-detected clock rate: %d", clock);
|
||||
|
||||
+2
-1
@@ -17,7 +17,8 @@ int ClearGraph(int redraw);
|
||||
//int DetectClock(int peak);
|
||||
size_t getFromGraphBuf(uint8_t *buff);
|
||||
int GetClock(const char *str, int peak, int verbose);
|
||||
int GetNRZpskClock(const char *str, int peak, int verbose);
|
||||
int GetPskClock(const char *str, int peak, int verbose);
|
||||
int GetNrzClock(const char *str, int peak, int verbose);
|
||||
void setGraphBuf(uint8_t *buff, size_t size);
|
||||
|
||||
bool HasGraphData();
|
||||
|
||||
Reference in New Issue
Block a user