mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
make style
This commit is contained in:
parent
7278310e27
commit
777cb5a8ce
23 changed files with 184 additions and 181 deletions
|
@ -26,7 +26,7 @@ void ModInfo(void) {
|
|||
|
||||
/* This standalone implements four different modes: reading, simulating, dumping, & emulating.
|
||||
*
|
||||
* The initial mode is reading with LEDs A & D.
|
||||
* The initial mode is reading with LEDs A & D.
|
||||
* In this mode, the Proxmark is looking for an ST25TA card like those used by the IKEA Rothult,
|
||||
* it will act as reader, and store the UID for simulation.
|
||||
*
|
||||
|
@ -37,8 +37,8 @@ void ModInfo(void) {
|
|||
* Once it gets the key, it will switch to dump mode (LEDs C & D) automatically. During this mode the Proxmark
|
||||
* will act as a reader once again, but now we know the Read Protection key to authenticate to the card to dump
|
||||
* it's contents so we can achieve full emulation.
|
||||
*
|
||||
* Once it dumps the contents of the card, it will switch to emulation mode (LED C) automatically.
|
||||
*
|
||||
* Once it dumps the contents of the card, it will switch to emulation mode (LED C) automatically.
|
||||
* During this mode the Proxmark should function as the original ST25TA IKEA Rothult Master Key
|
||||
*
|
||||
* Keep pressing the button down will quit the standalone cycle.
|
||||
|
@ -68,13 +68,13 @@ void RunMod(void) {
|
|||
// APDUs necessary to dump NDEF
|
||||
// ----------------------------
|
||||
// Select NDEF Application
|
||||
uint8_t ndef_app[13] = {0x00, 0xa4, 0x04, 0x00, 0x07, 0xd2, 0x76, 0x00, 0x00, 0x85, 0x01, 0x01, 0x00};
|
||||
uint8_t ndef_app[13] = {0x00, 0xa4, 0x04, 0x00, 0x07, 0xd2, 0x76, 0x00, 0x00, 0x85, 0x01, 0x01, 0x00};
|
||||
// Select NDEF File
|
||||
uint8_t ndef_sel[7] = {0x00, 0xa4, 0x00, 0x0c, 0x02, 0x00, 0x01};
|
||||
uint8_t ndef_sel[7] = {0x00, 0xa4, 0x00, 0x0c, 0x02, 0x00, 0x01};
|
||||
// Read verification without password
|
||||
uint8_t verify[5] = {0x00, 0x20, 0x00, 0x01, 0x00};
|
||||
uint8_t verify[5] = {0x00, 0x20, 0x00, 0x01, 0x00};
|
||||
// Read verification with password
|
||||
uint8_t verify_pwd[21] = {0x00, 0x20, 0x00, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
uint8_t verify_pwd[21] = {0x00, 0x20, 0x00, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
// Read NDEF file contents
|
||||
uint8_t ndef_read[5] = {0x00, 0xb0, 0x00, 0x00, 0x1d};
|
||||
|
||||
|
@ -173,12 +173,12 @@ void RunMod(void) {
|
|||
DbpString(_YELLOW_("+") "Found ISO 14443 Type A!");
|
||||
|
||||
if (card_a_info.sak == SAK && card_a_info.atqa[0] == ATQA0 && card_a_info.atqa[1] == ATQA1 && card_a_info.uidlen == 7) {
|
||||
DbpString(_YELLOW_("+") "Found ST25TA with UID: ");
|
||||
Dbhexdump(card_a_info.uidlen, card_a_info.uid, 0);
|
||||
memcpy(stuid, card_a_info.uid, card_a_info.uidlen);
|
||||
state = STATE_SIM;
|
||||
DbpString(_YELLOW_("+") "Found ST25TA with UID: ");
|
||||
Dbhexdump(card_a_info.uidlen, card_a_info.uid, 0);
|
||||
memcpy(stuid, card_a_info.uid, card_a_info.uidlen);
|
||||
state = STATE_SIM;
|
||||
} else {
|
||||
DbpString("Found non-ST25TA card, ignoring.");
|
||||
DbpString("Found non-ST25TA card, ignoring.");
|
||||
}
|
||||
}
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
|
@ -235,7 +235,7 @@ void RunMod(void) {
|
|||
p_response = &responses[ATQA];
|
||||
} else if (receivedCmd[0] == ISO14443A_CMD_HALT && len == 4) { // Received a HALT
|
||||
p_response = NULL;
|
||||
} else if (receivedCmd[0] == ISO14443A_CMD_WUPA && len == 1) { // Received a WAKEUP
|
||||
} else if (receivedCmd[0] == ISO14443A_CMD_WUPA && len == 1) { // Received a WAKEUP
|
||||
p_response = &responses[ATQA];
|
||||
} else if (receivedCmd[1] == 0x20 && receivedCmd[0] == ISO14443A_CMD_ANTICOLL_OR_SELECT && len == 2) { // Received request for UID (cascade 1)
|
||||
p_response = &responses[UIDC1];
|
||||
|
@ -337,7 +337,7 @@ void RunMod(void) {
|
|||
Dbhexdump(apdulen - 2, apdubuffer, false);
|
||||
DbpString("----");
|
||||
|
||||
|
||||
|
||||
if (i == 4) {
|
||||
if (apdubuffer[1] == 0x1b && apdubuffer[2] == 0xd1 && !gotndef) { //Get NDEF Data
|
||||
gotndef = true;
|
||||
|
@ -345,7 +345,7 @@ void RunMod(void) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
DbpString(_YELLOW_("!!") "Error reading the card");
|
||||
}
|
||||
|
@ -416,7 +416,7 @@ void RunMod(void) {
|
|||
p_response = &responses[ATQA];
|
||||
} else if (receivedCmd[0] == ISO14443A_CMD_HALT && len == 4) { // Received a HALT
|
||||
p_response = NULL;
|
||||
} else if (receivedCmd[0] == ISO14443A_CMD_WUPA && len == 1) { // Received a WAKEUP
|
||||
} else if (receivedCmd[0] == ISO14443A_CMD_WUPA && len == 1) { // Received a WAKEUP
|
||||
p_response = &responses[ATQA];
|
||||
} else if (receivedCmd[1] == 0x20 && receivedCmd[0] == ISO14443A_CMD_ANTICOLL_OR_SELECT && len == 2) { // Received request for UID (cascade 1)
|
||||
p_response = &responses[UIDC1];
|
||||
|
|
|
@ -1644,7 +1644,7 @@ static void PacketReceived(PacketCommandNG *packet) {
|
|||
struct p *payload = (struct p *)packet->data.asBytes;
|
||||
uint8_t *mem = BigBuf_get_addr();
|
||||
memcpy(mem + payload->idx, payload->data, payload->bytes_in_packet);
|
||||
|
||||
|
||||
uint8_t a = 0, b = 0;
|
||||
compute_crc(CRC_14443_A, mem + payload->idx, payload->bytes_in_packet, &a, &b);
|
||||
int res = PM3_SUCCESS;
|
||||
|
@ -1662,14 +1662,14 @@ static void PacketReceived(PacketCommandNG *packet) {
|
|||
} PACKED;
|
||||
struct p *payload = (struct p *)packet->data.asBytes;
|
||||
|
||||
uint8_t *fwdata = BigBuf_get_addr();
|
||||
uint8_t *fwdata = BigBuf_get_addr();
|
||||
uint8_t a = 0, b = 0;
|
||||
compute_crc(CRC_14443_A, fwdata, payload->fw_size, &a, &b);
|
||||
|
||||
if (payload->crc != (a << 8 | b)) {
|
||||
Dbprintf("CRC Failed, 0x[%04x] != 0x[%02x%02x]", payload->crc, a, b);
|
||||
reply_ng(CMD_SMART_UPGRADE, PM3_ESOFT, NULL, 0);
|
||||
} else {
|
||||
} else {
|
||||
SmartCardUpgrade(payload->fw_size);
|
||||
}
|
||||
fwdata = NULL;
|
||||
|
|
|
@ -670,7 +670,7 @@ bool GetATR(smart_card_atr_t *card_ptr, bool verbose) {
|
|||
// 1byte = 1ms , max frame 256bytes. Should wait 256ms atleast just in case.
|
||||
if (I2C_WaitForSim() == false)
|
||||
return false;
|
||||
|
||||
|
||||
// read bytes from module
|
||||
uint8_t len = sizeof(card_ptr->atr);
|
||||
if (sc_rx_bytes(card_ptr->atr, &len) == false)
|
||||
|
@ -713,8 +713,8 @@ void SmartCardAtr(void) {
|
|||
set_tracing(true);
|
||||
I2C_Reset_EnterMainProgram();
|
||||
smart_card_atr_t card;
|
||||
int res = GetATR(&card, true) ? PM3_SUCCESS : PM3_ETIMEOUT;
|
||||
reply_ng(CMD_SMART_ATR, res, (uint8_t*)&card, sizeof(smart_card_atr_t));
|
||||
int res = GetATR(&card, true) ? PM3_SUCCESS : PM3_ETIMEOUT;
|
||||
reply_ng(CMD_SMART_ATR, res, (uint8_t *)&card, sizeof(smart_card_atr_t));
|
||||
set_tracing(false);
|
||||
LEDsoff();
|
||||
}
|
||||
|
@ -827,7 +827,7 @@ void SmartCardUpgrade(uint64_t arg0) {
|
|||
length -= size;
|
||||
pos += size;
|
||||
}
|
||||
|
||||
|
||||
reply_ng(CMD_SMART_UPGRADE, (isOK) ? PM3_SUCCESS : PM3_ESOFT, NULL, 0);
|
||||
LED_C_OFF();
|
||||
BigBuf_free();
|
||||
|
|
|
@ -1633,7 +1633,7 @@ void SimulateIso14443aTag(uint8_t tagType, uint8_t flags, uint8_t *data) {
|
|||
dynamic_response_info.response[0] = receivedCmd[0];
|
||||
dynamic_response_info.response[1] = 0x90;
|
||||
dynamic_response_info.response[2] = 0x00;
|
||||
dynamic_response_info.response_n = 3;
|
||||
dynamic_response_info.response_n = 3;
|
||||
} else {
|
||||
dynamic_response_info.response[0] = receivedCmd[0];
|
||||
dynamic_response_info.response[1] = 0x90;
|
||||
|
@ -2337,7 +2337,7 @@ void iso14443a_antifuzz(uint32_t flags) {
|
|||
uint8_t *received = BigBuf_malloc(MAX_FRAME_SIZE);
|
||||
uint8_t *receivedPar = BigBuf_malloc(MAX_PARITY_SIZE);
|
||||
uint8_t *resp = BigBuf_malloc(20);
|
||||
|
||||
|
||||
memset(received, 0x00, MAX_FRAME_SIZE);
|
||||
memset(received, 0x00, MAX_PARITY_SIZE);
|
||||
memset(resp, 0xFF, 20);
|
||||
|
|
|
@ -1541,7 +1541,7 @@ void iso14443b_setup(void) {
|
|||
// I tried to be systematic and check every answer of the tag, every CRC, etc...
|
||||
//-----------------------------------------------------------------------------
|
||||
static int read_srx_block(uint8_t blocknr, uint8_t *block) {
|
||||
|
||||
|
||||
uint8_t cmd[] = {ISO14443B_READ_BLK, blocknr, 0x00, 0x00};
|
||||
AddCrc14B(cmd, 2);
|
||||
|
||||
|
@ -1572,10 +1572,10 @@ static int read_srx_block(uint8_t blocknr, uint8_t *block) {
|
|||
|
||||
if (DBGLEVEL >= DBG_DEBUG) {
|
||||
Dbprintf("Address=%02x, Contents=%08x, CRC=%04x",
|
||||
blocknr,
|
||||
(r_block[3] << 24) + (r_block[2] << 16) + (r_block[1] << 8) + r_block[0],
|
||||
(r_block[4] << 8) + r_block[5]
|
||||
);
|
||||
blocknr,
|
||||
(r_block[3] << 24) + (r_block[2] << 16) + (r_block[1] << 8) + r_block[0],
|
||||
(r_block[4] << 8) + r_block[5]
|
||||
);
|
||||
}
|
||||
|
||||
return PM3_SUCCESS;
|
||||
|
@ -1586,7 +1586,7 @@ void ReadSTBlock(uint8_t blocknr) {
|
|||
iso14b_card_select_t card;
|
||||
int res = iso14443b_select_srx_card(&card);
|
||||
// 0: OK -1 wrong len, -2: attrib fail, -3:crc fail,
|
||||
switch(res) {
|
||||
switch (res) {
|
||||
case -1:
|
||||
case -3: {
|
||||
reply_ng(CMD_HF_SRI_READ, PM3_EWRONGANSWER, NULL, 0);
|
||||
|
|
|
@ -2283,7 +2283,7 @@ void MifareCIdent(bool is_mfc) {
|
|||
|
||||
ReaderTransmit(rats, sizeof(rats), NULL);
|
||||
res = ReaderReceive(buf, par);
|
||||
if (res ) {
|
||||
if (res) {
|
||||
|
||||
// test for some MFC gen2
|
||||
if (memcmp(buf, "\x09\x78\x00\x91\x02\xDA\xBC\x19\x10\xF0\x05", 11) == 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue