chg: 'lf pyramid clone' - add verification

This commit is contained in:
iceman1001 2019-09-15 01:33:54 +02:00
commit 06809babbb
3 changed files with 31 additions and 20 deletions

View file

@ -9,21 +9,6 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#include "cmdlfpyramid.h" #include "cmdlfpyramid.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "cmdparser.h" // command_t
#include "comms.h"
#include "ui.h"
#include "graph.h"
#include "cmddata.h"
#include "cmdlf.h"
#include "protocols.h" // for T55xx config register definitions
#include "lfdemod.h" // parityTest
#include "crc.h"
static int CmdHelp(const char *Cmd); static int CmdHelp(const char *Cmd);
static int usage_lf_pyramid_clone(void) { static int usage_lf_pyramid_clone(void) {
@ -246,12 +231,13 @@ static int CmdPyramidClone(const char *Cmd) {
PrintAndLogEx(INFO, "Preparing to clone Farpointe/Pyramid to T55x7 with Facility Code: %u, Card Number: %u", facilitycode, cardnumber); PrintAndLogEx(INFO, "Preparing to clone Farpointe/Pyramid to T55x7 with Facility Code: %u, Card Number: %u", facilitycode, cardnumber);
print_blocks(blocks, 5); print_blocks(blocks, 5);
uint8_t res = 0;
PacketResponseNG resp; PacketResponseNG resp;
// fast push mode // fast push mode
conn.block_after_ACK = true; conn.block_after_ACK = true;
for (uint8_t i = 0; i < 5; i++) { for (int8_t i = 4; i >= 0; i--) {
if (i == 4) { if (i == 0) {
// Disable fast mode on last packet // Disable fast mode on last packet
conn.block_after_ACK = false; conn.block_after_ACK = false;
} }
@ -267,7 +253,17 @@ static int CmdPyramidClone(const char *Cmd) {
PrintAndLogEx(ERR, "Error occurred, device did not respond during write operation."); PrintAndLogEx(ERR, "Error occurred, device did not respond during write operation.");
return PM3_ETIMEOUT; return PM3_ETIMEOUT;
} }
bool isok = t55xxVerifyWrite(i, 0, false, false, 0, 0, blocks[i]);
if ( isok == false) {
PrintAndLogEx(WARNING, "Couldn't verify write");
res++;
} }
}
if ( res == 0 )
PrintAndLogEx(SUCCESS, "Success writing to tag");
return PM3_SUCCESS; return PM3_SUCCESS;
} }

View file

@ -10,6 +10,21 @@
#define CMDLFPYRAMID_H__ #define CMDLFPYRAMID_H__
#include "common.h" #include "common.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "cmdparser.h" // command_t
#include "comms.h"
#include "ui.h"
#include "graph.h"
#include "cmddata.h"
#include "cmdlf.h"
#include "protocols.h" // for T55xx config register definitions
#include "lfdemod.h" // parityTest
#include "crc.h"
#include "cmdlft55xx.h" // verifywrite
int CmdLFPyramid(const char *Cmd); int CmdLFPyramid(const char *Cmd);

View file

@ -111,12 +111,12 @@ static int CmdSecurakeyRead(const char *Cmd) {
return CmdSecurakeyDemod(Cmd); return CmdSecurakeyDemod(Cmd);
} }
static int CmdSecuraClone(const char *Cmd) { static int CmdSecurakeyClone(const char *Cmd) {
PrintAndLogEx(INFO, " To be implemented, feel free to contribute!"); PrintAndLogEx(INFO, " To be implemented, feel free to contribute!");
return PM3_SUCCESS; return PM3_SUCCESS;
} }
static int CmdSecureSim(const char *Cmd) { static int CmdSecurakeySim(const char *Cmd) {
PrintAndLogEx(INFO, " To be implemented, feel free to contribute!"); PrintAndLogEx(INFO, " To be implemented, feel free to contribute!");
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -126,7 +126,7 @@ static command_t CommandTable[] = {
{"demod", CmdSecurakeyDemod, AlwaysAvailable, "Demodulate an Securakey tag from the GraphBuffer"}, {"demod", CmdSecurakeyDemod, AlwaysAvailable, "Demodulate an Securakey tag from the GraphBuffer"},
{"read", CmdSecurakeyRead, IfPm3Lf, "Attempt to read and extract tag data from the antenna"}, {"read", CmdSecurakeyRead, IfPm3Lf, "Attempt to read and extract tag data from the antenna"},
{"clone", CmdSecurakeyClone, IfPm3Lf, "clone Securakey tag"}, {"clone", CmdSecurakeyClone, IfPm3Lf, "clone Securakey tag"},
{"sim", CmdSecurakeydSim, IfPm3Lf, "simulate Securakey tag"}, {"sim", CmdSecurakeySim, IfPm3Lf, "simulate Securakey tag"},
{NULL, NULL, NULL, NULL} {NULL, NULL, NULL, NULL}
}; };