]> cvs.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdlfguard.c
chg: moved to header file
[proxmark3-svn] / client / cmdlfguard.c
index 05975eea66bc431fc013296a0b323651de699ac1..d9010a19a2209e99045f4dab5ba84a3092500e04 100644 (file)
@@ -6,8 +6,7 @@
 //-----------------------------------------------------------------------------
 // Low frequency Farpoint / Pyramid tag commands
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 // Low frequency Farpoint / Pyramid tag commands
 //-----------------------------------------------------------------------------
-#include <string.h>
-#include <inttypes.h>
+
 #include "cmdlfguard.h"
 static int CmdHelp(const char *Cmd);
 
 #include "cmdlfguard.h"
 static int CmdHelp(const char *Cmd);
 
@@ -40,7 +39,6 @@ int usage_lf_guard_sim(void) {
        return 0;
 }
 
        return 0;
 }
 
-
 // Works for 26bits.
 int GetGuardBits(uint32_t fc, uint32_t cn, uint8_t *guardBits) {
   
 // Works for 26bits.
 int GetGuardBits(uint32_t fc, uint32_t cn, uint8_t *guardBits) {
   
@@ -48,10 +46,8 @@ int GetGuardBits(uint32_t fc, uint32_t cn, uint8_t *guardBits) {
        time_t t;
        srand((unsigned) time(&t));
        //uint8_t xorKey = rand() % 0xFF;
        time_t t;
        srand((unsigned) time(&t));
        //uint8_t xorKey = rand() % 0xFF;
-       uint8_t xorKey = 0x6b;
+       uint8_t xorKey = 0x66;
        uint8_t i;
        uint8_t i;
-       
-       
        uint8_t pre[96];
        memset(pre, 0x00, sizeof(pre));
 
        uint8_t pre[96];
        memset(pre, 0x00, sizeof(pre));
 
@@ -122,7 +118,7 @@ int GetGuardBits(uint32_t fc, uint32_t cn, uint8_t *guardBits) {
 
 int CmdGuardRead(const char *Cmd) {
        CmdLFRead("s");
 
 int CmdGuardRead(const char *Cmd) {
        CmdLFRead("s");
-       getSamples("30000",false);
+       getSamples("12000", TRUE);
        return CmdG_Prox_II_Demod("");
 }
 
        return CmdG_Prox_II_Demod("");
 }
 
@@ -140,6 +136,7 @@ int CmdGuardClone(const char *Cmd) {
        uint32_t blocks[5] = {T55x7_MODULATION_BIPHASE | T55x7_BITRATE_RF_64 | 3<<T55x7_MAXBLOCK_SHIFT, 0, 0, 0, 0};
        
 //     if (param_getchar(Cmd, 3) == 'Q' || param_getchar(Cmd, 3) == 'q')
        uint32_t blocks[5] = {T55x7_MODULATION_BIPHASE | T55x7_BITRATE_RF_64 | 3<<T55x7_MAXBLOCK_SHIFT, 0, 0, 0, 0};
        
 //     if (param_getchar(Cmd, 3) == 'Q' || param_getchar(Cmd, 3) == 'q')
+       //t5555 (Q5) BITRATE = (RF-2)/2 (iceman)
 //             blocks[0] = T5555_MODULATION_FSK2 | 50<<T5555_BITRATE_SHIFT | 4<<T5555_MAXBLOCK_SHIFT;
 
        if (sscanf(Cmd, "%u %u", &fc, &cn ) != 2) return usage_lf_guard_clone();
 //             blocks[0] = T5555_MODULATION_FSK2 | 50<<T5555_BITRATE_SHIFT | 4<<T5555_MAXBLOCK_SHIFT;
 
        if (sscanf(Cmd, "%u %u", &fc, &cn ) != 2) return usage_lf_guard_clone();
@@ -160,7 +157,7 @@ int CmdGuardClone(const char *Cmd) {
        PrintAndLog("Blk | Data ");
        PrintAndLog("----+------------");
        for ( i = 0; i<4; ++i )
        PrintAndLog("Blk | Data ");
        PrintAndLog("----+------------");
        for ( i = 0; i<4; ++i )
-               PrintAndLog(" %02d | %08x", i, blocks[i]);
+               PrintAndLog(" %02d | 0x%08x", i, blocks[i]);
 
        UsbCommand resp;
        UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0,0,0}};
 
        UsbCommand resp;
        UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0,0,0}};
@@ -170,7 +167,7 @@ int CmdGuardClone(const char *Cmd) {
                c.arg[1] = i;
                clearCommandBuffer();
                SendCommand(&c);
                c.arg[1] = i;
                clearCommandBuffer();
                SendCommand(&c);
-               if (!WaitForResponseTimeout(CMD_ACK, &resp, 1000)){
+               if (!WaitForResponseTimeout(CMD_ACK, &resp, T55XX_WRITE_TIMEOUT)){
                        PrintAndLog("Error occurred, device did not respond during write operation.");
                        return -1;
                }
                        PrintAndLog("Error occurred, device did not respond during write operation.");
                        return -1;
                }
Impressum, Datenschutz