added data psk* cmds for pskdemod

fixed a couple small bugs in other lf functions as well including
detectaskclock,  stopped changes from being made to graphbuffer.
This commit is contained in:
marshmellow42
2015-01-07 18:13:26 -05:00
parent 4df54240c1
commit 4118b74dc8
11 changed files with 18827 additions and 2078 deletions
+1425 -1415
View File
File diff suppressed because it is too large Load Diff
+269 -68
View File
File diff suppressed because it is too large Load Diff
+8 -1
View File
@@ -14,7 +14,7 @@
command_t * CmdDataCommands();
int CmdData(const char *Cmd);
void printDemodBuff();
int CmdAmp(const char *Cmd);
int Cmdaskdemod(const char *Cmd);
int Cmdaskrawdemod(const char *Cmd);
@@ -30,6 +30,8 @@ int CmdFSKdemod(const char *Cmd);
int CmdFSKdemodHID(const char *Cmd);
int CmdFSKdemodIO(const char *Cmd);
int CmdFSKrawdemod(const char *Cmd);
int CmdDetectNRZpskClockRate(const char *Cmd);
int CmdpskNRZrawDemod(const char *Cmd);
int CmdGrid(const char *Cmd);
int CmdHexsamples(const char *Cmd);
int CmdHide(const char *Cmd);
@@ -49,5 +51,10 @@ int CmdScale(const char *Cmd);
int CmdThreshold(const char *Cmd);
int CmdDirectionalThreshold(const char *Cmd);
int CmdZerocrossings(const char *Cmd);
int CmdIndalaDecode(const char *Cmd);
#define MAX_DEMOD_BUF_LEN (1024*128)
extern uint8_t DemodBuffer[MAX_DEMOD_BUF_LEN];
extern int DemodBufferLen;
#endif
+22 -8
View File
@@ -56,7 +56,7 @@ int CmdFlexdemod(const char *Cmd)
}
}
#define LONG_WAIT 100
#define LONG_WAIT 100
int start;
for (start = 0; start < GraphTraceLen - LONG_WAIT; start++) {
int first = GraphBuffer[start];
@@ -559,18 +559,32 @@ int CmdLFfind(const char *Cmd)
ans=CmdSamples("20000");
}
if (GraphTraceLen<1000) return 0;
PrintAndLog("NOTE: some demods output possible binary\n if it finds something that looks like a tag");
PrintAndLog("Checking for known tags:");
ans=Cmdaskmandemod("");
if (ans>0) return 1;
if (ans>0) {
PrintAndLog("Valid EM410x ID Found!");
return 1;
}
ans=CmdFSKdemodHID("");
if (ans>0) return 1;
if (ans>0) {
PrintAndLog("Valid HID Prox ID Found!");
return 1;
}
ans=CmdFSKdemodIO("");
if (ans>0) return 1;
if (ans>0) {
PrintAndLog("Valid IO Prox ID Found!");
return 1;
}
//add psk and indala
ans=CmdIndalaDemod("");
if (ans>0) return 1;
ans=CmdIndalaDemod("224");
if (ans>0) return 1;
ans=CmdIndalaDecode("");
if (ans>0) {
PrintAndLog("Valid Indala ID Found!");
return 1;
}
// ans=CmdIndalaDemod("224");
// if (ans>0) return 1;
PrintAndLog("No Known Tags Found!\n");
return 0;
}
+1 -1
View File
@@ -606,7 +606,7 @@ int CmdWriteWordPWD(const char *Cmd)
static command_t CommandTable[] =
{
{"help", CmdHelp, 1, "This help"},
{"em410xdemod", CmdEMdemodASK, 0, "[clock rate] -- Extract ID from EM410x tag"},
{"em410xdemod", CmdEMdemodASK, 0, "[findone] -- Extract ID from EM410x tag (option 0 for continuous loop, 1 for only 1 tag)"},
{"em410xread", CmdEM410xRead, 1, "[clock rate] -- Extract ID from EM410x tag"},
{"em410xsim", CmdEM410xSim, 0, "<UID> -- Simulate EM410x tag"},
{"em410xwatch", CmdEM410xWatch, 0, "['h'] -- Watches for EM410x 125/134 kHz tags (option 'h' for 134)"},
+51 -1
View File
@@ -146,7 +146,7 @@ void setGraphBuf(uint8_t *buff,int size)
int i=0;
ClearGraph(0);
for (; i < size; ++i){
GraphBuffer[i]=buff[i];
GraphBuffer[i]=buff[i]-128;
}
GraphTraceLen=size;
RepaintGraphWindow();
@@ -187,3 +187,53 @@ int GetClock(const char *str, int peak, int verbose)
return clock;
}
int GetNRZpskClock(const char *str, int peak, int verbose)
{
// return GetClock(str,peak,verbose);
int clock;
// int clock2;
sscanf(str, "%i", &clock);
if (!strcmp(str, ""))
clock = 0;
/* Auto-detect clock */
if (!clock)
{
uint8_t grph[MAX_GRAPH_TRACE_LEN]={0};
int size = getFromGraphBuf(grph);
clock = DetectpskNRZClock(grph,size,0);
//clock2 = DetectClock2(peak);
/* Only print this message if we're not looping something */
if (!verbose){
PrintAndLog("Auto-detected clock rate: %d", clock);
//PrintAndLog("clock2: %d",clock2);
}
}
return clock;
}
// Get or auto-detect clock rate
/*
int GetNRZpskClock(const char *str, int peak, int verbose)
{
int clock;
// int clock2;
sscanf(str, "%i", &clock);
if (!strcmp(str, ""))
clock = 0;
// Auto-detect clock
if (!clock)
{
uint8_t grph[MAX_GRAPH_TRACE_LEN]={0};
int size = getFromGraphBuf(grph);
clock = DetectASKClock(grph,size,0);
//clock2 = DetectClock2(peak);
// Only print this message if we're not looping something
if (!verbose){
PrintAndLog("Auto-detected clock rate: %d", clock);
//PrintAndLog("clock2: %d",clock2);
}
}
return clock;
}
*/
+1
View File
@@ -17,6 +17,7 @@ int ClearGraph(int redraw);
//int DetectClock(int peak);
int getFromGraphBuf(uint8_t *buff);
int GetClock(const char *str, int peak, int verbose);
int GetNRZpskClock(const char *str, int peak, int verbose);
void setGraphBuf(uint8_t *buff,int size);
#define MAX_GRAPH_TRACE_LEN (1024*128)
+1037 -582
View File
File diff suppressed because it is too large Load Diff
+6 -2
View File
@@ -12,8 +12,8 @@
#include <stdint.h>
int DetectASKClock(uint8_t dest[], size_t size, int clock);
int askmandemod(uint8_t *BinStream,uint32_t *BitLen,int *clk, int *invert);
uint64_t Em410xDecode(uint8_t *BitStream,uint32_t BitLen);
int askmandemod(uint8_t *BinStream,int *BitLen,int *clk, int *invert);
uint64_t Em410xDecode(uint8_t *BitStream,int BitLen);
int manrawdecode(uint8_t *BitStream, int *bitLen);
int BiphaseRawDecode(uint8_t * BitStream, int *bitLen, int offset);
int askrawdemod(uint8_t *BinStream, int *bitLen,int *clk, int *invert);
@@ -21,5 +21,9 @@ int HIDdemodFSK(uint8_t *dest, size_t size, uint32_t *hi2, uint32_t *hi, uint32_
int IOdemodFSK(uint8_t *dest, size_t size);
int fskdemod(uint8_t *dest, size_t size, uint8_t rfLen, uint8_t invert, uint8_t fchigh, uint8_t fclow);
uint32_t bytebits_to_byte(uint8_t* src, int numbits);
int pskNRZrawDemod(uint8_t *dest, int *bitLen, int *clk, int *invert);
int DetectpskNRZClock(uint8_t dest[], size_t size, int clock);
int indala26decode(uint8_t *bitStream, int *bitLen, uint8_t *invert);
void pskCleanWave(uint8_t *bitStream, int bitLen);
#endif
File diff suppressed because it is too large Load Diff
+7
View File
@@ -15,3 +15,10 @@ Transit999-best.pm3: Transit 999 format (UID 99531670)
The files 'modulation-'... are all encoded with identical data (hex 00 01 02 03 04 05 06 07 08 09 0A 0B)
for the purpose of recognition and testing of demodulation schemes. They were created by writing Q5 tags
appropriately configured. The raw data is in 'modulation-data.dat'.
ata5577-HIDemu-FC1-C9.pm3: ata5577 in hid prox 26 bit emulation facility code:1 card#:9
casi-12ed825c29.pm3: casi rusco 40 bit (EM410x ID: 12ed825c29)
EM4102-Fob.pm3: (ID: 0400193cbe)
ioprox-XSF-01-3B-44725.pm3: IO Prox FSK RF/64 ID in name
ioprox-XSF-01-BE-03011.pm3: IO Prox FSK RF/64 ID in name
indala-504278295.pm3: PSK 26 bit indala