mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-07-30 11:39:14 -07:00
structs: initializes explicitely all fields, so we can detect when we really forgot one [-Wmissing-field-initializers]
This commit is contained in:
parent
af3397bd19
commit
0ab6de64d4
43 changed files with 211 additions and 211 deletions
|
@ -515,7 +515,7 @@ int CmdAnalyseA(const char *Cmd) {
|
|||
if (errors || cmdp == 0) return usage_analyse_a();
|
||||
|
||||
|
||||
UsbCommand c = {CMD_FPC_SEND, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_FPC_SEND, {0, 0, 0}, {{0}}};
|
||||
memcpy(c.d.asBytes, data, USB_CMD_DATA_SIZE);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
|
|
@ -869,7 +869,7 @@ int CmdBuffClear(const char *Cmd) {
|
|||
char cmdp = tolower(param_getchar(Cmd, 0));
|
||||
if (cmdp == 'h') return usage_data_buffclear();
|
||||
|
||||
UsbCommand c = {CMD_BUFF_CLEAR, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_BUFF_CLEAR, {0, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
ClearGraph(true);
|
||||
|
@ -1521,7 +1521,7 @@ int CmdTuneSamples(const char *Cmd) {
|
|||
int timeout = 0;
|
||||
PrintAndLogEx(INFO, "\nmeasuring antenna characteristics, please wait...");
|
||||
|
||||
UsbCommand c = {CMD_MEASURE_ANTENNA_TUNING, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_MEASURE_ANTENNA_TUNING, {0, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
|
|
@ -140,7 +140,7 @@ int CmdFlashMemRead(const char *Cmd) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
UsbCommand c = {CMD_FLASHMEM_READ, {start_index, len, 0}};
|
||||
UsbCommand c = {CMD_FLASHMEM_READ, {start_index, len, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
|
@ -153,7 +153,7 @@ int CmdFlashmemSpiBaudrate(const char *Cmd) {
|
|||
uint32_t baudrate = param_get32ex(Cmd, 0, 0, 10);
|
||||
baudrate = baudrate * 1000000;
|
||||
if (baudrate != FLASH_BAUD && baudrate != FLASH_MINBAUD) return usage_flashmem_spibaud();
|
||||
UsbCommand c = {CMD_FLASHMEM_SET_SPIBAUDRATE, {baudrate, 0, 0}};
|
||||
UsbCommand c = {CMD_FLASHMEM_SET_SPIBAUDRATE, {baudrate, 0, 0}, {{0}}};
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ int CmdFlashMemLoad(const char *Cmd) {
|
|||
while (bytes_remaining > 0) {
|
||||
uint32_t bytes_in_packet = MIN(FLASH_MEM_BLOCK_SIZE, bytes_remaining);
|
||||
|
||||
UsbCommand c = {CMD_FLASHMEM_WRITE, {start_index + bytes_sent, bytes_in_packet, 0}};
|
||||
UsbCommand c = {CMD_FLASHMEM_WRITE, {start_index + bytes_sent, bytes_in_packet, 0}, {{0}}};
|
||||
|
||||
memcpy(c.d.asBytes, data + bytes_sent, bytes_in_packet);
|
||||
clearCommandBuffer();
|
||||
|
@ -390,7 +390,7 @@ int CmdFlashMemWipe(const char *Cmd) {
|
|||
//Validations
|
||||
if (errors || cmdp == 0) return usage_flashmem_wipe();
|
||||
|
||||
UsbCommand c = {CMD_FLASHMEM_WIPE, {page, initalwipe, 0}};
|
||||
UsbCommand c = {CMD_FLASHMEM_WIPE, {page, initalwipe, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
@ -436,7 +436,7 @@ int CmdFlashMemInfo(const char *Cmd) {
|
|||
//Validations
|
||||
if (errors) return usage_flashmem_info();
|
||||
|
||||
UsbCommand c = {CMD_FLASHMEM_INFO, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_FLASHMEM_INFO, {0, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
@ -565,7 +565,7 @@ int CmdFlashMemInfo(const char *Cmd) {
|
|||
|
||||
if (shall_write) {
|
||||
// save to mem
|
||||
c = (UsbCommand) {CMD_FLASHMEM_WRITE, {FLASH_MEM_SIGNATURE_OFFSET, FLASH_MEM_SIGNATURE_LEN, 0}};
|
||||
c = (UsbCommand) {CMD_FLASHMEM_WRITE, {FLASH_MEM_SIGNATURE_OFFSET, FLASH_MEM_SIGNATURE_LEN, 0}, {{0}}};
|
||||
memcpy(c.d.asBytes, sign, sizeof(sign));
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
|
|
@ -103,7 +103,7 @@ int CmdHFSniff(const char *Cmd) {
|
|||
int skippairs = param_get32ex(Cmd, 0, 0, 10);
|
||||
int skiptriggers = param_get32ex(Cmd, 1, 0, 10);
|
||||
|
||||
UsbCommand c = {CMD_HF_SNIFFER, {skippairs, skiptriggers, 0}};
|
||||
UsbCommand c = {CMD_HF_SNIFFER, {skippairs, skiptriggers, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
|
|
|
@ -228,7 +228,7 @@ int CmdHF14AList(const char *Cmd) {
|
|||
}
|
||||
|
||||
int Hf14443_4aGetCardData(iso14a_card_select_t *card) {
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT, 0, 0}};
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT, 0, 0}, {{0}}};
|
||||
SendCommand(&c);
|
||||
|
||||
UsbCommand resp;
|
||||
|
@ -298,7 +298,7 @@ int CmdHF14AReader(const char *Cmd) {
|
|||
if (!disconnectAfter)
|
||||
cm |= ISO14A_NO_DISCONNECT;
|
||||
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {cm, 0, 0}};
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {cm, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
||||
|
@ -361,7 +361,7 @@ int CmdHF14AInfo(const char *Cmd) {
|
|||
bool silent = (Cmd[0] == 's' || Cmd[0] == 'S');
|
||||
bool do_nack_test = (Cmd[0] == 'n' || Cmd[0] == 'N');
|
||||
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0}};
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
@ -679,7 +679,7 @@ int CmdHF14ACUIDs(const char *Cmd) {
|
|||
}
|
||||
|
||||
// execute anticollision procedure
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_RATS, 0, 0}};
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_RATS, 0, 0}, {{0}}};
|
||||
SendCommand(&c);
|
||||
|
||||
UsbCommand resp;
|
||||
|
@ -778,7 +778,7 @@ int CmdHF14ASim(const char *Cmd) {
|
|||
if (useUIDfromEML)
|
||||
flags |= FLAG_UID_IN_EMUL;
|
||||
|
||||
UsbCommand c = {CMD_SIMULATE_TAG_ISO_14443a, { tagtype, flags, 0 }};
|
||||
UsbCommand c = {CMD_SIMULATE_TAG_ISO_14443a, { tagtype, flags, 0 }, {{0}}};
|
||||
memcpy(c.d.asBytes, uid, uidlen >> 1);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -807,7 +807,7 @@ int CmdHF14ASniff(const char *Cmd) {
|
|||
if (ctmp == 'c') param |= 0x01;
|
||||
if (ctmp == 'r') param |= 0x02;
|
||||
}
|
||||
UsbCommand c = {CMD_SNIFF_ISO_14443a, {param, 0, 0}};
|
||||
UsbCommand c = {CMD_SNIFF_ISO_14443a, {param, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
|
@ -823,7 +823,7 @@ int ExchangeRAW14a(uint8_t *datain, int datainlen, bool activateField, bool leav
|
|||
UsbCommand resp;
|
||||
|
||||
// Anticollision + SELECT card
|
||||
UsbCommand ca = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0}};
|
||||
UsbCommand ca = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0}, {{0}}};
|
||||
SendCommand(&ca);
|
||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {
|
||||
PrintAndLogEx(ERR, "Proxmark connection timeout.");
|
||||
|
@ -843,7 +843,7 @@ int ExchangeRAW14a(uint8_t *datain, int datainlen, bool activateField, bool leav
|
|||
|
||||
if (resp.arg[0] == 2) { // 0: couldn't read, 1: OK, with ATS, 2: OK, no ATS, 3: proprietary Anticollision
|
||||
// get ATS
|
||||
UsbCommand cr = {CMD_READER_ISO_14443a, {ISO14A_RAW | ISO14A_APPEND_CRC | ISO14A_NO_DISCONNECT, 2, 0}};
|
||||
UsbCommand cr = {CMD_READER_ISO_14443a, {ISO14A_RAW | ISO14A_APPEND_CRC | ISO14A_NO_DISCONNECT, 2, 0}, {{0}}};
|
||||
uint8_t rats[] = { 0xE0, 0x80 }; // FSDI=8 (FSD=256), CID=0
|
||||
memcpy(cr.d.asBytes, rats, 2);
|
||||
SendCommand(&cr);
|
||||
|
@ -862,7 +862,7 @@ int ExchangeRAW14a(uint8_t *datain, int datainlen, bool activateField, bool leav
|
|||
if (leaveSignalON)
|
||||
cmdc |= ISO14A_NO_DISCONNECT;
|
||||
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_RAW | ISO14A_APPEND_CRC | cmdc, (datainlen & 0xFFFF) + 2, 0}};
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_RAW | ISO14A_APPEND_CRC | cmdc, (datainlen & 0xFFFF) + 2, 0}, {{0}}};
|
||||
uint8_t header[] = { 0x0a | responseNum, 0x00};
|
||||
responseNum ^= 1;
|
||||
memcpy(c.d.asBytes, header, 2);
|
||||
|
@ -922,7 +922,7 @@ int SelectCard14443_4(bool disconnect, iso14a_card_select_t *card) {
|
|||
DropField();
|
||||
|
||||
// Anticollision + SELECT card
|
||||
UsbCommand ca = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0}};
|
||||
UsbCommand ca = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0}, {{0}}};
|
||||
SendCommand(&ca);
|
||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {
|
||||
PrintAndLogEx(ERR, "Proxmark connection timeout.");
|
||||
|
@ -942,7 +942,7 @@ int SelectCard14443_4(bool disconnect, iso14a_card_select_t *card) {
|
|||
|
||||
if (resp.arg[0] == 2) { // 0: couldn't read, 1: OK, with ATS, 2: OK, no ATS, 3: proprietary Anticollision
|
||||
// get ATS
|
||||
UsbCommand cr = {CMD_READER_ISO_14443a, {ISO14A_RAW | ISO14A_APPEND_CRC | ISO14A_NO_DISCONNECT, 2, 0}};
|
||||
UsbCommand cr = {CMD_READER_ISO_14443a, {ISO14A_RAW | ISO14A_APPEND_CRC | ISO14A_NO_DISCONNECT, 2, 0}, {{0}}};
|
||||
uint8_t rats[] = { 0xE0, 0x80 }; // FSDI=8 (FSD=256), CID=0
|
||||
memcpy(cr.d.asBytes, rats, 2);
|
||||
SendCommand(&cr);
|
||||
|
@ -999,7 +999,7 @@ int CmdExchangeAPDU(bool chainingin, uint8_t *datain, int datainlen, bool activa
|
|||
// https://stackoverflow.com/questions/32994936/safe-max-java-card-apdu-data-command-and-respond-size
|
||||
// here length USB_CMD_DATA_SIZE=512
|
||||
// timeout must be authomatically set by "get ATS"
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_APDU | ISO14A_NO_DISCONNECT | cmdc, (datainlen & 0xFFFF), 0}};
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_APDU | ISO14A_NO_DISCONNECT | cmdc, (datainlen & 0xFFFF), 0}, {{0}}};
|
||||
|
||||
if (datain)
|
||||
memcpy(c.d.asBytes, datain, datainlen);
|
||||
|
@ -1186,7 +1186,7 @@ int CmdHF14AAPDU(const char *Cmd) {
|
|||
}
|
||||
|
||||
int CmdHF14ACmdRaw(const char *Cmd) {
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {0, 0, 0}, {{0}}};
|
||||
bool reply = 1;
|
||||
bool crc = false;
|
||||
bool power = false;
|
||||
|
@ -1392,7 +1392,7 @@ int CmdHF14AAntiFuzz(const char *Cmd) {
|
|||
arg0 = FLAG_10B_UID_IN_DATA;
|
||||
|
||||
CLIParserFree();
|
||||
UsbCommand c = {CMD_ANTIFUZZ_ISO_14443a, {arg0, 0, 0}};
|
||||
UsbCommand c = {CMD_ANTIFUZZ_ISO_14443a, {arg0, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
|
|
|
@ -108,14 +108,14 @@ static int usage_hf_14b_dump(void) {
|
|||
|
||||
/*
|
||||
static void switch_on_field_14b(void) {
|
||||
UsbCommand c = {CMD_ISO_14443B_COMMAND, {ISO14B_CONNECT, 0, 0}};
|
||||
UsbCommand c = {CMD_ISO_14443B_COMMAND, {ISO14B_CONNECT, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
}
|
||||
*/
|
||||
|
||||
static int switch_off_field_14b(void) {
|
||||
UsbCommand c = {CMD_ISO_14443B_COMMAND, {ISO14B_DISCONNECT, 0, 0}};
|
||||
UsbCommand c = {CMD_ISO_14443B_COMMAND, {ISO14B_DISCONNECT, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
|
@ -136,7 +136,7 @@ int CmdHF14BSim(const char *Cmd) {
|
|||
pupi = param_get32ex(Cmd, 1, 0, 16);
|
||||
}
|
||||
|
||||
UsbCommand c = {CMD_SIMULATE_TAG_ISO_14443B, {pupi, 0, 0}};
|
||||
UsbCommand c = {CMD_SIMULATE_TAG_ISO_14443B, {pupi, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
|
@ -147,7 +147,7 @@ int CmdHF14BSniff(const char *Cmd) {
|
|||
char cmdp = tolower(param_getchar(Cmd, 0));
|
||||
if (cmdp == 'h') return usage_hf_14b_sniff();
|
||||
|
||||
UsbCommand c = {CMD_SNIFF_ISO_14443B, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_SNIFF_ISO_14443B, {0, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
|
@ -242,7 +242,7 @@ int CmdHF14BCmdRaw(const char *Cmd) {
|
|||
// Max buffer is USB_CMD_DATA_SIZE
|
||||
datalen = (datalen > USB_CMD_DATA_SIZE) ? USB_CMD_DATA_SIZE : datalen;
|
||||
|
||||
UsbCommand c = {CMD_ISO_14443B_COMMAND, {flags, datalen, time_wait}};
|
||||
UsbCommand c = {CMD_ISO_14443B_COMMAND, {flags, datalen, time_wait}, {{0}}};
|
||||
memcpy(c.d.asBytes, data, datalen);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -267,7 +267,7 @@ static bool get_14b_UID(iso14b_card_select_t *card) {
|
|||
|
||||
int8_t retry = 3;
|
||||
UsbCommand resp;
|
||||
UsbCommand c = {CMD_ISO_14443B_COMMAND, {ISO14B_CONNECT | ISO14B_SELECT_SR | ISO14B_DISCONNECT, 0, 0}};
|
||||
UsbCommand c = {CMD_ISO_14443B_COMMAND, {ISO14B_CONNECT | ISO14B_SELECT_SR | ISO14B_DISCONNECT, 0, 0}, {{0}}};
|
||||
|
||||
// test for 14b SR
|
||||
while (retry--) {
|
||||
|
@ -473,7 +473,7 @@ bool HF14B_Std_Info(bool verbose) {
|
|||
bool isSuccess = false;
|
||||
|
||||
// 14b get and print UID only (general info)
|
||||
UsbCommand c = {CMD_ISO_14443B_COMMAND, {ISO14B_CONNECT | ISO14B_SELECT_STD | ISO14B_DISCONNECT, 0, 0}};
|
||||
UsbCommand c = {CMD_ISO_14443B_COMMAND, {ISO14B_CONNECT | ISO14B_SELECT_STD | ISO14B_DISCONNECT, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
@ -514,7 +514,7 @@ bool HF14B_Std_Info(bool verbose) {
|
|||
// SRx get and print full info (needs more info...)
|
||||
bool HF14B_ST_Info(bool verbose) {
|
||||
|
||||
UsbCommand c = {CMD_ISO_14443B_COMMAND, {ISO14B_CONNECT | ISO14B_SELECT_SR | ISO14B_DISCONNECT, 0, 0}};
|
||||
UsbCommand c = {CMD_ISO_14443B_COMMAND, {ISO14B_CONNECT | ISO14B_SELECT_SR | ISO14B_DISCONNECT, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
@ -586,7 +586,7 @@ bool HF14B_ST_Reader(bool verbose) {
|
|||
bool isSuccess = false;
|
||||
|
||||
// SRx get and print general info about SRx chip from UID
|
||||
UsbCommand c = {CMD_ISO_14443B_COMMAND, {ISO14B_CONNECT | ISO14B_SELECT_SR | ISO14B_DISCONNECT, 0, 0}};
|
||||
UsbCommand c = {CMD_ISO_14443B_COMMAND, {ISO14B_CONNECT | ISO14B_SELECT_SR | ISO14B_DISCONNECT, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
@ -626,7 +626,7 @@ bool HF14B_Std_Reader(bool verbose) {
|
|||
bool isSuccess = false;
|
||||
|
||||
// 14b get and print UID only (general info)
|
||||
UsbCommand c = {CMD_ISO_14443B_COMMAND, {ISO14B_CONNECT | ISO14B_SELECT_STD | ISO14B_DISCONNECT, 0, 0}};
|
||||
UsbCommand c = {CMD_ISO_14443B_COMMAND, {ISO14B_CONNECT | ISO14B_SELECT_STD | ISO14B_DISCONNECT, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
@ -671,7 +671,7 @@ bool HF14B_Other_Reader() {
|
|||
// // 14b get and print UID only (general info)
|
||||
// uint32_t flags = ISO14B_CONNECT | ISO14B_SELECT_STD | ISO14B_RAW | ISO14B_APPEND_CRC;
|
||||
|
||||
// UsbCommand c = {CMD_ISO_14443B_COMMAND, {flags, datalen, 0}};
|
||||
// UsbCommand c = {CMD_ISO_14443B_COMMAND, {flags, datalen, 0}, {{0}}};
|
||||
// memcpy(c.d.asBytes, data, datalen);
|
||||
|
||||
// clearCommandBuffer();
|
||||
|
@ -758,7 +758,7 @@ int CmdHF14BReadSri(const char *Cmd) {
|
|||
uint8_t tagtype = param_get8(Cmd, 0);
|
||||
uint8_t blocks = (tagtype == 1) ? 0x7F : 0x0F;
|
||||
|
||||
UsbCommand c = {CMD_READ_SRI_TAG, {blocks, 0, 0}};
|
||||
UsbCommand c = {CMD_READ_SRI_TAG, {blocks, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
|
@ -898,7 +898,7 @@ int CmdHF14BDump(const char *Cmd) {
|
|||
uint8_t *recv = NULL;
|
||||
|
||||
UsbCommand resp;
|
||||
UsbCommand c = {CMD_ISO_14443B_COMMAND, { ISO14B_CONNECT | ISO14B_SELECT_SR, 0, 0}};
|
||||
UsbCommand c = {CMD_ISO_14443B_COMMAND, { ISO14B_CONNECT | ISO14B_SELECT_SR, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
||||
|
|
|
@ -199,7 +199,7 @@ const productName uidmapping[] = {
|
|||
int getUID(uint8_t *buf) {
|
||||
|
||||
UsbCommand resp;
|
||||
UsbCommand c = {CMD_ISO_15693_COMMAND, {0, 1, 1}}; // len,speed,recv?
|
||||
UsbCommand c = {CMD_ISO_15693_COMMAND, {0, 1, 1}, {{0}}}; // len,speed,recv?
|
||||
|
||||
c.d.asBytes[0] = ISO15_REQ_SUBCARRIER_SINGLE | ISO15_REQ_DATARATE_HIGH | ISO15_REQ_INVENTORY | ISO15_REQINV_SLOT1;
|
||||
c.d.asBytes[1] = ISO15_CMD_INVENTORY;
|
||||
|
@ -496,7 +496,7 @@ int CmdHF15Samples(const char *Cmd) {
|
|||
char cmdp = tolower(param_getchar(Cmd, 0));
|
||||
if (cmdp == 'h') return usage_15_samples();
|
||||
|
||||
UsbCommand c = {CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_15693, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_15693, {0, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
||||
|
@ -515,7 +515,7 @@ int CmdHF15Info(const char *Cmd) {
|
|||
|
||||
UsbCommand resp;
|
||||
uint8_t *recv;
|
||||
UsbCommand c = {CMD_ISO_15693_COMMAND, {0, 1, 1}}; // len,speed,recv?
|
||||
UsbCommand c = {CMD_ISO_15693_COMMAND, {0, 1, 1}, {{0}}}; // len,speed,recv?
|
||||
uint8_t *req = c.d.asBytes;
|
||||
char cmdbuf[100] = {0};
|
||||
char *cmd = cmdbuf;
|
||||
|
@ -593,7 +593,7 @@ int CmdHF15Record(const char *Cmd) {
|
|||
char cmdp = tolower(param_getchar(Cmd, 0));
|
||||
if (cmdp == 'h') return usage_15_record();
|
||||
|
||||
UsbCommand c = {CMD_RECORD_RAW_ADC_SAMPLES_ISO_15693, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_RECORD_RAW_ADC_SAMPLES_ISO_15693, {0, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
|
@ -635,7 +635,7 @@ int CmdHF15Sim(const char *Cmd) {
|
|||
|
||||
PrintAndLogEx(SUCCESS, "Starting simulating UID %s", sprint_hex(uid, sizeof(uid)));
|
||||
|
||||
UsbCommand c = {CMD_SIMTAG_ISO_15693, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_SIMTAG_ISO_15693, {0, 0, 0}, {{0}}};
|
||||
memcpy(c.d.asBytes, uid, 8);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -651,7 +651,7 @@ int CmdHF15Afi(const char *Cmd) {
|
|||
|
||||
PrintAndLogEx(SUCCESS, "press pm3-button to cancel");
|
||||
|
||||
UsbCommand c = {CMD_ISO_15693_FIND_AFI, {strtol(Cmd, NULL, 0), 0, 0}};
|
||||
UsbCommand c = {CMD_ISO_15693_FIND_AFI, {strtol(Cmd, NULL, 0), 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
|
@ -717,7 +717,7 @@ int CmdHF15Dump(const char *Cmd) {
|
|||
memset(data, 0, sizeof(data));
|
||||
|
||||
UsbCommand resp;
|
||||
UsbCommand c = {CMD_ISO_15693_COMMAND, {0, 1, 1}}; // len,speed,recv?
|
||||
UsbCommand c = {CMD_ISO_15693_COMMAND, {0, 1, 1}, {{0}}}; // len,speed,recv?
|
||||
uint8_t *req = c.d.asBytes;
|
||||
req[0] = ISO15_REQ_SUBCARRIER_SINGLE | ISO15_REQ_DATARATE_HIGH | ISO15_REQ_NONINVENTORY | ISO15_REQ_ADDRESS;
|
||||
req[1] = ISO15_CMD_READ;
|
||||
|
@ -914,7 +914,7 @@ int CmdHF15Raw(const char *Cmd) {
|
|||
if (strlen(Cmd) < 3 || cmdp == 'h' || cmdp == 'H') return usage_15_raw();
|
||||
|
||||
UsbCommand resp;
|
||||
UsbCommand c = {CMD_ISO_15693_COMMAND, {0, 1, 1}}; // len,speed,recv?
|
||||
UsbCommand c = {CMD_ISO_15693_COMMAND, {0, 1, 1}, {{0}}}; // len,speed,recv?
|
||||
int reply = 1, fast = 1, i = 0;
|
||||
bool crc = false;
|
||||
char buf[5] = "";
|
||||
|
@ -1079,7 +1079,7 @@ int CmdHF15Readmulti(const char *Cmd) {
|
|||
|
||||
UsbCommand resp;
|
||||
uint8_t *recv;
|
||||
UsbCommand c = {CMD_ISO_15693_COMMAND, {0, 1, 1}}; // len,speed,recv?
|
||||
UsbCommand c = {CMD_ISO_15693_COMMAND, {0, 1, 1}, {{0}}}; // len,speed,recv?
|
||||
uint8_t *req = c.d.asBytes;
|
||||
int reqlen = 0;
|
||||
uint8_t pagenum, pagecount;
|
||||
|
@ -1167,7 +1167,7 @@ int CmdHF15Read(const char *Cmd) {
|
|||
// arg0 (datalen, cmd len? .arg0 == crc?)
|
||||
// arg1 (speed == 0 == 1 of 256, == 1 == 1 of 4 )
|
||||
// arg2 (recv == 1 == expect a response)
|
||||
UsbCommand c = {CMD_ISO_15693_COMMAND, {0, 1, 1}};
|
||||
UsbCommand c = {CMD_ISO_15693_COMMAND, {0, 1, 1}, {{0}}};
|
||||
uint8_t *req = c.d.asBytes;
|
||||
int reqlen = 0, blocknum;
|
||||
char cmdbuf[100] = {0};
|
||||
|
@ -1236,7 +1236,7 @@ int CmdHF15Write(const char *Cmd) {
|
|||
|
||||
UsbCommand resp;
|
||||
uint8_t *recv;
|
||||
UsbCommand c = {CMD_ISO_15693_COMMAND, {0, 1, 1}}; // len,speed,recv?
|
||||
UsbCommand c = {CMD_ISO_15693_COMMAND, {0, 1, 1}, {{0}}}; // len,speed,recv?
|
||||
uint8_t *req = c.d.asBytes;
|
||||
int reqlen = 0, pagenum, temp;
|
||||
char cmdbuf[100] = {0};
|
||||
|
|
|
@ -31,7 +31,7 @@ int CmdHFEPACollectPACENonces(const char *Cmd) {
|
|||
// repeat n times
|
||||
for (uint32_t i = 0; i < n; i++) {
|
||||
// execute PACE
|
||||
UsbCommand c = {CMD_EPA_PACE_COLLECT_NONCE, {(int)m, 0, 0}};
|
||||
UsbCommand c = {CMD_EPA_PACE_COLLECT_NONCE, {(int)m, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
|
|
@ -73,8 +73,8 @@ int CmdHFFelicaList(const char *Cmd) {
|
|||
|
||||
int CmdHFFelicaReader(const char *Cmd) {
|
||||
bool silent = (Cmd[0] == 's' || Cmd[0] == 'S');
|
||||
//UsbCommand cDisconnect = {CMD_FELICA_COMMAND, {0,0,0}};
|
||||
UsbCommand c = {CMD_FELICA_COMMAND, {FELICA_CONNECT, 0, 0}};
|
||||
//UsbCommand cDisconnect = {CMD_FELICA_COMMAND, {0,0,0}, {{0}}};
|
||||
UsbCommand c = {CMD_FELICA_COMMAND, {FELICA_CONNECT, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
@ -173,7 +173,7 @@ int CmdHFFelicaSim(const char *Cmd) {
|
|||
//Validations
|
||||
if (errors || cmdp == 0) return usage_hf_felica_sim();
|
||||
|
||||
UsbCommand c = {CMD_FELICA_SIMULATE_TAG, { tagtype, flags, 0 }};
|
||||
UsbCommand c = {CMD_FELICA_SIMULATE_TAG, { tagtype, flags, 0 }, {{0}}};
|
||||
memcpy(c.d.asBytes, uid, uidlen >> 1);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -219,7 +219,7 @@ int CmdHFFelicaSniff(const char *Cmd) {
|
|||
//Validations
|
||||
if (errors || cmdp == 0) return usage_hf_felica_sniff();
|
||||
|
||||
UsbCommand c = {CMD_FELICA_SNIFF, {samples2skip, triggers2skip, 0}};
|
||||
UsbCommand c = {CMD_FELICA_SNIFF, {samples2skip, triggers2skip, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
|
@ -397,7 +397,7 @@ int CmdHFFelicaDumpLite(const char *Cmd) {
|
|||
|
||||
PrintAndLogEx(SUCCESS, "FeliCa lite - dump started");
|
||||
PrintAndLogEx(SUCCESS, "press pm3-button to cancel");
|
||||
UsbCommand c = {CMD_FELICA_LITE_DUMP, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_FELICA_LITE_DUMP, {0, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
@ -457,7 +457,7 @@ int CmdHFFelicaDumpLite(const char *Cmd) {
|
|||
}
|
||||
|
||||
int CmdHFFelicaCmdRaw(const char *Cmd) {
|
||||
UsbCommand c = {CMD_FELICA_COMMAND, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_FELICA_COMMAND, {0, 0, 0}, {{0}}};
|
||||
bool reply = 1;
|
||||
bool crc = false;
|
||||
bool power = false;
|
||||
|
|
|
@ -379,7 +379,7 @@ int CmdHFiClassSim(const char *Cmd) {
|
|||
case 2: {
|
||||
PrintAndLogEx(INFO, "Starting iCLASS sim 2 attack (elite mode)");
|
||||
PrintAndLogEx(INFO, "press keyboard to cancel");
|
||||
UsbCommand c = {CMD_SIMULATE_TAG_ICLASS, {simType, NUM_CSNS}};
|
||||
UsbCommand c = {CMD_SIMULATE_TAG_ICLASS, {simType, NUM_CSNS}, {{0}}};
|
||||
UsbCommand resp = {0};
|
||||
memcpy(c.d.asBytes, csns, 8 * NUM_CSNS);
|
||||
clearCommandBuffer();
|
||||
|
@ -432,7 +432,7 @@ int CmdHFiClassSim(const char *Cmd) {
|
|||
// reader in key roll mode, when it has two keys it alternates when trying to verify.
|
||||
PrintAndLogEx(INFO, "Starting iCLASS sim 4 attack (elite mode, reader in key roll mode)");
|
||||
PrintAndLogEx(INFO, "press keyboard to cancel");
|
||||
UsbCommand c = {CMD_SIMULATE_TAG_ICLASS, {simType, NUM_CSNS}};
|
||||
UsbCommand c = {CMD_SIMULATE_TAG_ICLASS, {simType, NUM_CSNS}, {{0}}};
|
||||
UsbCommand resp = {0};
|
||||
memcpy(c.d.asBytes, csns, 8 * NUM_CSNS);
|
||||
clearCommandBuffer();
|
||||
|
@ -500,7 +500,7 @@ int CmdHFiClassSim(const char *Cmd) {
|
|||
case 1:
|
||||
case 3:
|
||||
default: {
|
||||
UsbCommand c = {CMD_SIMULATE_TAG_ICLASS, {simType, numberOfCSNs}};
|
||||
UsbCommand c = {CMD_SIMULATE_TAG_ICLASS, {simType, numberOfCSNs}, {{0}}};
|
||||
memcpy(c.d.asBytes, CSN, 8);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -518,7 +518,7 @@ int HFiClassReader(const char *Cmd, bool loop, bool verbose) {
|
|||
FLAG_ICLASS_READER_CONF | FLAG_ICLASS_READER_ONLY_ONCE |
|
||||
FLAG_ICLASS_READER_ONE_TRY;
|
||||
|
||||
UsbCommand c = {CMD_READER_ICLASS, {flags, 0, 0}};
|
||||
UsbCommand c = {CMD_READER_ICLASS, {flags, 0, 0}, {{0}}};
|
||||
// loop in client not device - else on windows have a communication error
|
||||
UsbCommand resp;
|
||||
while (!ukbhit()) {
|
||||
|
@ -597,7 +597,7 @@ int CmdHFiClassReader_Replay(const char *Cmd) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
UsbCommand c = {CMD_READER_ICLASS_REPLAY, {readerType}};
|
||||
UsbCommand c = {CMD_READER_ICLASS_REPLAY, {readerType}, {{0}}};
|
||||
memcpy(c.d.asBytes, MAC, 4);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -605,7 +605,7 @@ int CmdHFiClassReader_Replay(const char *Cmd) {
|
|||
}
|
||||
|
||||
int iclassEmlSetMem(uint8_t *data, int blockNum, int blocksCount) {
|
||||
UsbCommand c = {CMD_MIFARE_EML_MEMSET, {blockNum, blocksCount, 0}};
|
||||
UsbCommand c = {CMD_MIFARE_EML_MEMSET, {blockNum, blocksCount, 0}, {{0}}};
|
||||
memcpy(c.d.asBytes, data, blocksCount * 16);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -668,7 +668,7 @@ int CmdHFiClassELoad(const char *Cmd) {
|
|||
|
||||
while (bytes_remaining > 0) {
|
||||
uint32_t bytes_in_packet = MIN(USB_CMD_DATA_SIZE, bytes_remaining);
|
||||
UsbCommand c = {CMD_ICLASS_EML_MEMSET, {bytes_sent, bytes_in_packet, 0}};
|
||||
UsbCommand c = {CMD_ICLASS_EML_MEMSET, {bytes_sent, bytes_in_packet, 0}, {{0}}};
|
||||
memcpy(c.d.asBytes, dump + bytes_sent, bytes_in_packet);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -833,7 +833,7 @@ void Calc_wb_mac(uint8_t blockno, uint8_t *data, uint8_t *div_key, uint8_t MAC[4
|
|||
|
||||
static bool select_only(uint8_t *CSN, uint8_t *CCNR, bool use_credit_key, bool verbose) {
|
||||
UsbCommand resp;
|
||||
UsbCommand c = {CMD_READER_ICLASS, {0}};
|
||||
UsbCommand c = {CMD_READER_ICLASS, {0}, {{0}}};
|
||||
c.arg[0] = FLAG_ICLASS_READER_ONLY_ONCE | FLAG_ICLASS_READER_CC | FLAG_ICLASS_READER_ONE_TRY;
|
||||
|
||||
if (use_credit_key)
|
||||
|
@ -884,7 +884,7 @@ static bool select_and_auth(uint8_t *KEY, uint8_t *MAC, uint8_t *div_key, bool u
|
|||
|
||||
doMAC(CCNR, div_key, MAC);
|
||||
UsbCommand resp;
|
||||
UsbCommand d = {CMD_ICLASS_AUTHENTICATION, {0, 0, 0}};
|
||||
UsbCommand d = {CMD_ICLASS_AUTHENTICATION, {0, 0, 0}, {{0}}};
|
||||
memcpy(d.d.asBytes, MAC, 4);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&d);
|
||||
|
@ -1004,7 +1004,7 @@ int CmdHFiClassReader_Dump(const char *Cmd) {
|
|||
FLAG_ICLASS_READER_ONE_TRY;
|
||||
|
||||
//get config and first 3 blocks
|
||||
UsbCommand c = {CMD_READER_ICLASS, {flags, 0, 0}};
|
||||
UsbCommand c = {CMD_READER_ICLASS, {flags, 0, 0}, {{0}}};
|
||||
UsbCommand resp;
|
||||
uint8_t tag_data[255 * 8];
|
||||
|
||||
|
@ -1046,7 +1046,7 @@ int CmdHFiClassReader_Dump(const char *Cmd) {
|
|||
}
|
||||
|
||||
// begin dump
|
||||
UsbCommand w = {CMD_ICLASS_DUMP, {blockno, numblks - blockno + 1}};
|
||||
UsbCommand w = {CMD_ICLASS_DUMP, {blockno, numblks - blockno + 1}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&w);
|
||||
while (true) {
|
||||
|
@ -1165,7 +1165,7 @@ static int WriteBlock(uint8_t blockno, uint8_t *bldata, uint8_t *KEY, bool use_c
|
|||
UsbCommand resp;
|
||||
|
||||
Calc_wb_mac(blockno, bldata, div_key, MAC);
|
||||
UsbCommand w = {CMD_ICLASS_WRITEBLOCK, {blockno}};
|
||||
UsbCommand w = {CMD_ICLASS_WRITEBLOCK, {blockno}, {{0}}};
|
||||
memcpy(w.d.asBytes, bldata, 8);
|
||||
memcpy(w.d.asBytes + 8, MAC, 4);
|
||||
|
||||
|
@ -1386,7 +1386,7 @@ int CmdHFiClassCloneTag(const char *Cmd) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
UsbCommand w = {CMD_ICLASS_CLONE, {startblock, endblock}};
|
||||
UsbCommand w = {CMD_ICLASS_CLONE, {startblock, endblock}, {{0}}};
|
||||
uint8_t *ptr;
|
||||
// calculate all mac for every the block we will write
|
||||
for (i = startblock; i <= endblock; i++) {
|
||||
|
@ -1433,7 +1433,7 @@ static int ReadBlock(uint8_t *KEY, uint8_t blockno, uint8_t keyType, bool elite,
|
|||
}
|
||||
|
||||
UsbCommand resp;
|
||||
UsbCommand c = {CMD_ICLASS_READBLOCK, {blockno}};
|
||||
UsbCommand c = {CMD_ICLASS_READBLOCK, {blockno}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, 4500)) {
|
||||
|
@ -2042,7 +2042,7 @@ int CmdHFiClassCheckKeys(const char *Cmd) {
|
|||
if (keys == keycnt - i)
|
||||
lastChunk = true;
|
||||
|
||||
UsbCommand c = {CMD_ICLASS_CHECK_KEYS, { (lastChunk << 8), keys, 0}};
|
||||
UsbCommand c = {CMD_ICLASS_CHECK_KEYS, { (lastChunk << 8), keys, 0}, {{0}}};
|
||||
|
||||
// bit 16
|
||||
// - 1 indicates credit key
|
||||
|
|
|
@ -508,7 +508,7 @@ int CmdLegicRfSim(const char *Cmd) {
|
|||
char cmdp = tolower(param_getchar(Cmd, 0));
|
||||
if (strlen(Cmd) == 0 || cmdp == 'h') return usage_legic_sim();
|
||||
|
||||
UsbCommand c = {CMD_SIMULATE_TAG_LEGIC_RF, {1}};
|
||||
UsbCommand c = {CMD_SIMULATE_TAG_LEGIC_RF, {1}, {{0}}};
|
||||
sscanf(Cmd, " %" SCNi64, &c.arg[0]);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -626,7 +626,7 @@ int CmdLegicRfWrite(const char *Cmd) {
|
|||
|
||||
PrintAndLogEx(SUCCESS, "Writing to tag");
|
||||
|
||||
UsbCommand c = {CMD_WRITER_LEGIC_RF, {offset, len, IV}};
|
||||
UsbCommand c = {CMD_WRITER_LEGIC_RF, {offset, len, IV}, {{0}}};
|
||||
memcpy(c.d.asBytes, data, len);
|
||||
UsbCommand resp;
|
||||
clearCommandBuffer();
|
||||
|
@ -740,7 +740,7 @@ int legic_read_mem(uint32_t offset, uint32_t len, uint32_t iv, uint8_t *out, uin
|
|||
|
||||
legic_chk_iv(&iv);
|
||||
|
||||
UsbCommand c = {CMD_READER_LEGIC_RF, {offset, len, iv}};
|
||||
UsbCommand c = {CMD_READER_LEGIC_RF, {offset, len, iv}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
@ -794,7 +794,7 @@ int legic_get_type(legic_card_select_t *card) {
|
|||
|
||||
if (card == NULL) return 1;
|
||||
|
||||
UsbCommand c = {CMD_LEGIC_INFO, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_LEGIC_INFO, {0, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
@ -821,7 +821,7 @@ void legic_chk_iv(uint32_t *iv) {
|
|||
}
|
||||
void legic_seteml(uint8_t *src, uint32_t offset, uint32_t numofbytes) {
|
||||
|
||||
UsbCommand c = {CMD_LEGIC_ESET, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_LEGIC_ESET, {0, 0, 0}, {{0}}};
|
||||
for (size_t i = offset; i < numofbytes; i += USB_CMD_DATA_SIZE) {
|
||||
|
||||
size_t len = MIN((numofbytes - i), USB_CMD_DATA_SIZE);
|
||||
|
@ -903,7 +903,7 @@ int CmdLegicDump(const char *Cmd) {
|
|||
legic_print_type(dumplen, 0);
|
||||
PrintAndLogEx(SUCCESS, "Reading tag memory %d b...", dumplen);
|
||||
|
||||
UsbCommand c = {CMD_READER_LEGIC_RF, {0x00, dumplen, 0x55}};
|
||||
UsbCommand c = {CMD_READER_LEGIC_RF, {0x00, dumplen, 0x55}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
@ -1052,7 +1052,7 @@ int CmdLegicRestore(const char *Cmd) {
|
|||
PrintAndLogEx(SUCCESS, "Restoring to card");
|
||||
|
||||
// transfer to device
|
||||
UsbCommand c = {CMD_WRITER_LEGIC_RF, {0, 0, 0x55}};
|
||||
UsbCommand c = {CMD_WRITER_LEGIC_RF, {0, 0, 0x55}, {{0}}};
|
||||
UsbCommand resp;
|
||||
for (size_t i = 7; i < numofbytes; i += USB_CMD_DATA_SIZE) {
|
||||
|
||||
|
@ -1245,7 +1245,7 @@ int CmdLegicWipe(const char *Cmd) {
|
|||
PrintAndLogEx(SUCCESS, "Erasing");
|
||||
|
||||
// transfer to device
|
||||
UsbCommand c = {CMD_WRITER_LEGIC_RF, {0, 0, 0x55}};
|
||||
UsbCommand c = {CMD_WRITER_LEGIC_RF, {0, 0, 0x55}, {{0}}};
|
||||
UsbCommand resp;
|
||||
for (size_t i = 7; i < card.cardsize; i += USB_CMD_DATA_SIZE) {
|
||||
|
||||
|
|
|
@ -409,7 +409,7 @@ static int usage_hf14_nack(void) {
|
|||
}
|
||||
|
||||
int GetHFMF14AUID(uint8_t *uid, int *uidlen) {
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT, 0, 0}};
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
@ -520,7 +520,7 @@ int CmdHF14AMfWrBl(const char *Cmd) {
|
|||
PrintAndLogEx(NORMAL, "--block no:%d, key type:%c, key:%s", blockNo, keyType ? 'B' : 'A', sprint_hex(key, 6));
|
||||
PrintAndLogEx(NORMAL, "--data: %s", sprint_hex(bldata, 16));
|
||||
|
||||
UsbCommand c = {CMD_MIFARE_WRITEBL, {blockNo, keyType, 0}};
|
||||
UsbCommand c = {CMD_MIFARE_WRITEBL, {blockNo, keyType, 0}, {{0}}};
|
||||
memcpy(c.d.asBytes, key, 6);
|
||||
memcpy(c.d.asBytes + 10, bldata, 16);
|
||||
clearCommandBuffer();
|
||||
|
@ -566,7 +566,7 @@ int CmdHF14AMfRdBl(const char *Cmd) {
|
|||
}
|
||||
PrintAndLogEx(NORMAL, "--block no:%d, key type:%c, key:%s ", blockNo, keyType ? 'B' : 'A', sprint_hex(key, 6));
|
||||
|
||||
UsbCommand c = {CMD_MIFARE_READBL, {blockNo, keyType, 0}};
|
||||
UsbCommand c = {CMD_MIFARE_READBL, {blockNo, keyType, 0}, {{0}}};
|
||||
memcpy(c.d.asBytes, key, 6);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -638,7 +638,7 @@ int CmdHF14AMfRdSc(const char *Cmd) {
|
|||
}
|
||||
PrintAndLogEx(NORMAL, "--sector no:%d key type:%c key:%s ", sectorNo, keyType ? 'B' : 'A', sprint_hex(key, 6));
|
||||
|
||||
UsbCommand c = {CMD_MIFARE_READSC, {sectorNo, keyType, 0}};
|
||||
UsbCommand c = {CMD_MIFARE_READSC, {sectorNo, keyType, 0}, {{0}}};
|
||||
memcpy(c.d.asBytes, key, 6);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -803,7 +803,7 @@ int CmdHF14AMfDump(const char *Cmd) {
|
|||
for (sectorNo = 0; sectorNo < numSectors; sectorNo++) {
|
||||
for (tries = 0; tries < MIFARE_SECTOR_RETRY; tries++) {
|
||||
|
||||
UsbCommand c = {CMD_MIFARE_READBL, {FirstBlockOfSector(sectorNo) + NumBlocksPerSector(sectorNo) - 1, 0, 0}};
|
||||
UsbCommand c = {CMD_MIFARE_READBL, {FirstBlockOfSector(sectorNo) + NumBlocksPerSector(sectorNo) - 1, 0, 0}, {{0}}};
|
||||
memcpy(c.d.asBytes, keyA[sectorNo], 6);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -840,7 +840,7 @@ int CmdHF14AMfDump(const char *Cmd) {
|
|||
|
||||
for (tries = 0; tries < MIFARE_SECTOR_RETRY; tries++) {
|
||||
if (blockNo == NumBlocksPerSector(sectorNo) - 1) { // sector trailer. At least the Access Conditions can always be read with key A.
|
||||
UsbCommand c = {CMD_MIFARE_READBL, {FirstBlockOfSector(sectorNo) + blockNo, 0, 0}};
|
||||
UsbCommand c = {CMD_MIFARE_READBL, {FirstBlockOfSector(sectorNo) + blockNo, 0, 0}, {{0}}};
|
||||
memcpy(c.d.asBytes, keyA[sectorNo], 6);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -848,7 +848,7 @@ int CmdHF14AMfDump(const char *Cmd) {
|
|||
} else { // data block. Check if it can be read with key A or key B
|
||||
uint8_t data_area = (sectorNo < 32) ? blockNo : blockNo / 5;
|
||||
if ((rights[sectorNo][data_area] == 0x03) || (rights[sectorNo][data_area] == 0x05)) { // only key B would work
|
||||
UsbCommand c = {CMD_MIFARE_READBL, {FirstBlockOfSector(sectorNo) + blockNo, 1, 0}};
|
||||
UsbCommand c = {CMD_MIFARE_READBL, {FirstBlockOfSector(sectorNo) + blockNo, 1, 0}, {{0}}};
|
||||
memcpy(c.d.asBytes, keyB[sectorNo], 6);
|
||||
SendCommand(&c);
|
||||
received = WaitForResponseTimeout(CMD_ACK, &resp, 1500);
|
||||
|
@ -857,7 +857,7 @@ int CmdHF14AMfDump(const char *Cmd) {
|
|||
PrintAndLogEx(WARNING, "access rights do not allow reading of sector %2d block %3d", sectorNo, blockNo);
|
||||
tries = MIFARE_SECTOR_RETRY;
|
||||
} else { // key A would work
|
||||
UsbCommand c = {CMD_MIFARE_READBL, {FirstBlockOfSector(sectorNo) + blockNo, 0, 0}};
|
||||
UsbCommand c = {CMD_MIFARE_READBL, {FirstBlockOfSector(sectorNo) + blockNo, 0, 0}, {{0}}};
|
||||
memcpy(c.d.asBytes, keyA[sectorNo], 6);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -1019,7 +1019,7 @@ int CmdHF14AMfRestore(const char *Cmd) {
|
|||
|
||||
for (sectorNo = 0; sectorNo < numSectors; sectorNo++) {
|
||||
for (blockNo = 0; blockNo < NumBlocksPerSector(sectorNo); blockNo++) {
|
||||
UsbCommand c = {CMD_MIFARE_WRITEBL, {FirstBlockOfSector(sectorNo) + blockNo, keyType, 0}};
|
||||
UsbCommand c = {CMD_MIFARE_WRITEBL, {FirstBlockOfSector(sectorNo) + blockNo, keyType, 0}, {{0}}};
|
||||
memcpy(c.d.asBytes, key, 6);
|
||||
bytes_read = fread(bldata, 1, 16, fdump);
|
||||
if (bytes_read != 16) {
|
||||
|
@ -1251,7 +1251,7 @@ int CmdHF14AMfNested(const char *Cmd) {
|
|||
|
||||
PrintAndLogEx(SUCCESS, "reading block %d", sectrail);
|
||||
|
||||
UsbCommand c = {CMD_MIFARE_READBL, {sectrail, 0, 0}};
|
||||
UsbCommand c = {CMD_MIFARE_READBL, {sectrail, 0, 0}, {{0}}};
|
||||
num_to_bytes(e_sector[i].Key[0], 6, c.d.asBytes); // KEY A
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -1993,7 +1993,7 @@ int CmdHF14AMfChk(const char *Cmd) {
|
|||
|
||||
PrintAndLogEx(NORMAL, "Reading block %d", sectrail);
|
||||
|
||||
UsbCommand c = {CMD_MIFARE_READBL, {sectrail, 0, 0}};
|
||||
UsbCommand c = {CMD_MIFARE_READBL, {sectrail, 0, 0}, {{0}}};
|
||||
num_to_bytes(e_sector[i].Key[0], 6, c.d.asBytes); // KEY A
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -2223,7 +2223,7 @@ int CmdHF14AMf1kSim(const char *Cmd) {
|
|||
, flags
|
||||
, flags);
|
||||
|
||||
UsbCommand c = {CMD_SIMULATE_MIFARE_CARD, {flags, exitAfterNReads, 0}};
|
||||
UsbCommand c = {CMD_SIMULATE_MIFARE_CARD, {flags, exitAfterNReads, 0}, {{0}}};
|
||||
memcpy(c.d.asBytes, uid, sizeof(uid));
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -2283,7 +2283,7 @@ int CmdHF14AMfSniff(const char *Cmd) {
|
|||
PrintAndLogEx(NORMAL, "Press the key on pc keyboard to abort the client.\n");
|
||||
PrintAndLogEx(NORMAL, "-------------------------------------------------------------------------\n");
|
||||
|
||||
UsbCommand c = {CMD_MIFARE_SNIFFER, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_MIFARE_SNIFFER, {0, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
||||
|
@ -2414,7 +2414,7 @@ int CmdHF14AMfDbg(const char *Cmd) {
|
|||
uint8_t dbgMode = param_get8ex(Cmd, 0, 0, 10);
|
||||
if (dbgMode > 4) return usage_hf14_dbg();
|
||||
|
||||
UsbCommand c = {CMD_MIFARE_SET_DBGMODE, {dbgMode, 0, 0}};
|
||||
UsbCommand c = {CMD_MIFARE_SET_DBGMODE, {dbgMode, 0, 0}, {{0}}};
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2500,7 +2500,7 @@ int CmdHF14AMfEClear(const char *Cmd) {
|
|||
char c = tolower(param_getchar(Cmd, 0));
|
||||
if (c == 'h') return usage_hf14_eclr();
|
||||
|
||||
UsbCommand cmd = {CMD_MIFARE_EML_MEMCLR, {0, 0, 0}};
|
||||
UsbCommand cmd = {CMD_MIFARE_EML_MEMCLR, {0, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&cmd);
|
||||
return 0;
|
||||
|
@ -2685,7 +2685,7 @@ int CmdHF14AMfECFill(const char *Cmd) {
|
|||
numSectors = NumOfSectors(c);
|
||||
|
||||
PrintAndLogEx(NORMAL, "--params: numSectors: %d, keyType: %c\n", numSectors, (keyType == 0) ? 'A' : 'B');
|
||||
UsbCommand cmd = {CMD_MIFARE_EML_CARDLOAD, {numSectors, keyType, 0}};
|
||||
UsbCommand cmd = {CMD_MIFARE_EML_CARDLOAD, {numSectors, keyType, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&cmd);
|
||||
return 0;
|
||||
|
@ -3147,7 +3147,7 @@ int CmdHf14AMfSetMod(const char *Cmd) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
UsbCommand c = {CMD_MIFARE_SETMOD, {mod, 0, 0}};
|
||||
UsbCommand c = {CMD_MIFARE_SETMOD, {mod, 0, 0}, {{0}}};
|
||||
memcpy(c.d.asBytes, key, 6);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -3248,7 +3248,7 @@ int CmdHF14AMfice(const char *Cmd) {
|
|||
flags = 0;
|
||||
flags |= initialize ? 0x0001 : 0;
|
||||
flags |= slow ? 0x0002 : 0;
|
||||
UsbCommand c = {CMD_MIFARE_ACQUIRE_NONCES, {blockNo + keyType * 0x100, trgBlockNo + trgKeyType * 0x100, flags}};
|
||||
UsbCommand c = {CMD_MIFARE_ACQUIRE_NONCES, {blockNo + keyType * 0x100, trgBlockNo + trgKeyType * 0x100, flags}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
||||
|
@ -3281,7 +3281,7 @@ out:
|
|||
fclose(fnonces);
|
||||
}
|
||||
|
||||
UsbCommand c = {CMD_MIFARE_ACQUIRE_NONCES, {blockNo + keyType * 0x100, trgBlockNo + trgKeyType * 0x100, 4}};
|
||||
UsbCommand c = {CMD_MIFARE_ACQUIRE_NONCES, {blockNo + keyType * 0x100, trgBlockNo + trgKeyType * 0x100, 4}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
|
|
|
@ -51,7 +51,7 @@ int CmdHF14ADesWb(const char *Cmd) {
|
|||
PrintAndLogEx(NORMAL, "--block no:%02x key type:%02x key:%s", blockNo, keyType, sprint_hex(key, 6));
|
||||
PrintAndLogEx(NORMAL, "--data: %s", sprint_hex(bldata, 16));
|
||||
|
||||
UsbCommand c = {CMD_MIFARE_WRITEBL, {blockNo, keyType, 0}};
|
||||
UsbCommand c = {CMD_MIFARE_WRITEBL, {blockNo, keyType, 0}, {{0}}};
|
||||
memcpy(c.d.asBytes, key, 6);
|
||||
memcpy(c.d.asBytes + 10, bldata, 16);
|
||||
SendCommand(&c);
|
||||
|
@ -94,7 +94,7 @@ int CmdHF14ADesRb(const char *Cmd) {
|
|||
// }
|
||||
// PrintAndLogEx(NORMAL, "--block no:%02x key type:%02x key:%s ", blockNo, keyType, sprint_hex(key, 6));
|
||||
|
||||
// UsbCommand c = {CMD_MIFARE_READBL, {blockNo, keyType, 0}};
|
||||
// UsbCommand c = {CMD_MIFARE_READBL, {blockNo, keyType, 0}, {{0}}};
|
||||
// memcpy(c.d.asBytes, key, 6);
|
||||
// SendCommand(&c);
|
||||
|
||||
|
@ -428,7 +428,7 @@ int CmdHF14ADesEnumApplications(const char *Cmd) {
|
|||
uint8_t aid[3];
|
||||
uint32_t options = (INIT | DISCONNECT);
|
||||
|
||||
UsbCommand c = {CMD_MIFARE_DESFIRE, {options, 0x01 }};
|
||||
UsbCommand c = {CMD_MIFARE_DESFIRE, {options, 0x01 }, {{0}}};
|
||||
c.d.asBytes[0] = GET_APPLICATION_IDS; //0x6a
|
||||
|
||||
SendCommand(&c);
|
||||
|
@ -612,7 +612,7 @@ int CmdHF14ADesAuth(const char *Cmd) {
|
|||
return 1;
|
||||
}
|
||||
// algo, nyckell<6C>ngd,
|
||||
UsbCommand c = {CMD_MIFARE_DESFIRE_AUTH1, { cmdAuthMode, cmdAuthAlgo, cmdKeyNo }};
|
||||
UsbCommand c = {CMD_MIFARE_DESFIRE_AUTH1, { cmdAuthMode, cmdAuthAlgo, cmdKeyNo }, {{0}}};
|
||||
|
||||
c.d.asBytes[0] = keylength;
|
||||
memcpy(c.d.asBytes + 1, key, keylength);
|
||||
|
|
|
@ -1383,7 +1383,7 @@ static int acquire_nonces(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_
|
|||
flags |= initialize ? 0x0001 : 0;
|
||||
flags |= slow ? 0x0002 : 0;
|
||||
flags |= field_off ? 0x0004 : 0;
|
||||
UsbCommand c = {CMD_MIFARE_ACQUIRE_ENCRYPTED_NONCES, {blockNo + keyType * 0x100, trgBlockNo + trgKeyType * 0x100, flags}};
|
||||
UsbCommand c = {CMD_MIFARE_ACQUIRE_ENCRYPTED_NONCES, {blockNo + keyType * 0x100, trgBlockNo + trgKeyType * 0x100, flags}, {{0}}};
|
||||
memcpy(c.d.asBytes, key, 6);
|
||||
|
||||
clearCommandBuffer();
|
||||
|
@ -1394,7 +1394,7 @@ static int acquire_nonces(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_
|
|||
if (initialize) {
|
||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, 3000)) {
|
||||
//strange second call (iceman)
|
||||
UsbCommand c1 = {CMD_MIFARE_ACQUIRE_ENCRYPTED_NONCES, {blockNo + keyType * 0x100, trgBlockNo + trgKeyType * 0x100, 4}};
|
||||
UsbCommand c1 = {CMD_MIFARE_ACQUIRE_ENCRYPTED_NONCES, {blockNo + keyType * 0x100, trgBlockNo + trgKeyType * 0x100, 4}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c1);
|
||||
return 1;
|
||||
|
|
|
@ -42,7 +42,7 @@ int CmdHFMFPInfo(const char *cmd) {
|
|||
CmdHF14AInfo("");
|
||||
|
||||
// Mifare Plus info
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0}};
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0}, {{0}}};
|
||||
SendCommand(&c);
|
||||
|
||||
UsbCommand resp;
|
||||
|
|
|
@ -458,13 +458,13 @@ char *getUlev1CardSizeStr(uint8_t fsize) {
|
|||
}
|
||||
|
||||
static void ul_switch_on_field(void) {
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_DISCONNECT | ISO14A_NO_RATS, 0, 0}};
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_DISCONNECT | ISO14A_NO_RATS, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
}
|
||||
|
||||
static int ul_send_cmd_raw(uint8_t *cmd, uint8_t cmdlen, uint8_t *response, uint16_t responseLength) {
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_RAW | ISO14A_NO_DISCONNECT | ISO14A_APPEND_CRC | ISO14A_NO_RATS, cmdlen, 0}};
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_RAW | ISO14A_NO_DISCONNECT | ISO14A_APPEND_CRC | ISO14A_NO_RATS, cmdlen, 0}, {{0}}};
|
||||
memcpy(c.d.asBytes, cmd, cmdlen);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -533,7 +533,7 @@ static int ulc_requestAuthentication(uint8_t *nonce, uint16_t nonceLength) {
|
|||
|
||||
static int ulc_authentication(uint8_t *key, bool switch_off_field) {
|
||||
|
||||
UsbCommand c = {CMD_MIFAREUC_AUTH, {switch_off_field}};
|
||||
UsbCommand c = {CMD_MIFAREUC_AUTH, {switch_off_field}, {{0}}};
|
||||
memcpy(c.d.asBytes, key, 16);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -621,7 +621,7 @@ static int ul_fudan_check(void) {
|
|||
if (!ul_select(&card))
|
||||
return UL_ERROR;
|
||||
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_RAW | ISO14A_NO_DISCONNECT | ISO14A_NO_RATS, 4, 0}};
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_RAW | ISO14A_NO_DISCONNECT | ISO14A_NO_RATS, 4, 0}, {{0}}};
|
||||
|
||||
uint8_t cmd[4] = {0x30, 0x00, 0x02, 0xa7}; //wrong crc on purpose should be 0xa8
|
||||
memcpy(c.d.asBytes, cmd, 4);
|
||||
|
@ -1475,7 +1475,7 @@ int CmdHF14AMfUWrBl(const char *Cmd) {
|
|||
PrintAndLogEx(NORMAL, "Block: %0d (0x%02X) [ %s]", blockNo, blockNo, sprint_hex(blockdata, 4));
|
||||
|
||||
//Send write Block
|
||||
UsbCommand c = {CMD_MIFAREU_WRITEBL, {blockNo}};
|
||||
UsbCommand c = {CMD_MIFAREU_WRITEBL, {blockNo}, {{0}}};
|
||||
memcpy(c.d.asBytes, blockdata, 4);
|
||||
|
||||
if (hasAuthKey) {
|
||||
|
@ -1581,7 +1581,7 @@ int CmdHF14AMfURdBl(const char *Cmd) {
|
|||
if (swapEndian && hasPwdKey) authKeyPtr = SwapEndian64(authenticationkey, 4, 4);
|
||||
|
||||
//Read Block
|
||||
UsbCommand c = {CMD_MIFAREU_READBL, {blockNo}};
|
||||
UsbCommand c = {CMD_MIFAREU_READBL, {blockNo}, {{0}}};
|
||||
if (hasAuthKey) {
|
||||
c.arg[1] = 1;
|
||||
memcpy(c.d.asBytes, authKeyPtr, 16);
|
||||
|
@ -1846,7 +1846,7 @@ int CmdHF14AMfUDump(const char *Cmd) {
|
|||
}
|
||||
ul_print_type(tagtype, 0);
|
||||
PrintAndLogEx(SUCCESS, "Reading tag memory...");
|
||||
UsbCommand c = {CMD_MIFAREU_READCARD, {startPage, pages}};
|
||||
UsbCommand c = {CMD_MIFAREU_READCARD, {startPage, pages}, {{0}}};
|
||||
if (hasAuthKey) {
|
||||
if (tagtype & UL_C)
|
||||
c.arg[2] = 1; //UL_C auth
|
||||
|
@ -2010,7 +2010,7 @@ int CmdHF14AMfURestore(const char *Cmd) {
|
|||
bool read_key = false;
|
||||
size_t filelen = 0;
|
||||
FILE *f;
|
||||
UsbCommand c = {CMD_MIFAREU_WRITEBL, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_MIFAREU_WRITEBL, {0, 0, 0}, {{0}}};
|
||||
|
||||
memset(authkey, 0x00, sizeof(authkey));
|
||||
|
||||
|
@ -2487,7 +2487,7 @@ int CmdHF14AMfuGenDiverseKeys(const char *Cmd) {
|
|||
|
||||
if (cmdp == 'r') {
|
||||
// read uid from tag
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_RATS, 0, 0}};
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_RATS, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
@ -2602,7 +2602,7 @@ int CmdHF14AMfuPwdGen(const char *Cmd) {
|
|||
|
||||
if (cmdp == 'r') {
|
||||
// read uid from tag
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_RATS, 0, 0}};
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_RATS, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
|
|
@ -31,18 +31,18 @@ static struct {
|
|||
} topaz_tag;
|
||||
|
||||
static void topaz_switch_on_field(void) {
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_SELECT | ISO14A_NO_DISCONNECT | ISO14A_TOPAZMODE | ISO14A_NO_RATS, 0, 0}};
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_SELECT | ISO14A_NO_DISCONNECT | ISO14A_TOPAZMODE | ISO14A_NO_RATS, 0, 0}, {{0}}};
|
||||
SendCommand(&c);
|
||||
}
|
||||
|
||||
static void topaz_switch_off_field(void) {
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {0, 0, 0}, {{0}}};
|
||||
SendCommand(&c);
|
||||
}
|
||||
|
||||
// send a raw topaz command, returns the length of the response (0 in case of error)
|
||||
static int topaz_send_cmd_raw(uint8_t *cmd, uint8_t len, uint8_t *response) {
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_RAW | ISO14A_NO_DISCONNECT | ISO14A_TOPAZMODE | ISO14A_NO_RATS, len, 0}};
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_RAW | ISO14A_NO_DISCONNECT | ISO14A_TOPAZMODE | ISO14A_NO_RATS, len, 0}, {{0}}};
|
||||
memcpy(c.d.asBytes, cmd, len);
|
||||
SendCommand(&c);
|
||||
|
||||
|
|
|
@ -347,7 +347,7 @@ int CmdLCD(const char *Cmd) {
|
|||
}
|
||||
|
||||
int CmdLCDReset(const char *Cmd) {
|
||||
UsbCommand c = {CMD_LCD_RESET, {strtol(Cmd, NULL, 0), 0, 0}};
|
||||
UsbCommand c = {CMD_LCD_RESET, {strtol(Cmd, NULL, 0), 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
|
@ -355,7 +355,7 @@ int CmdLCDReset(const char *Cmd) {
|
|||
#endif
|
||||
|
||||
int CmdReadmem(const char *Cmd) {
|
||||
UsbCommand c = {CMD_READ_MEM, {strtol(Cmd, NULL, 0), 0, 0}};
|
||||
UsbCommand c = {CMD_READ_MEM, {strtol(Cmd, NULL, 0), 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
|
@ -374,7 +374,7 @@ int CmdReset(const char *Cmd) {
|
|||
* 600kHz.
|
||||
*/
|
||||
int CmdSetDivisor(const char *Cmd) {
|
||||
UsbCommand c = {CMD_SET_LF_DIVISOR, {strtol(Cmd, NULL, 0), 0, 0}};
|
||||
UsbCommand c = {CMD_SET_LF_DIVISOR, {strtol(Cmd, NULL, 0), 0, 0}, {{0}}};
|
||||
|
||||
if (c.arg[0] < 19 || c.arg[0] > 255) {
|
||||
PrintAndLogEx(NORMAL, "divisor must be between 19 and 255");
|
||||
|
@ -415,7 +415,7 @@ int CmdVersion(const char *Cmd) {
|
|||
if (silent)
|
||||
return 0;
|
||||
|
||||
UsbCommand c = {CMD_VERSION, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_VERSION, {0, 0, 0}, {{0}}};
|
||||
UsbCommand resp;
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
|
|
@ -144,7 +144,7 @@ static int usage_lf_find(void) {
|
|||
/* send a LF command before reading */
|
||||
int CmdLFCommandRead(const char *Cmd) {
|
||||
|
||||
UsbCommand c = {CMD_MOD_THEN_ACQUIRE_RAW_ADC_SAMPLES_125K, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_MOD_THEN_ACQUIRE_RAW_ADC_SAMPLES_125K, {0, 0, 0}, {{0}}};
|
||||
bool errors = false;
|
||||
|
||||
uint8_t cmdp = 0;
|
||||
|
@ -334,7 +334,7 @@ int CmdLFSetConfig(const char *Cmd) {
|
|||
|
||||
bool lf_read(bool silent, uint32_t samples) {
|
||||
if (IsOffline()) return false;
|
||||
UsbCommand c = {CMD_ACQUIRE_RAW_ADC_SAMPLES_125K, {silent, samples, 0}};
|
||||
UsbCommand c = {CMD_ACQUIRE_RAW_ADC_SAMPLES_125K, {silent, samples, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
||||
|
@ -390,7 +390,7 @@ int CmdLFSniff(const char *Cmd) {
|
|||
uint8_t cmdp = tolower(param_getchar(Cmd, 0));
|
||||
if (cmdp == 'h') return usage_lf_sniff();
|
||||
|
||||
UsbCommand c = {CMD_LF_SNIFF_RAW_ADC_SAMPLES, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_LF_SNIFF_RAW_ADC_SAMPLES, {0, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
WaitForResponse(CMD_ACK, NULL);
|
||||
|
@ -423,7 +423,7 @@ int CmdLFSim(const char *Cmd) {
|
|||
|
||||
//can send only 512 bits at a time (1 byte sent per bit...)
|
||||
for (uint16_t i = 0; i < GraphTraceLen; i += USB_CMD_DATA_SIZE) {
|
||||
UsbCommand c = {CMD_UPLOAD_SIM_SAMPLES_125K, {i, FPGA_LF, 0}};
|
||||
UsbCommand c = {CMD_UPLOAD_SIM_SAMPLES_125K, {i, FPGA_LF, 0}, {{0}}};
|
||||
|
||||
for (uint16_t j = 0; j < USB_CMD_DATA_SIZE; j++)
|
||||
c.d.asBytes[j] = GraphBuffer[i + j];
|
||||
|
@ -437,7 +437,7 @@ int CmdLFSim(const char *Cmd) {
|
|||
|
||||
PrintAndLogEx(NORMAL, "Simulating");
|
||||
|
||||
UsbCommand c = {CMD_SIMULATE_TAG_125K, {GraphTraceLen, gap, 0}};
|
||||
UsbCommand c = {CMD_SIMULATE_TAG_125K, {GraphTraceLen, gap, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
|
@ -526,7 +526,7 @@ int CmdLFfskSim(const char *Cmd) {
|
|||
PrintAndLogEx(NORMAL, "DemodBuffer too long for current implementation - length: %d - max: %d", size, USB_CMD_DATA_SIZE);
|
||||
size = USB_CMD_DATA_SIZE;
|
||||
}
|
||||
UsbCommand c = {CMD_FSK_SIM_TAG, {arg1, arg2, size}};
|
||||
UsbCommand c = {CMD_FSK_SIM_TAG, {arg1, arg2, size}, {{0}}};
|
||||
|
||||
memcpy(c.d.asBytes, DemodBuffer, size);
|
||||
clearCommandBuffer();
|
||||
|
@ -622,7 +622,7 @@ int CmdLFaskSim(const char *Cmd) {
|
|||
arg1 = clk << 8 | encoding;
|
||||
arg2 = invert << 8 | separator;
|
||||
|
||||
UsbCommand c = {CMD_ASK_SIM_TAG, {arg1, arg2, size}};
|
||||
UsbCommand c = {CMD_ASK_SIM_TAG, {arg1, arg2, size}, {{0}}};
|
||||
memcpy(c.d.asBytes, DemodBuffer, size);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -729,7 +729,7 @@ int CmdLFpskSim(const char *Cmd) {
|
|||
PrintAndLogEx(NORMAL, "DemodBuffer too long for current implementation - length: %d - max: %d", size, USB_CMD_DATA_SIZE);
|
||||
size = USB_CMD_DATA_SIZE;
|
||||
}
|
||||
UsbCommand c = {CMD_PSK_SIM_TAG, {arg1, arg2, size}};
|
||||
UsbCommand c = {CMD_PSK_SIM_TAG, {arg1, arg2, size}, {{0}}};
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Sending DemodBuffer Length: %d", size);
|
||||
memcpy(c.d.asBytes, DemodBuffer, size);
|
||||
clearCommandBuffer();
|
||||
|
@ -742,7 +742,7 @@ int CmdLFSimBidir(const char *Cmd) {
|
|||
// Set ADC to twice the carrier for a slight supersampling
|
||||
// HACK: not implemented in ARMSRC.
|
||||
PrintAndLogEx(INFO, "Not implemented yet.");
|
||||
UsbCommand c = {CMD_LF_SIMULATE_BIDIR, {47, 384, 0}};
|
||||
UsbCommand c = {CMD_LF_SIMULATE_BIDIR, {47, 384, 0}, {{0}}};
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ static int usage_lf_awid_brute(void) {
|
|||
}
|
||||
|
||||
static bool sendPing(void) {
|
||||
UsbCommand ping = {CMD_PING, {1, 2, 3}};
|
||||
UsbCommand ping = {CMD_PING, {1, 2, 3}, {{0}}};
|
||||
SendCommand(&ping);
|
||||
SendCommand(&ping);
|
||||
SendCommand(&ping);
|
||||
|
@ -112,7 +112,7 @@ static bool sendTry(uint8_t fmtlen, uint32_t fc, uint32_t cn, uint32_t delay, ui
|
|||
uint64_t arg1 = (high << 8) + low;
|
||||
uint64_t arg2 = (invert << 8) + clk;
|
||||
|
||||
UsbCommand c = {CMD_FSK_SIM_TAG, {arg1, arg2, bs_len}};
|
||||
UsbCommand c = {CMD_FSK_SIM_TAG, {arg1, arg2, bs_len}, {{0}}};
|
||||
memcpy(c.d.asBytes, bits, bs_len);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -230,7 +230,7 @@ int CmdAWIDRead_device(const char *Cmd) {
|
|||
|
||||
if (Cmd[0] == 'h' || Cmd[0] == 'H') return usage_lf_awid_read();
|
||||
uint8_t findone = (Cmd[0] == '1') ? 1 : 0;
|
||||
UsbCommand c = {CMD_AWID_DEMOD_FSK, {findone, 0, 0}};
|
||||
UsbCommand c = {CMD_AWID_DEMOD_FSK, {findone, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
|
@ -403,7 +403,7 @@ int CmdAWIDSim(const char *Cmd) {
|
|||
// arg1 --- fcHigh<<8 + fcLow
|
||||
// arg2 --- Inversion and clk setting
|
||||
// 96 --- Bitstream length: 96-bits == 12 bytes
|
||||
UsbCommand c = {CMD_FSK_SIM_TAG, {arg1, arg2, size}};
|
||||
UsbCommand c = {CMD_FSK_SIM_TAG, {arg1, arg2, size}, {{0}}};
|
||||
memcpy(c.d.asBytes, bits, size);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -446,7 +446,7 @@ int CmdAWIDClone(const char *Cmd) {
|
|||
print_blocks(blocks, 4);
|
||||
|
||||
UsbCommand resp;
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0, 0, 0}, {{0}}};
|
||||
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
c.arg[0] = blocks[i];
|
||||
|
|
|
@ -74,7 +74,7 @@ int CmdCOTAGRead(const char *Cmd) {
|
|||
uint32_t rawsignal = 1;
|
||||
sscanf(Cmd, "%u", &rawsignal);
|
||||
|
||||
UsbCommand c = {CMD_COTAG, {rawsignal, 0, 0}};
|
||||
UsbCommand c = {CMD_COTAG, {rawsignal, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
if (!WaitForResponseTimeout(CMD_ACK, NULL, 7000)) {
|
||||
|
|
|
@ -395,7 +395,7 @@ int CmdEM410xRead(const char *Cmd) {
|
|||
int CmdEM410xRead_device(const char *Cmd) {
|
||||
char cmdp = tolower(param_getchar(Cmd, 0));
|
||||
uint8_t findone = (cmdp == '1') ? 1 : 0;
|
||||
UsbCommand c = {CMD_EM410X_DEMOD, {findone, 0, 0}};
|
||||
UsbCommand c = {CMD_EM410X_DEMOD, {findone, 0, 0}, {{0}}};
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
}
|
||||
|
@ -648,7 +648,7 @@ int CmdEM410xWrite(const char *Cmd) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
UsbCommand c = {CMD_EM410X_WRITE_TAG, {card, (uint32_t)(id >> 32), (uint32_t)id}};
|
||||
UsbCommand c = {CMD_EM410X_WRITE_TAG, {card, (uint32_t)(id >> 32), (uint32_t)id}, {{0}}};
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1128,7 +1128,7 @@ bool demodEM4x05resp(uint32_t *word) {
|
|||
|
||||
//////////////// 4205 / 4305 commands
|
||||
int EM4x05ReadWord_ext(uint8_t addr, uint32_t pwd, bool usePwd, uint32_t *word) {
|
||||
UsbCommand c = {CMD_EM4X_READ_WORD, {addr, pwd, usePwd}};
|
||||
UsbCommand c = {CMD_EM4X_READ_WORD, {addr, pwd, usePwd}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
@ -1231,7 +1231,7 @@ int CmdEM4x05Write(const char *Cmd) {
|
|||
|
||||
uint16_t flag = (addr << 8) | (usePwd);
|
||||
|
||||
UsbCommand c = {CMD_EM4X_WRITE_WORD, {flag, data, pwd}};
|
||||
UsbCommand c = {CMD_EM4X_WRITE_WORD, {flag, data, pwd}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
|
|
@ -345,7 +345,7 @@ int CmdFdxClone(const char *Cmd) {
|
|||
print_blocks(blocks, 5);
|
||||
|
||||
UsbCommand resp;
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0, 0, 0}, {{0}}};
|
||||
|
||||
for (int i = 4; i >= 0; --i) {
|
||||
c.arg[0] = blocks[i];
|
||||
|
@ -381,7 +381,7 @@ int CmdFdxSim(const char *Cmd) {
|
|||
|
||||
PrintAndLogEx(SUCCESS, "Simulating FDX-B animal ID: %04u-%"PRIu64, countryid, animalid);
|
||||
|
||||
UsbCommand c = {CMD_ASK_SIM_TAG, {arg1, arg2, size}};
|
||||
UsbCommand c = {CMD_ASK_SIM_TAG, {arg1, arg2, size}, {{0}}};
|
||||
|
||||
//getFDXBits(uint64_t national_id, uint16_t country, uint8_t isanimal, uint8_t isextended, uint32_t extended, uint8_t *bits)
|
||||
getFDXBits(animalid, countryid, 1, 0, 0, c.d.asBytes);
|
||||
|
|
|
@ -295,7 +295,7 @@ int CmdGuardClone(const char *Cmd) {
|
|||
print_blocks(blocks, 4);
|
||||
|
||||
UsbCommand resp;
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0, 0, 0}, {{0}}};
|
||||
|
||||
for (i = 0; i < 4; ++i) {
|
||||
c.arg[0] = blocks[i];
|
||||
|
@ -340,7 +340,7 @@ int CmdGuardSim(const char *Cmd) {
|
|||
arg1 = (clock1 << 8) | encoding;
|
||||
arg2 = (invert << 8) | separator;
|
||||
|
||||
UsbCommand c = {CMD_ASK_SIM_TAG, {arg1, arg2, size}};
|
||||
UsbCommand c = {CMD_ASK_SIM_TAG, {arg1, arg2, size}, {{0}}};
|
||||
memcpy(c.d.asBytes, bs, size);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
|
|
@ -92,7 +92,7 @@ static int usage_lf_hid_brute(void) {
|
|||
|
||||
// sending three times. Didn't seem to break the previous sim?
|
||||
static bool sendPing(void) {
|
||||
UsbCommand ping = {CMD_PING, {1, 2, 3}};
|
||||
UsbCommand ping = {CMD_PING, {1, 2, 3}, {{0}}};
|
||||
SendCommand(&ping);
|
||||
SendCommand(&ping);
|
||||
SendCommand(&ping);
|
||||
|
@ -112,7 +112,7 @@ static bool sendTry(uint8_t fmtlen, uint32_t fc, uint32_t cn, uint32_t delay, ui
|
|||
|
||||
uint64_t arg1 = bytebits_to_byte(bits, 32);
|
||||
uint64_t arg2 = bytebits_to_byte(bits + 32, 32);
|
||||
UsbCommand c = {CMD_HID_SIM_TAG, {arg1, arg2, 0}};
|
||||
UsbCommand c = {CMD_HID_SIM_TAG, {arg1, arg2, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
||||
|
@ -234,7 +234,7 @@ int CmdHIDRead_device(const char *Cmd) {
|
|||
|
||||
if (Cmd[0] == 'h' || Cmd[0] == 'H') return usage_lf_hid_read();
|
||||
uint8_t findone = (Cmd[0] == '1') ? 1 : 0;
|
||||
UsbCommand c = {CMD_HID_DEMOD_FSK, {findone, 0, 0}};
|
||||
UsbCommand c = {CMD_HID_DEMOD_FSK, {findone, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
|
@ -255,7 +255,7 @@ int CmdHIDSim(const char *Cmd) {
|
|||
PrintAndLogEx(SUCCESS, "Simulating HID tag with ID %x%08x", hi, lo);
|
||||
PrintAndLogEx(SUCCESS, "Press pm3-button to abort simulation");
|
||||
|
||||
UsbCommand c = {CMD_HID_SIM_TAG, {hi, lo, 0}};
|
||||
UsbCommand c = {CMD_HID_SIM_TAG, {hi, lo, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
|
|
|
@ -256,7 +256,7 @@ int CmdLFHitagSniff(const char *Cmd) {
|
|||
char ctmp = tolower(param_getchar(Cmd, 0));
|
||||
if (ctmp == 'h') return usage_hitag_sniff();
|
||||
|
||||
UsbCommand c = {CMD_SNIFF_HITAG, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_SNIFF_HITAG, {0, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
|
@ -273,7 +273,7 @@ int CmdLFHitagSim(const char *Cmd) {
|
|||
int res = 0;
|
||||
char filename[FILE_PATH_SIZE] = { 0x00 };
|
||||
|
||||
UsbCommand c = {CMD_SIMULATE_HITAG, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_SIMULATE_HITAG, {0, 0, 0}, {{0}}};
|
||||
|
||||
while (param_getchar(Cmd, cmdp) != 0x00 && !errors) {
|
||||
switch (tolower(param_getchar(Cmd, cmdp))) {
|
||||
|
@ -590,7 +590,7 @@ int CmdLFHitagReader(const char *Cmd) {
|
|||
|
||||
int CmdLFHitagCheckChallenges(const char *Cmd) {
|
||||
|
||||
UsbCommand c = { CMD_TEST_HITAGS_TRACES, {0, 0, 0}};
|
||||
UsbCommand c = { CMD_TEST_HITAGS_TRACES, {0, 0, 0}, {{0}}};
|
||||
char filename[FILE_PATH_SIZE] = { 0x00 };
|
||||
size_t datalen = 0;
|
||||
int res = 0;
|
||||
|
@ -639,7 +639,7 @@ int CmdLFHitagCheckChallenges(const char *Cmd) {
|
|||
}
|
||||
|
||||
int CmdLFHitagWriter(const char *Cmd) {
|
||||
UsbCommand c = { CMD_WR_HITAG_S, {0, 0, 0}};
|
||||
UsbCommand c = { CMD_WR_HITAG_S, {0, 0, 0}, {{0}}};
|
||||
hitag_data *htd = (hitag_data *)c.d.asBytes;
|
||||
hitag_function htf = param_get32ex(Cmd, 0, 0, 10);
|
||||
|
||||
|
|
|
@ -514,7 +514,7 @@ int CmdIndalaSim(const char *Cmd) {
|
|||
PrintAndLogEx(SUCCESS, "Simulating Indala UID: %s", sprint_hex(hexuid, len));
|
||||
PrintAndLogEx(SUCCESS, "Press pm3-button to abort simulation or run another command");
|
||||
|
||||
UsbCommand c = {CMD_PSK_SIM_TAG, {arg1, arg2, size}};
|
||||
UsbCommand c = {CMD_PSK_SIM_TAG, {arg1, arg2, size}, {{0}}};
|
||||
memcpy(c.d.asBytes, bits, size);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -548,7 +548,7 @@ int CmdIndalaClone(const char *Cmd) {
|
|||
CLIGetHexWithReturn(2, data, &datalen);
|
||||
CLIParserFree();
|
||||
|
||||
UsbCommand c = {0, {0, 0, 0}};
|
||||
UsbCommand c = {0, {0, 0, 0}, {{0}}};
|
||||
|
||||
if (isLongUid) {
|
||||
PrintAndLogEx(INFO, "Preparing to clone Indala 224bit tag with RawID %s", sprint_hex(data, datalen));
|
||||
|
|
|
@ -71,7 +71,7 @@ int CmdIOProxRead(const char *Cmd) {
|
|||
int CmdIOProxRead_device(const char *Cmd) {
|
||||
if (Cmd[0] == 'h' || Cmd[0] == 'H') return usage_lf_io_read();
|
||||
int findone = (Cmd[0] == '1') ? 1 : 0;
|
||||
UsbCommand c = {CMD_IO_DEMOD_FSK, {findone, 0, 0}};
|
||||
UsbCommand c = {CMD_IO_DEMOD_FSK, {findone, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
|
@ -282,7 +282,7 @@ int CmdIOProxSim(const char *Cmd) {
|
|||
// arg1 --- fcHigh<<8 + fcLow
|
||||
// arg2 --- Invert and clk setting
|
||||
// size --- 64 bits == 8 bytes
|
||||
UsbCommand c = {CMD_FSK_SIM_TAG, {arg1, arg2, size}};
|
||||
UsbCommand c = {CMD_FSK_SIM_TAG, {arg1, arg2, size}, {{0}}};
|
||||
memcpy(c.d.asBytes, bits, size);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -325,8 +325,8 @@ int CmdIOProxClone(const char *Cmd) {
|
|||
PrintAndLogEx(INFO, "Preparing to clone IOProx to T55x7 with Version: %u FC: %u, CN: %u", version, fc, cn);
|
||||
print_blocks(blocks, 3);
|
||||
|
||||
//UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0,0,0}};
|
||||
UsbCommand c = {CMD_IO_CLONE_TAG, {blocks[1], blocks[2], 0}};
|
||||
//UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0,0,0}, {{0}}};
|
||||
UsbCommand c = {CMD_IO_CLONE_TAG, {blocks[1], blocks[2], 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
|
|
|
@ -186,7 +186,7 @@ int CmdJablotronClone(const char *Cmd) {
|
|||
print_blocks(blocks, 3);
|
||||
|
||||
UsbCommand resp;
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0, 0, 0}, {{0}}};
|
||||
|
||||
for (uint8_t i = 0; i < 3; i++) {
|
||||
c.arg[0] = blocks[i];
|
||||
|
@ -223,7 +223,7 @@ int CmdJablotronSim(const char *Cmd) {
|
|||
|
||||
PrintAndLogEx(SUCCESS, "Simulating Jablotron - FullCode: %"PRIx64, fullcode);
|
||||
|
||||
UsbCommand c = {CMD_ASK_SIM_TAG, {arg1, arg2, size}};
|
||||
UsbCommand c = {CMD_ASK_SIM_TAG, {arg1, arg2, size}, {{0}}};
|
||||
getJablotronBits(fullcode, c.d.asBytes);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
|
|
@ -172,7 +172,7 @@ int CmdKeriClone(const char *Cmd) {
|
|||
|
||||
|
||||
UsbCommand resp;
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0, 0, 0}, {{0}}};
|
||||
|
||||
|
||||
for (uint8_t i = 0; i < 3; i++) {
|
||||
|
@ -214,7 +214,7 @@ int CmdKeriSim(const char *Cmd) {
|
|||
|
||||
PrintAndLogEx(SUCCESS, "Simulating KERI - Internal Id: %u", internalid);
|
||||
|
||||
UsbCommand c = {CMD_PSK_SIM_TAG, {arg1, arg2, size}};
|
||||
UsbCommand c = {CMD_PSK_SIM_TAG, {arg1, arg2, size}, {{0}}};
|
||||
memcpy(c.d.asBytes, bits, size);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
|
|
@ -275,7 +275,7 @@ int CmdLFNedapClone(const char *Cmd) {
|
|||
print_blocks(blocks, 5);
|
||||
|
||||
UsbCommand resp;
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0,0,0}};
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0,0,0}, {{0}}};
|
||||
|
||||
for (uint8_t i = 0; i<5; ++i ) {
|
||||
c.arg[0] = blocks[i];
|
||||
|
@ -320,7 +320,7 @@ int CmdLFNedapSim(const char *Cmd) {
|
|||
PrintAndLogEx(SUCCESS, "bin %s", sprint_bin_break(bs, 128, 32));
|
||||
PrintAndLogEx(SUCCESS, "Simulating Nedap - CardNumber: %u", cardnumber);
|
||||
|
||||
UsbCommand c = {CMD_ASK_SIM_TAG, {arg1, arg2, size}};
|
||||
UsbCommand c = {CMD_ASK_SIM_TAG, {arg1, arg2, size}, {{0}}};
|
||||
memcpy(c.d.asBytes, bs, size);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
|
|
@ -207,7 +207,7 @@ int CmdNoralsyClone(const char *Cmd) {
|
|||
print_blocks(blocks, 4);
|
||||
|
||||
UsbCommand resp;
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0, 0, 0}, {{0}}};
|
||||
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
c.arg[0] = blocks[i];
|
||||
|
@ -250,7 +250,7 @@ int CmdNoralsySim(const char *Cmd) {
|
|||
|
||||
PrintAndLogEx(SUCCESS, "Simulating Noralsy - CardId: %u", id);
|
||||
|
||||
UsbCommand c = {CMD_ASK_SIM_TAG, {arg1, arg2, size}};
|
||||
UsbCommand c = {CMD_ASK_SIM_TAG, {arg1, arg2, size}, {{0}}};
|
||||
memcpy(c.d.asBytes, bs, size);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
|
|
@ -175,7 +175,7 @@ int CmdParadoxSim(const char *Cmd) {
|
|||
|
||||
PrintAndLogEx(NORMAL, "Simulating Paradox - Facility Code: %u, CardNumber: %u", facilitycode, cardnumber);
|
||||
|
||||
UsbCommand c = {CMD_FSK_SIM_TAG, {arg1, arg2, size}};
|
||||
UsbCommand c = {CMD_FSK_SIM_TAG, {arg1, arg2, size}, {{0}}};
|
||||
memcpy(c.d.asBytes, bs, size);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
|
|
@ -100,7 +100,7 @@ int CmdLFPCF7931Read(const char *Cmd) {
|
|||
if (ctmp == 'H' || ctmp == 'h') return usage_pcf7931_read();
|
||||
|
||||
UsbCommand resp;
|
||||
UsbCommand c = {CMD_PCF7931_READ, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_PCF7931_READ, {0, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, 2500)) {
|
||||
|
|
|
@ -205,7 +205,7 @@ int CmdPrescoClone(const char *Cmd) {
|
|||
print_blocks(blocks, 5);
|
||||
|
||||
UsbCommand resp;
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0, 0, 0}, {{0}}};
|
||||
|
||||
for (uint8_t i = 0; i < 5; i++) {
|
||||
c.arg[0] = blocks[i];
|
||||
|
@ -236,7 +236,7 @@ int CmdPrescoSim(const char *Cmd) {
|
|||
|
||||
PrintAndLogEx(SUCCESS, "Simulating Presco - SiteCode: %u, UserCode: %u, FullCode: %08X", sitecode, usercode, fullcode);
|
||||
|
||||
UsbCommand c = {CMD_ASK_SIM_TAG, {arg1, arg2, size}};
|
||||
UsbCommand c = {CMD_ASK_SIM_TAG, {arg1, arg2, size}, {{0}}};
|
||||
GetPrescoBits(fullcode, c.d.asBytes);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
|
|
@ -290,7 +290,7 @@ int CmdPyramidClone(const char *Cmd) {
|
|||
print_blocks(blocks, 5);
|
||||
|
||||
UsbCommand resp;
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0, 0, 0}, {{0}}};
|
||||
|
||||
for (uint8_t i = 0; i < 5; ++i) {
|
||||
c.arg[0] = blocks[i];
|
||||
|
@ -334,7 +334,7 @@ int CmdPyramidSim(const char *Cmd) {
|
|||
|
||||
PrintAndLogEx(SUCCESS, "Simulating Farpointe/Pyramid - Facility Code: %u, CardNumber: %u", facilitycode, cardnumber);
|
||||
|
||||
UsbCommand c = {CMD_FSK_SIM_TAG, {arg1, arg2, size}};
|
||||
UsbCommand c = {CMD_FSK_SIM_TAG, {arg1, arg2, size}, {{0}}};
|
||||
memcpy(c.d.asBytes, bs, size);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
|
|
@ -1012,7 +1012,7 @@ int CmdT55xxWakeUp(const char *Cmd) {
|
|||
}
|
||||
if (errors) return usage_t55xx_wakup();
|
||||
|
||||
UsbCommand c = {CMD_T55XX_WAKEUP, {password, 0, 0}};
|
||||
UsbCommand c = {CMD_T55XX_WAKEUP, {password, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
PrintAndLogEx(SUCCESS, "Wake up command sent. Try read now");
|
||||
|
@ -1068,7 +1068,7 @@ int CmdT55xxWriteBlock(const char *Cmd) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {data, block, 0}};
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {data, block, 0}, {{0}}};
|
||||
UsbCommand resp;
|
||||
c.d.asBytes[0] = (page1) ? 0x2 : 0;
|
||||
c.d.asBytes[0] |= (testMode) ? 0x4 : 0;
|
||||
|
@ -1503,7 +1503,7 @@ bool AquireData(uint8_t page, uint8_t block, bool pwdmode, uint32_t password) {
|
|||
// arg1: which block to read
|
||||
// arg2: password
|
||||
uint8_t arg0 = (page << 1 | (pwdmode));
|
||||
UsbCommand c = {CMD_T55XX_READ_BLOCK, {arg0, block, password}};
|
||||
UsbCommand c = {CMD_T55XX_READ_BLOCK, {arg0, block, password}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
if (!WaitForResponseTimeout(CMD_ACK, NULL, 2500)) {
|
||||
|
@ -1763,7 +1763,7 @@ void t55x7_create_config_block(int tagtype) {
|
|||
|
||||
int CmdResetRead(const char *Cmd) {
|
||||
(void)Cmd; // Cmd is not used so far
|
||||
UsbCommand c = {CMD_T55XX_RESET_READ, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_T55XX_RESET_READ, {0, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
if (!WaitForResponseTimeout(CMD_ACK, NULL, 2500)) {
|
||||
|
|
|
@ -120,7 +120,7 @@ int CmdVikingClone(const char *Cmd) {
|
|||
|
||||
PrintAndLogEx(INFO, "Preparing to clone Viking tag - ID: %08X, Raw: %08X%08X", id, (uint32_t)(rawID >> 32), (uint32_t)(rawID & 0xFFFFFFFF));
|
||||
|
||||
UsbCommand c = {CMD_VIKING_CLONE_TAG, {rawID >> 32, rawID & 0xFFFFFFFF, Q5}};
|
||||
UsbCommand c = {CMD_VIKING_CLONE_TAG, {rawID >> 32, rawID & 0xFFFFFFFF, Q5}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
@ -151,7 +151,7 @@ int CmdVikingSim(const char *Cmd) {
|
|||
|
||||
PrintAndLogEx(SUCCESS, "Simulating Viking - ID: %08X, Raw: %08X%08X", id, (uint32_t)(rawID >> 32), (uint32_t)(rawID & 0xFFFFFFFF));
|
||||
|
||||
UsbCommand c = {CMD_ASK_SIM_TAG, {arg1, arg2, size}};
|
||||
UsbCommand c = {CMD_ASK_SIM_TAG, {arg1, arg2, size}, {{0}}};
|
||||
num_to_bytebits(rawID, size, c.d.asBytes);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
|
|
@ -180,7 +180,7 @@ int CmdVisa2kClone(const char *Cmd) {
|
|||
print_blocks(blocks, 4);
|
||||
|
||||
UsbCommand resp;
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0, 0, 0}, {{0}}};
|
||||
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
c.arg[0] = blocks[i];
|
||||
|
@ -211,7 +211,7 @@ int CmdVisa2kSim(const char *Cmd) {
|
|||
|
||||
PrintAndLogEx(SUCCESS, "Simulating Visa2000 - CardId: %u", id);
|
||||
|
||||
UsbCommand c = {CMD_ASK_SIM_TAG, {arg1, arg2, size}};
|
||||
UsbCommand c = {CMD_ASK_SIM_TAG, {arg1, arg2, size}, {{0}}};
|
||||
|
||||
uint32_t blocks[3] = { BL0CK1, id, (visa_parity(id) << 4) | visa_chksum(id) };
|
||||
|
||||
|
|
|
@ -312,7 +312,7 @@ bool smart_select(bool silent, smart_card_atr_t *atr) {
|
|||
if (atr)
|
||||
memset(atr, 0, sizeof(smart_card_atr_t));
|
||||
|
||||
UsbCommand c = {CMD_SMART_ATR, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_SMART_ATR, {0, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
@ -378,7 +378,7 @@ static int smart_responseEx(uint8_t *data, bool silent) {
|
|||
int len = data[datalen - 1];
|
||||
if (!silent) PrintAndLogEx(INFO, "Requesting 0x%02X bytes response", len);
|
||||
uint8_t getstatus[] = {0x00, ISO7816_GET_RESPONSE, 0x00, 0x00, len};
|
||||
UsbCommand cStatus = {CMD_SMART_RAW, {SC_RAW, sizeof(getstatus), 0}};
|
||||
UsbCommand cStatus = {CMD_SMART_RAW, {SC_RAW, sizeof(getstatus), 0}, {{0}}};
|
||||
memcpy(cStatus.d.asBytes, getstatus, sizeof(getstatus));
|
||||
clearCommandBuffer();
|
||||
SendCommand(&cStatus);
|
||||
|
@ -485,7 +485,7 @@ int CmdSmartRaw(const char *Cmd) {
|
|||
|
||||
// arg0 = RFU flags
|
||||
// arg1 = length
|
||||
UsbCommand c = {CMD_SMART_RAW, {0, hexlen, 0}};
|
||||
UsbCommand c = {CMD_SMART_RAW, {0, hexlen, 0}, {{0}}};
|
||||
|
||||
if (active || active_select) {
|
||||
c.arg[0] |= SC_CONNECT;
|
||||
|
@ -544,7 +544,7 @@ int ExchangeAPDUSC(uint8_t *datain, int datainlen, bool activateCard, bool leave
|
|||
|
||||
PrintAndLogEx(DEBUG, "APDU SC");
|
||||
|
||||
UsbCommand c = {CMD_SMART_RAW, {SC_RAW_T0, datainlen, 0}};
|
||||
UsbCommand c = {CMD_SMART_RAW, {SC_RAW_T0, datainlen, 0}, {{0}}};
|
||||
if (activateCard) {
|
||||
c.arg[0] |= SC_SELECT | SC_CONNECT;
|
||||
}
|
||||
|
@ -560,7 +560,7 @@ int ExchangeAPDUSC(uint8_t *datain, int datainlen, bool activateCard, bool leave
|
|||
|
||||
// retry
|
||||
if (len > 1 && dataout[len - 2] == 0x6c && datainlen > 4) {
|
||||
UsbCommand c2 = {CMD_SMART_RAW, {SC_RAW_T0, datainlen, 0}};
|
||||
UsbCommand c2 = {CMD_SMART_RAW, {SC_RAW_T0, datainlen, 0}, {{0}}};
|
||||
memcpy(c2.d.asBytes, datain, 5);
|
||||
|
||||
// transfer length via T=0
|
||||
|
@ -723,7 +723,7 @@ int CmdSmartUpgrade(const char *Cmd) {
|
|||
|
||||
while (bytes_remaining > 0) {
|
||||
uint32_t bytes_in_packet = MIN(USB_CMD_DATA_SIZE, bytes_remaining);
|
||||
UsbCommand c = {CMD_SMART_UPLOAD, {index + bytes_sent, bytes_in_packet, 0}};
|
||||
UsbCommand c = {CMD_SMART_UPLOAD, {index + bytes_sent, bytes_in_packet, 0}, {{0}}};
|
||||
|
||||
// Fill usb bytes with 0xFF
|
||||
memset(c.d.asBytes, 0xFF, USB_CMD_DATA_SIZE);
|
||||
|
@ -746,7 +746,7 @@ int CmdSmartUpgrade(const char *Cmd) {
|
|||
PrintAndLogEx(SUCCESS, "Sim module firmware updating, don\'t turn off your PM3!");
|
||||
|
||||
// trigger the firmware upgrade
|
||||
UsbCommand c = {CMD_SMART_UPGRADE, {firmware_size, 0, 0}};
|
||||
UsbCommand c = {CMD_SMART_UPGRADE, {firmware_size, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
@ -785,7 +785,7 @@ int CmdSmartInfo(const char *Cmd) {
|
|||
//Validations
|
||||
if (errors) return usage_sm_info();
|
||||
|
||||
UsbCommand c = {CMD_SMART_ATR, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_SMART_ATR, {0, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
@ -860,7 +860,7 @@ int CmdSmartReader(const char *Cmd) {
|
|||
//Validations
|
||||
if (errors) return usage_sm_reader();
|
||||
|
||||
UsbCommand c = {CMD_SMART_ATR, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_SMART_ATR, {0, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
@ -906,7 +906,7 @@ int CmdSmartSetClock(const char *Cmd) {
|
|||
//Validations
|
||||
if (errors || cmdp == 0) return usage_sm_setclock();
|
||||
|
||||
UsbCommand c = {CMD_SMART_SETCLOCK, {clock1, 0, 0}};
|
||||
UsbCommand c = {CMD_SMART_SETCLOCK, {clock1, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
@ -958,7 +958,7 @@ static void smart_brute_prim() {
|
|||
|
||||
PrintAndLogEx(INFO, "Reading primitives");
|
||||
|
||||
UsbCommand c = {CMD_SMART_RAW, {SC_RAW_T0, 5, 0}};
|
||||
UsbCommand c = {CMD_SMART_RAW, {SC_RAW_T0, 5, 0}, {{0}}};
|
||||
|
||||
for (int i = 0; i < sizeof(get_card_data); i += 5) {
|
||||
|
||||
|
@ -988,7 +988,7 @@ static int smart_brute_sfi(bool decodeTLV) {
|
|||
int len;
|
||||
// READ RECORD
|
||||
uint8_t READ_RECORD[] = {0x00, 0xB2, 0x00, 0x00, 0x00};
|
||||
UsbCommand c = {CMD_SMART_RAW, {SC_RAW_T0, sizeof(READ_RECORD), 0}};
|
||||
UsbCommand c = {CMD_SMART_RAW, {SC_RAW_T0, sizeof(READ_RECORD), 0}, {{0}}};
|
||||
|
||||
PrintAndLogEx(INFO, "Start SFI brute forcing");
|
||||
|
||||
|
@ -1055,7 +1055,7 @@ static void smart_brute_options(bool decodeTLV) {
|
|||
uint8_t GET_PROCESSING_OPTIONS[] = {0x80, 0xA8, 0x00, 0x00, 0x02, 0x83, 0x00, 0x00};
|
||||
|
||||
// Get processing options command
|
||||
UsbCommand c = {CMD_SMART_RAW, {SC_RAW_T0, sizeof(GET_PROCESSING_OPTIONS), 0}};
|
||||
UsbCommand c = {CMD_SMART_RAW, {SC_RAW_T0, sizeof(GET_PROCESSING_OPTIONS), 0}, {{0}}};
|
||||
memcpy(c.d.asBytes, GET_PROCESSING_OPTIONS, sizeof(GET_PROCESSING_OPTIONS));
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -1112,7 +1112,7 @@ int CmdSmartBruteforceSFI(const char *Cmd) {
|
|||
// uint8_t VERIFY[] = {0x00, 0x20, 0x00, 0x80};
|
||||
|
||||
// Select AID command
|
||||
UsbCommand cAid = {CMD_SMART_RAW, {SC_RAW_T0, 0, 0}};
|
||||
UsbCommand cAid = {CMD_SMART_RAW, {SC_RAW_T0, 0, 0}, {{0}}};
|
||||
|
||||
PrintAndLogEx(INFO, "Importing AID list");
|
||||
json_t *root = NULL;
|
||||
|
|
|
@ -449,22 +449,22 @@ bool GetFromDevice(DeviceMemType_t memtype, uint8_t *dest, uint32_t bytes, uint3
|
|||
|
||||
switch (memtype) {
|
||||
case BIG_BUF: {
|
||||
UsbCommand c = {CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K, {start_index, bytes, 0}};
|
||||
UsbCommand c = {CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K, {start_index, bytes, 0}, {{0}}};
|
||||
SendCommand(&c);
|
||||
return dl_it(dest, bytes, start_index, response, ms_timeout, show_warning, CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K);
|
||||
}
|
||||
case BIG_BUF_EML: {
|
||||
UsbCommand c = {CMD_DOWNLOAD_EML_BIGBUF, {start_index, bytes, 0}};
|
||||
UsbCommand c = {CMD_DOWNLOAD_EML_BIGBUF, {start_index, bytes, 0}, {{0}}};
|
||||
SendCommand(&c);
|
||||
return dl_it(dest, bytes, start_index, response, ms_timeout, show_warning, CMD_DOWNLOADED_EML_BIGBUF);
|
||||
}
|
||||
case FLASH_MEM: {
|
||||
UsbCommand c = {CMD_FLASHMEM_DOWNLOAD, {start_index, bytes, 0}};
|
||||
UsbCommand c = {CMD_FLASHMEM_DOWNLOAD, {start_index, bytes, 0}, {{0}}};
|
||||
SendCommand(&c);
|
||||
return dl_it(dest, bytes, start_index, response, ms_timeout, show_warning, CMD_FLASHMEM_DOWNLOADED);
|
||||
}
|
||||
case SIM_MEM: {
|
||||
//UsbCommand c = {CMD_DOWNLOAD_SIM_MEM, {start_index, bytes, 0}};
|
||||
//UsbCommand c = {CMD_DOWNLOAD_SIM_MEM, {start_index, bytes, 0}, {{0}}};
|
||||
//SendCommand(&c);
|
||||
//return dl_it(dest, bytes, start_index, response, ms_timeout, show_warning, CMD_DOWNLOADED_SIMMEM);
|
||||
return false;
|
||||
|
|
|
@ -16,7 +16,7 @@ int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key) {
|
|||
uint64_t par_list = 0, ks_list = 0;
|
||||
uint64_t *keylist = NULL, *last_keylist = NULL;
|
||||
|
||||
UsbCommand c = {CMD_READER_MIFARE, {true, blockno, key_type}};
|
||||
UsbCommand c = {CMD_READER_MIFARE, {true, blockno, key_type}, {{0}}};
|
||||
|
||||
// message
|
||||
PrintAndLogEx(NORMAL, "--------------------------------------------------------------------------------\n");
|
||||
|
@ -123,7 +123,7 @@ int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key) {
|
|||
}
|
||||
int mfCheckKeys(uint8_t blockNo, uint8_t keyType, bool clear_trace, uint8_t keycnt, uint8_t *keyBlock, uint64_t *key) {
|
||||
*key = -1;
|
||||
UsbCommand c = {CMD_MIFARE_CHKKEYS, { (blockNo | (keyType << 8)), clear_trace, keycnt}};
|
||||
UsbCommand c = {CMD_MIFARE_CHKKEYS, { (blockNo | (keyType << 8)), clear_trace, keycnt}, {{0}}};
|
||||
memcpy(c.d.asBytes, keyBlock, 6 * keycnt);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -145,7 +145,7 @@ int mfCheckKeys_fast(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastChunk,
|
|||
uint32_t timeout = 0;
|
||||
|
||||
// send keychunk
|
||||
UsbCommand c = {CMD_MIFARE_CHKKEYS_FAST, { (sectorsCnt | (firstChunk << 8) | (lastChunk << 12)), ((use_flashmemory << 8) | strategy), size}};
|
||||
UsbCommand c = {CMD_MIFARE_CHKKEYS_FAST, { (sectorsCnt | (firstChunk << 8) | (lastChunk << 12)), ((use_flashmemory << 8) | strategy), size}, {{0}}};
|
||||
memcpy(c.d.asBytes, keyBlock, 6 * size);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -297,7 +297,7 @@ int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo,
|
|||
StateList_t statelists[2];
|
||||
struct Crypto1State *p1, *p2, *p3, *p4;
|
||||
|
||||
UsbCommand c = {CMD_MIFARE_NESTED, {blockNo + keyType * 0x100, trgBlockNo + trgKeyType * 0x100, calibrate}};
|
||||
UsbCommand c = {CMD_MIFARE_NESTED, {blockNo + keyType * 0x100, trgBlockNo + trgKeyType * 0x100, calibrate}, {{0}}};
|
||||
memcpy(c.d.asBytes, key, 6);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -419,7 +419,7 @@ out:
|
|||
// MIFARE
|
||||
int mfReadSector(uint8_t sectorNo, uint8_t keyType, uint8_t *key, uint8_t *data) {
|
||||
|
||||
UsbCommand c = {CMD_MIFARE_READSC, {sectorNo, keyType, 0}};
|
||||
UsbCommand c = {CMD_MIFARE_READSC, {sectorNo, keyType, 0}, {{0}}};
|
||||
memcpy(c.d.asBytes, key, 6);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -444,7 +444,7 @@ int mfReadSector(uint8_t sectorNo, uint8_t keyType, uint8_t *key, uint8_t *data)
|
|||
|
||||
// EMULATOR
|
||||
int mfEmlGetMem(uint8_t *data, int blockNum, int blocksCount) {
|
||||
UsbCommand c = {CMD_MIFARE_EML_MEMGET, {blockNum, blocksCount, 0}};
|
||||
UsbCommand c = {CMD_MIFARE_EML_MEMGET, {blockNum, blocksCount, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
@ -458,7 +458,7 @@ int mfEmlSetMem(uint8_t *data, int blockNum, int blocksCount) {
|
|||
}
|
||||
|
||||
int mfEmlSetMem_xt(uint8_t *data, int blockNum, int blocksCount, int blockBtWidth) {
|
||||
UsbCommand c = {CMD_MIFARE_EML_MEMSET, {blockNum, blocksCount, blockBtWidth}};
|
||||
UsbCommand c = {CMD_MIFARE_EML_MEMSET, {blockNum, blocksCount, blockBtWidth}, {{0}}};
|
||||
memcpy(c.d.asBytes, data, blocksCount * blockBtWidth);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -501,7 +501,7 @@ int mfCSetUID(uint8_t *uid, uint8_t *atqa, uint8_t *sak, uint8_t *oldUID, uint8_
|
|||
|
||||
int mfCSetBlock(uint8_t blockNo, uint8_t *data, uint8_t *uid, uint8_t params) {
|
||||
|
||||
UsbCommand c = {CMD_MIFARE_CSETBLOCK, {params, blockNo, 0}};
|
||||
UsbCommand c = {CMD_MIFARE_CSETBLOCK, {params, blockNo, 0}, {{0}}};
|
||||
memcpy(c.d.asBytes, data, 16);
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -520,7 +520,7 @@ int mfCSetBlock(uint8_t blockNo, uint8_t *data, uint8_t *uid, uint8_t params) {
|
|||
}
|
||||
|
||||
int mfCGetBlock(uint8_t blockNo, uint8_t *data, uint8_t params) {
|
||||
UsbCommand c = {CMD_MIFARE_CGETBLOCK, {params, blockNo, 0}};
|
||||
UsbCommand c = {CMD_MIFARE_CGETBLOCK, {params, blockNo, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
@ -873,7 +873,7 @@ int detect_classic_prng(void) {
|
|||
uint8_t cmd[] = {MIFARE_AUTH_KEYA, 0x00};
|
||||
uint32_t flags = ISO14A_CONNECT | ISO14A_RAW | ISO14A_APPEND_CRC | ISO14A_NO_RATS;
|
||||
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {flags, sizeof(cmd), 0}};
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {flags, sizeof(cmd), 0}, {{0}}};
|
||||
memcpy(c.d.asBytes, cmd, sizeof(cmd));
|
||||
|
||||
clearCommandBuffer();
|
||||
|
@ -913,7 +913,7 @@ returns:
|
|||
*/
|
||||
int detect_classic_nackbug(bool verbose) {
|
||||
|
||||
UsbCommand c = {CMD_MIFARE_NACK_DETECT, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_MIFARE_NACK_DETECT, {0, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
@ -999,7 +999,7 @@ void detect_classic_magic(void) {
|
|||
|
||||
uint8_t isGeneration = 0;
|
||||
UsbCommand resp;
|
||||
UsbCommand c = {CMD_MIFARE_CIDENT, {0, 0, 0}};
|
||||
UsbCommand c = {CMD_MIFARE_CIDENT, {0, 0, 0}, {{0}}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 1500))
|
||||
|
|
|
@ -262,7 +262,7 @@ static int l_foobar(lua_State *L) {
|
|||
printf("Arguments discarded, stack now contains %d elements", lua_gettop(L));
|
||||
|
||||
// todo: this is not used, where was it intended for?
|
||||
// UsbCommand response = {CMD_MIFARE_READBL, {1337, 1338, 1339}};
|
||||
// UsbCommand response = {CMD_MIFARE_READBL, {1337, 1338, 1339}, {{0}}};
|
||||
|
||||
printf("Now returning a uint64_t as a string");
|
||||
uint64_t x = 0xDEADC0DE;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue