X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/872e3d4d6f6dd1ae01ef67e4ad8255243f1e24ec..e09f21fa7b754a2f214efbebc622045138828096:/client/cmdlf.c diff --git a/client/cmdlf.c b/client/cmdlf.c index b2372101..1222b3ce 100644 --- a/client/cmdlf.c +++ b/client/cmdlf.c @@ -28,6 +28,7 @@ #include "cmdlft55xx.h" #include "cmdlfpcf7931.h" #include "cmdlfio.h" +#include "lfdemod.h" static int CmdHelp(const char *Cmd); @@ -765,16 +766,19 @@ int CmdLFaskSim(const char *Cmd) setDemodBuf(data, dataLen, 0); } if (clk == 0) clk = 64; - + if (manchester == 0) clk = clk/2; //askraw needs to double the clock speed uint16_t arg1, arg2; + size_t size=DemodBufferLen; arg1 = clk << 8 | manchester; arg2 = invert << 8 | separator; - UsbCommand c = {CMD_ASK_SIM_TAG, {arg1, arg2, DemodBufferLen}}; - if (DemodBufferLen > USB_CMD_DATA_SIZE) { - PrintAndLog("DemodBuffer too long for current implementation - length: %d - max: %d", DemodBufferLen, USB_CMD_DATA_SIZE); + if (size > USB_CMD_DATA_SIZE) { + PrintAndLog("DemodBuffer too long for current implementation - length: %d - max: %d", size, USB_CMD_DATA_SIZE); + size = USB_CMD_DATA_SIZE; } - PrintAndLog("preparing to sim ask data: %d bits", DemodBufferLen); - memcpy(c.d.asBytes, DemodBuffer, DemodBufferLen); + UsbCommand c = {CMD_ASK_SIM_TAG, {arg1, arg2, size}}; + + PrintAndLog("preparing to sim ask data: %d bits", size); + memcpy(c.d.asBytes, DemodBuffer, size); SendCommand(&c); return 0; } @@ -852,14 +856,25 @@ int CmdLFpskSim(const char *Cmd) return usage_lf_simpsk(); } if (dataLen == 0){ //using DemodBuffer - if (clk==0) clk = GetPskClock(NULL, FALSE, FALSE); - if (!carrier) carrier = GetPskCarrier(NULL, FALSE, FALSE); + PrintAndLog("Getting Clocks"); + if (clk==0) clk = GetPskClock("", FALSE, FALSE); + PrintAndLog("clk: %d",clk); + if (!carrier) carrier = GetPskCarrier("", FALSE, FALSE); + PrintAndLog("carrier: %d", carrier); } else { setDemodBuf(data, dataLen, 0); } + if (clk <= 0) clk = 32; if (carrier == 0) carrier = 2; - + if (pskType != 1){ + if (pskType == 2){ + //need to convert psk2 to psk1 data before sim + psk2TOpsk1(DemodBuffer, DemodBufferLen); + } else { + PrintAndLog("Sorry, PSK3 not yet available"); + } + } uint16_t arg1, arg2; arg1 = clk << 8 | carrier; arg2 = invert; @@ -867,6 +882,7 @@ int CmdLFpskSim(const char *Cmd) if (DemodBufferLen > USB_CMD_DATA_SIZE) { PrintAndLog("DemodBuffer too long for current implementation - length: %d - max: %d", DemodBufferLen, USB_CMD_DATA_SIZE); } + PrintAndLog("DEBUG: Sending DemodBuffer Length: %d", DemodBufferLen); memcpy(c.d.asBytes, DemodBuffer, DemodBufferLen); SendCommand(&c); return 0; @@ -1047,6 +1063,11 @@ int CmdLFfind(const char *Cmd) PrintAndLog("\nValid EM410x ID Found!"); return 1; } + ans=CmdG_Prox_II_Demod(""); + if (ans>0) { + PrintAndLog("\nValid G Prox II ID Found!"); + return 1; + } PrintAndLog("\nNo Known Tags Found!\n"); if (testRaw=='u' || testRaw=='U'){ //test unknown tag formats (raw mode)