mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 18:48:13 -07:00
Viva la revolucion
This commit is contained in:
parent
8bfc5c1b47
commit
be15ad7fec
53 changed files with 861 additions and 870 deletions
|
@ -644,7 +644,7 @@ static int CmdLegicRfWrite(const char *Cmd) {
|
|||
|
||||
UsbCommand c = {CMD_WRITER_LEGIC_RF, {offset, len, IV}, {{0}}};
|
||||
memcpy(c.d.asBytes, data, len);
|
||||
UsbCommand resp;
|
||||
UsbReplyNG resp;
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
||||
|
@ -661,7 +661,7 @@ static int CmdLegicRfWrite(const char *Cmd) {
|
|||
}
|
||||
PrintAndLogEx(NORMAL, "\n");
|
||||
|
||||
uint8_t isOK = resp.arg[0] & 0xFF;
|
||||
uint8_t isOK = resp.core.old.arg[0] & 0xFF;
|
||||
if (!isOK) {
|
||||
PrintAndLogEx(WARNING, "Failed writing tag");
|
||||
return 1;
|
||||
|
@ -759,7 +759,7 @@ int legic_read_mem(uint32_t offset, uint32_t len, uint32_t iv, uint8_t *out, uin
|
|||
UsbCommand c = {CMD_READER_LEGIC_RF, {offset, len, iv}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
UsbReplyNG resp;
|
||||
|
||||
uint8_t timeout = 0;
|
||||
while (!WaitForResponseTimeout(CMD_ACK, &resp, 2000)) {
|
||||
|
@ -773,8 +773,8 @@ int legic_read_mem(uint32_t offset, uint32_t len, uint32_t iv, uint8_t *out, uin
|
|||
}
|
||||
PrintAndLogEx(NORMAL, "\n");
|
||||
|
||||
uint8_t isOK = resp.arg[0] & 0xFF;
|
||||
*outlen = resp.arg[1];
|
||||
uint8_t isOK = resp.core.old.arg[0] & 0xFF;
|
||||
*outlen = resp.core.old.arg[1];
|
||||
if (!isOK) {
|
||||
PrintAndLogEx(WARNING, "Failed reading tag");
|
||||
return 2;
|
||||
|
@ -813,15 +813,15 @@ int legic_get_type(legic_card_select_t *card) {
|
|||
UsbCommand c = {CMD_LEGIC_INFO, {0, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
UsbReplyNG resp;
|
||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500))
|
||||
return 2;
|
||||
|
||||
uint8_t isOK = resp.arg[0] & 0xFF;
|
||||
uint8_t isOK = resp.core.old.arg[0] & 0xFF;
|
||||
if (!isOK)
|
||||
return 3;
|
||||
|
||||
memcpy(card, (legic_card_select_t *)resp.d.asBytes, sizeof(legic_card_select_t));
|
||||
memcpy(card, (legic_card_select_t *)resp.core.old.d.asBytes, sizeof(legic_card_select_t));
|
||||
return 0;
|
||||
}
|
||||
void legic_chk_iv(uint32_t *iv) {
|
||||
|
@ -903,7 +903,7 @@ static int CmdLegicDump(const char *Cmd) {
|
|||
UsbCommand c = {CMD_READER_LEGIC_RF, {0x00, dumplen, 0x55}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
UsbReplyNG resp;
|
||||
|
||||
uint8_t timeout = 0;
|
||||
while (!WaitForResponseTimeout(CMD_ACK, &resp, 2000)) {
|
||||
|
@ -917,13 +917,13 @@ static int CmdLegicDump(const char *Cmd) {
|
|||
}
|
||||
PrintAndLogEx(NORMAL, "\n");
|
||||
|
||||
uint8_t isOK = resp.arg[0] & 0xFF;
|
||||
uint8_t isOK = resp.core.old.arg[0] & 0xFF;
|
||||
if (!isOK) {
|
||||
PrintAndLogEx(WARNING, "Failed dumping tag data");
|
||||
return 2;
|
||||
}
|
||||
|
||||
uint16_t readlen = resp.arg[1];
|
||||
uint16_t readlen = resp.core.old.arg[1];
|
||||
uint8_t *data = calloc(readlen, sizeof(uint8_t));
|
||||
if (!data) {
|
||||
PrintAndLogEx(WARNING, "Fail, cannot allocate memory");
|
||||
|
@ -1050,7 +1050,7 @@ static int CmdLegicRestore(const char *Cmd) {
|
|||
|
||||
// transfer to device
|
||||
UsbCommand c = {CMD_WRITER_LEGIC_RF, {0, 0, 0x55}, {{0}}};
|
||||
UsbCommand resp;
|
||||
UsbReplyNG resp;
|
||||
for (size_t i = 7; i < numofbytes; i += USB_CMD_DATA_SIZE) {
|
||||
|
||||
size_t len = MIN((numofbytes - i), USB_CMD_DATA_SIZE);
|
||||
|
@ -1073,9 +1073,9 @@ static int CmdLegicRestore(const char *Cmd) {
|
|||
}
|
||||
PrintAndLogEx(NORMAL, "\n");
|
||||
|
||||
uint8_t isOK = resp.arg[0] & 0xFF;
|
||||
uint8_t isOK = resp.core.old.arg[0] & 0xFF;
|
||||
if (!isOK) {
|
||||
PrintAndLogEx(WARNING, "Failed writing tag [msg = %u]", resp.arg[1] & 0xFF);
|
||||
PrintAndLogEx(WARNING, "Failed writing tag [msg = %u]", resp.core.old.arg[1] & 0xFF);
|
||||
free(data);
|
||||
return 1;
|
||||
}
|
||||
|
@ -1243,7 +1243,7 @@ static int CmdLegicWipe(const char *Cmd) {
|
|||
|
||||
// transfer to device
|
||||
UsbCommand c = {CMD_WRITER_LEGIC_RF, {0, 0, 0x55}, {{0}}};
|
||||
UsbCommand resp;
|
||||
UsbReplyNG resp;
|
||||
for (size_t i = 7; i < card.cardsize; i += USB_CMD_DATA_SIZE) {
|
||||
|
||||
printf(".");
|
||||
|
@ -1268,9 +1268,9 @@ static int CmdLegicWipe(const char *Cmd) {
|
|||
}
|
||||
PrintAndLogEx(NORMAL, "\n");
|
||||
|
||||
uint8_t isOK = resp.arg[0] & 0xFF;
|
||||
uint8_t isOK = resp.core.old.arg[0] & 0xFF;
|
||||
if (!isOK) {
|
||||
PrintAndLogEx(WARNING, "Failed writing tag [msg = %u]", resp.arg[1] & 0xFF);
|
||||
PrintAndLogEx(WARNING, "Failed writing tag [msg = %u]", resp.core.old.arg[1] & 0xFF);
|
||||
free(data);
|
||||
return 4;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue