This commit is contained in:
iceman1001 2020-01-07 22:05:56 +01:00
commit 2bfbcb20ac
3 changed files with 22 additions and 19 deletions

View file

@ -780,7 +780,7 @@ static void PacketReceived(PacketCommandNG *packet) {
}
case CMD_LF_NRZ_SIMULATE: {
lf_nrzsim_t *payload = (lf_nrzsim_t *)packet->data.asBytes;
CmdNRZsimTAG(payload->invert, payload->separator, payload->clock, packet->length - sizeof(lf_asksim_t), payload->data, true);
CmdNRZsimTAG(payload->invert, payload->separator, payload->clock, packet->length - sizeof(lf_nrzsim_t), payload->data, true);
break;
}
case CMD_LF_HID_CLONE: {

View file

@ -47,9 +47,9 @@ static int usage_lf_io_sim(void) {
PrintAndLogEx(NORMAL, "Usage: lf io sim [h] <version> <facility-code> <card-number>");
PrintAndLogEx(NORMAL, "Options:");
PrintAndLogEx(NORMAL, " h : This help");
PrintAndLogEx(NORMAL, " <version> : 8bit version");
PrintAndLogEx(NORMAL, " <facility-code> : 8bit value facility code");
PrintAndLogEx(NORMAL, " <card number> : 16bit value card number");
PrintAndLogEx(NORMAL, " <version> : 8bit version (decimal)");
PrintAndLogEx(NORMAL, " <facility-code> : 8bit value facility code (hex)");
PrintAndLogEx(NORMAL, " <card number> : 16bit value card number (decimal)");
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf io sim 26 101 1337");
@ -63,9 +63,9 @@ static int usage_lf_io_clone(void) {
PrintAndLogEx(NORMAL, "Usage: lf io clone [h] <version> <facility-code> <card-number> [Q5]");
PrintAndLogEx(NORMAL, "Options:");
PrintAndLogEx(NORMAL, " h : This help");
PrintAndLogEx(NORMAL, " <version> : 8bit version");
PrintAndLogEx(NORMAL, " <facility-code> : 8bit value facility code");
PrintAndLogEx(NORMAL, " <card number> : 16bit value card number");
PrintAndLogEx(NORMAL, " <version> : 8bit version (decimal)");
PrintAndLogEx(NORMAL, " <facility-code> : 8bit value facility code (hex)");
PrintAndLogEx(NORMAL, " <card number> : 16bit value card number (decimal)");
PrintAndLogEx(NORMAL, " Q5 : optional - clone to Q5 (T5555) instead of T55x7 chip");
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:");
@ -197,7 +197,7 @@ static int CmdIOProxSim(const char *Cmd) {
if (strlen(Cmd) == 0 || cmdp == 'h') return usage_lf_io_sim();
version = param_get8(Cmd, 0);
fc = param_get8(Cmd, 1);
fc = param_get8ex(Cmd, 1, 0, 16);
cn = param_get32ex(Cmd, 2, 0, 10);
if (!version || !fc || !cn) return usage_lf_io_sim();
@ -249,7 +249,7 @@ static int CmdIOProxClone(const char *Cmd) {
if (strlen(Cmd) == 0 || cmdp == 'h') return usage_lf_io_clone();
version = param_get8(Cmd, 0);
fc = param_get8(Cmd, 1);
fc = param_get8ex(Cmd, 1, 0, 16);
cn = param_get32ex(Cmd, 2, 0, 10);
if (!version || !fc || !cn) return usage_lf_io_clone();

View file

@ -51,7 +51,7 @@ static int usage_lf_pac_sim(void) {
PrintAndLogEx(NORMAL, " <Card ID> : 8 byte PAC/Stanley card id");
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf pac sim 1A337");
PrintAndLogEx(NORMAL, " lf pac sim 12345678");
return PM3_SUCCESS;
}
// by danshuk
@ -245,20 +245,23 @@ static int CmdPacClone(const char *Cmd) {
static int CmdPacSim(const char *Cmd) {
// NRZ sim.
uint32_t id = 0;
uint64_t rawID = 0;
char cardid[9] = { 0 };
uint8_t rawBytes[16] = { 0 };
uint32_t rawBlocks[4];
char cmdp = tolower(param_getchar(Cmd, 0));
if (strlen(Cmd) == 0 || cmdp == 'h') return usage_lf_pac_sim();
id = param_get32ex(Cmd, 0, 0, 16);
if (id == 0) return usage_lf_pac_sim();
//rawID = pacCardIdToRaw(id);
PrintAndLogEx(SUCCESS, "Simulating PAC/Stanley - ID " _YELLOW_("%08X")" raw "_YELLOW_("%08X%08X"), id, (uint32_t)(rawID >> 32), (uint32_t)(rawID & 0xFFFFFFFF));
int res = param_getstr(Cmd, 0, cardid, sizeof(cardid));
if (res < 8) return usage_lf_pac_sim();
uint8_t bs[128];
num_to_bytebits(rawID, sizeof(bs), bs);
pacCardIdToRaw(rawBytes, cardid);
for (size_t i = 0; i < ARRAYLEN(rawBlocks); i++) {
rawBlocks[i] = bytes_to_num(rawBytes + (i * sizeof(uint32_t)), sizeof(uint32_t));
num_to_bytebits(rawBlocks[i], sizeof(uint32_t) * 8, bs + (i * sizeof(uint32_t) * 8));
}
PrintAndLogEx(SUCCESS, "Simulating PAC/Stanley - ID " _YELLOW_("%s")" raw "_YELLOW_("%08X%08X%08X%08X"), cardid, rawBlocks[0], rawBlocks[1], rawBlocks[2], rawBlocks[3]);
lf_nrzsim_t *payload = calloc(1, sizeof(lf_nrzsim_t) + sizeof(bs));
payload->invert = 0;