]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdlffdx.c
correct 1st key calculation
[proxmark3-svn] / client / cmdlffdx.c
index 69c3c4830b49c5979b72a94541d2ca122bb8f324..2e2ee9fd3b373c30b7d811fcfb20adb6454866b6 100644 (file)
@@ -5,11 +5,14 @@
 // the license.
 //-----------------------------------------------------------------------------
 // Low frequency fdx-b tag commands
+// Differential Biphase, rf/32, 128 bits (known)
 //-----------------------------------------------------------------------------
 
 #include "cmdlffdx.h"
 
+#include <stdio.h>
 #include <inttypes.h>
+#include <string.h>
 #include "proxmark3.h"
 #include "ui.h"         // for PrintAndLog
 #include "util.h"
@@ -44,7 +47,7 @@ static int CmdHelp(const char *Cmd);
 
 int usage_lf_fdx_clone(void){
        PrintAndLog("Clone a FDX-B animal tag to a T55x7 tag.");
-       PrintAndLog("Usage: lf animal clone [h] <country id> <animal id> <Q5>");
+       PrintAndLog("Usage: lf fdx clone [h] <country id> <animal id> <Q5>");
        PrintAndLog("Options:");
        PrintAndLog("      h            : This help");
        PrintAndLog("      <country id> : Country id");
@@ -55,7 +58,7 @@ int usage_lf_fdx_clone(void){
        // extended data
        PrintAndLog("      <Q5>        : Specify write to Q5 (t5555 instead of t55x7)");
        PrintAndLog("");
-       PrintAndLog("Sample: lf animal clone 999 112233");
+       PrintAndLog("Sample: lf fdx clone 999 112233");
        return 0;
 }
 
@@ -63,13 +66,13 @@ int usage_lf_fdx_sim(void) {
        PrintAndLog("Enables simulation of FDX-B animal tag");
        PrintAndLog("Simulation runs until the button is pressed or another USB command is issued.");
        PrintAndLog("");
-       PrintAndLog("Usage:  lf animal sim [h] <country id> <animal id>");
+       PrintAndLog("Usage:  lf fdx sim [h] <country id> <animal id>");
        PrintAndLog("Options:");
        PrintAndLog("      h            : This help");
        PrintAndLog("      <country id> : Country ID");
        PrintAndLog("      <animal id>  : Animal ID");
        PrintAndLog("");
-       PrintAndLog("Sample: lf animal sim 999 112233");
+       PrintAndLog("Sample: lf fdx sim 999 112233");
        return 0;
 }
 // clearing the topbit needed for the preambl detection. 
@@ -134,7 +137,7 @@ int CmdFdxDemod(const char *Cmd){
 
        //Differential Biphase / di-phase (inverted biphase)
        //get binary from ask wave
-       if (!ASKbiphaseDemod("0 32 1 0", FALSE)) {
+       if (!ASKbiphaseDemod("0 32 1 0", false)) {
                if (g_debugMode) PrintAndLog("DEBUG: Error - FDX-B ASKbiphaseDemod failed");
                return 0;
        }
@@ -156,6 +159,8 @@ int CmdFdxDemod(const char *Cmd){
 
        // set and leave DemodBuffer intact
        setDemodBuf(DemodBuffer, 128, preambleIndex);
+       setClockGrid(g_DemodClock, g_DemodStartIdx + (preambleIndex*g_DemodClock));
+
        uint8_t bits_no_spacer[117];
        memcpy(bits_no_spacer, DemodBuffer + 11, 117);
 
@@ -201,8 +206,7 @@ int CmdFdxDemod(const char *Cmd){
 }
 
 int CmdFdxRead(const char *Cmd) {
-       CmdLFRead("s");
-       getSamples("10000", TRUE);
+       lf_read(true, 10000);
        return CmdFdxDemod(Cmd);
 }
 
Impressum, Datenschutz