run make style
This commit is contained in:
8 files changed
+79
-62
No files matched your search
+50
-50
@@ -1205,21 +1205,21 @@ static void atsToEmulatedAtr(uint8_t *ats, uint8_t *atr, int *atrLen) {
|
||||
}
|
||||
|
||||
static void atqbToEmulatedAtr(uint8_t *atqb, uint8_t cid, uint8_t *atr, int *atrLen) {
|
||||
atr[0] = 0x3B;
|
||||
atr[1] = 0x80 | 8;
|
||||
atr[2] = 0x80;
|
||||
atr[3] = 0x01;
|
||||
atr[0] = 0x3B;
|
||||
atr[1] = 0x80 | 8;
|
||||
atr[2] = 0x80;
|
||||
atr[3] = 0x01;
|
||||
|
||||
memcpy(atr + 4, atqb, 7);
|
||||
atr[11] = cid >> 4;
|
||||
memcpy(atr + 4, atqb, 7);
|
||||
atr[11] = cid >> 4;
|
||||
|
||||
uint8_t tck = 0;
|
||||
for (int i = 1; i < 12; ++i) {
|
||||
tck = tck ^ atr[i];
|
||||
}
|
||||
atr[12] = tck;
|
||||
uint8_t tck = 0;
|
||||
for (int i = 1; i < 12; ++i) {
|
||||
tck = tck ^ atr[i];
|
||||
}
|
||||
atr[12] = tck;
|
||||
|
||||
*atrLen = 13;
|
||||
*atrLen = 13;
|
||||
}
|
||||
|
||||
static int CmdRelay(const char *Cmd) {
|
||||
@@ -1263,9 +1263,9 @@ static int CmdRelay(const char *Cmd) {
|
||||
|
||||
uint8_t cmdbuf[512] = {0};
|
||||
iso14a_card_select_t selectedCard14a;
|
||||
iso14b_card_select_t selectedCard14b;
|
||||
isodep_state_t cardType = ISODEP_INACTIVE;
|
||||
bool fieldActivated = false;
|
||||
iso14b_card_select_t selectedCard14b;
|
||||
isodep_state_t cardType = ISODEP_INACTIVE;
|
||||
bool fieldActivated = false;
|
||||
|
||||
do {
|
||||
if (cardType != ISODEP_INACTIVE) {
|
||||
@@ -1280,11 +1280,11 @@ static int CmdRelay(const char *Cmd) {
|
||||
uint8_t atr[20] = {0};
|
||||
int atrLen = 0;
|
||||
|
||||
if (cardType == ISODEP_NFCA) {
|
||||
atsToEmulatedAtr(selectedCard14a.ats, atr, &atrLen);
|
||||
} else if (cardType == ISODEP_NFCB) {
|
||||
atqbToEmulatedAtr(selectedCard14b.atqb, selectedCard14b.cid, atr, &atrLen);
|
||||
}
|
||||
if (cardType == ISODEP_NFCA) {
|
||||
atsToEmulatedAtr(selectedCard14a.ats, atr, &atrLen);
|
||||
} else if (cardType == ISODEP_NFCB) {
|
||||
atqbToEmulatedAtr(selectedCard14b.atqb, selectedCard14b.cid, atr, &atrLen);
|
||||
}
|
||||
|
||||
uint8_t res[22] = {0};
|
||||
res[1] = atrLen;
|
||||
@@ -1300,21 +1300,21 @@ static int CmdRelay(const char *Cmd) {
|
||||
PrintAndLogEx(INFO, ">> %s", sprint_hex(cmdbuf + 2, apduLen));
|
||||
}
|
||||
|
||||
if (cardType == ISODEP_NFCA) {
|
||||
if (ExchangeAPDU14a(cmdbuf + 2, apduLen, !fieldActivated, true, apduRes, sizeof(apduRes), &apduResLen) != PM3_SUCCESS) {
|
||||
cardType = ISODEP_INACTIVE;
|
||||
mbedtls_net_close(&netCtx);
|
||||
continue;
|
||||
}
|
||||
} else if (cardType == ISODEP_NFCB) {
|
||||
if (exchange_14b_apdu(cmdbuf + 2, apduLen, !fieldActivated, true, apduRes, sizeof(apduRes), &apduResLen, 0)) {
|
||||
cardType = ISODEP_INACTIVE;
|
||||
mbedtls_net_close(&netCtx);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (cardType == ISODEP_NFCA) {
|
||||
if (ExchangeAPDU14a(cmdbuf + 2, apduLen, !fieldActivated, true, apduRes, sizeof(apduRes), &apduResLen) != PM3_SUCCESS) {
|
||||
cardType = ISODEP_INACTIVE;
|
||||
mbedtls_net_close(&netCtx);
|
||||
continue;
|
||||
}
|
||||
} else if (cardType == ISODEP_NFCB) {
|
||||
if (exchange_14b_apdu(cmdbuf + 2, apduLen, !fieldActivated, true, apduRes, sizeof(apduRes), &apduResLen, 0)) {
|
||||
cardType = ISODEP_INACTIVE;
|
||||
mbedtls_net_close(&netCtx);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
fieldActivated = true;
|
||||
fieldActivated = true;
|
||||
|
||||
if (verbose) {
|
||||
PrintAndLogEx(INFO, "<< %s", sprint_hex(apduRes, apduResLen));
|
||||
@@ -1328,22 +1328,22 @@ static int CmdRelay(const char *Cmd) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (IfPm3Iso14443a() && SelectCard14443A_4(false, false, &selectedCard14a) == PM3_SUCCESS) {
|
||||
cardType = ISODEP_NFCA;
|
||||
} else if (IfPm3Iso14443b() && select_card_14443b_4(false, &selectedCard14b) == PM3_SUCCESS) {
|
||||
cardType = ISODEP_NFCB;
|
||||
}
|
||||
if (cardType != ISODEP_INACTIVE) {
|
||||
fieldActivated = false;
|
||||
if (mbedtls_net_connect(&netCtx, (char *) host, (char *) port, MBEDTLS_NET_PROTO_TCP)) {
|
||||
PrintAndLogEx(FAILED, "Failed to connect to vpcd socket. Ensure you have vpcd installed and running");
|
||||
mbedtls_net_close(&netCtx);
|
||||
mbedtls_net_free(&netCtx);
|
||||
DropField();
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
}
|
||||
msleep(300);
|
||||
if (IfPm3Iso14443a() && SelectCard14443A_4(false, false, &selectedCard14a) == PM3_SUCCESS) {
|
||||
cardType = ISODEP_NFCA;
|
||||
} else if (IfPm3Iso14443b() && select_card_14443b_4(false, &selectedCard14b) == PM3_SUCCESS) {
|
||||
cardType = ISODEP_NFCB;
|
||||
}
|
||||
if (cardType != ISODEP_INACTIVE) {
|
||||
fieldActivated = false;
|
||||
if (mbedtls_net_connect(&netCtx, (char *) host, (char *) port, MBEDTLS_NET_PROTO_TCP)) {
|
||||
PrintAndLogEx(FAILED, "Failed to connect to vpcd socket. Ensure you have vpcd installed and running");
|
||||
mbedtls_net_close(&netCtx);
|
||||
mbedtls_net_free(&netCtx);
|
||||
DropField();
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
}
|
||||
msleep(300);
|
||||
}
|
||||
} while (!kbd_enter_pressed());
|
||||
|
||||
|
||||
Reference in new issue
Block a user