mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
make style
This commit is contained in:
parent
0fe80c4a2d
commit
011f973e7f
2 changed files with 136 additions and 161 deletions
|
@ -65,27 +65,23 @@ uint8_t treatPDOL(uint8_t* apdu){ //Generate GET PROCESSING
|
|||
ppdol[plen + 3] = 0x00;
|
||||
plen += 4;
|
||||
i += 2;
|
||||
}
|
||||
else if(apdu[i] == 0x9F && apdu[i+1] == 0x1A){ //Terminal Country Code
|
||||
} else if (apdu[i] == 0x9F && apdu[i + 1] == 0x1A) { //Terminal Country Code
|
||||
ppdol[plen] = 0x9F;
|
||||
ppdol[plen + 1] = 0x1A;
|
||||
plen += 2;
|
||||
i += 2;
|
||||
}
|
||||
else if(apdu[i] == 0x5F && apdu[i+1] == 0x2A){ //Transaction Currency Code
|
||||
} else if (apdu[i] == 0x5F && apdu[i + 1] == 0x2A) { //Transaction Currency Code
|
||||
ppdol[plen] = 0x5F;
|
||||
ppdol[plen + 1] = 0x2A;
|
||||
plen += 2;
|
||||
i += 2;
|
||||
}
|
||||
else if(apdu[i] == 0x9A){ //Transaction Date
|
||||
} else if (apdu[i] == 0x9A) { //Transaction Date
|
||||
ppdol[plen] = 0x9A;
|
||||
ppdol[plen + 1] = 0x9A;
|
||||
ppdol[plen + 2] = 0x9A;
|
||||
plen += 3;
|
||||
i += 1;
|
||||
}
|
||||
else if(apdu[i] == 0x95){ //Terminal Verification Results
|
||||
} else if (apdu[i] == 0x95) { //Terminal Verification Results
|
||||
ppdol[plen] = 0x95;
|
||||
ppdol[plen + 1] = 0x95;
|
||||
ppdol[plen + 2] = 0x95;
|
||||
|
@ -93,21 +89,18 @@ uint8_t treatPDOL(uint8_t* apdu){ //Generate GET PROCESSING
|
|||
ppdol[plen + 4] = 0x95;
|
||||
plen += 5;
|
||||
i += 1;
|
||||
}
|
||||
else if(apdu[i] == 0x9C){ //Transaction Type
|
||||
} else if (apdu[i] == 0x9C) { //Transaction Type
|
||||
ppdol[plen] = 0x9C;
|
||||
plen += 1;
|
||||
i += 1;
|
||||
}
|
||||
else if(apdu[i] == 0x9F && apdu[i+1] == 0x37){ //Unpredictable Number
|
||||
} else if (apdu[i] == 0x9F && apdu[i + 1] == 0x37) { //Unpredictable Number
|
||||
ppdol[plen] = 0x9F;
|
||||
ppdol[plen + 1] = 0x37;
|
||||
ppdol[plen + 2] = 0x9F;
|
||||
ppdol[plen + 3] = 0x37;
|
||||
plen += 4;
|
||||
i += 2;
|
||||
}
|
||||
else { //To the others, add "0" to complete the format depending on its range
|
||||
} else { //To the others, add "0" to complete the format depending on its range
|
||||
uint8_t u = apdu[i + 2];
|
||||
while (u > 0) {
|
||||
ppdol[plen] = 0;
|
||||
|
@ -215,8 +208,7 @@ void RunMod() {
|
|||
state = STATE_EMU;
|
||||
Dbprintf(_YELLOW_("[") "Initialized emulation mode " _YELLOW_("]"));
|
||||
DbpString("\n"_YELLOW_("!!") "Waiting for a card reader...");
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
DbpString(_YELLOW_("[") "Initialized reading mode " _YELLOW_("]"));
|
||||
DbpString("\n"_YELLOW_("!!") "Waiting for a Visa card...");
|
||||
}
|
||||
|
@ -237,11 +229,9 @@ void RunMod() {
|
|||
if (chktoken == true && token[0] != 0x00) { //Only change to emulation if it saved a track 2 in memory
|
||||
state = STATE_EMU;
|
||||
Dbprintf(_YELLOW_("[") "In emulation mode " _YELLOW_("]"));
|
||||
}
|
||||
else
|
||||
} else
|
||||
Dbprintf(_YELLOW_("!!") "Nothing in memory to emulate");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
state = STATE_READ;
|
||||
Dbprintf(_YELLOW_("[") "In reading mode " _YELLOW_("]"));
|
||||
}
|
||||
|
@ -284,8 +274,7 @@ void RunMod() {
|
|||
apdusLen[2] = plen;
|
||||
existpdol = true;
|
||||
}
|
||||
}
|
||||
else if (i == 3){
|
||||
} else if (i == 3) {
|
||||
if (apdubuffer[u] == 0x57 && apdubuffer[u + 1] == 0x13 && !chktoken) { //Find track 2
|
||||
chktoken = true;
|
||||
memcpy(&token, &apdubuffer[u + 2], 19);
|
||||
|
@ -298,8 +287,7 @@ void RunMod() {
|
|||
Dbprintf(_GREEN_("[") "Challenge generated " _GREEN_("]"));
|
||||
Dbhexdump(plen, existpdol ? ppdol : processing, false);
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
Dbprintf(_YELLOW_("!!") "Error reading the card");
|
||||
}
|
||||
LED_B_OFF();
|
||||
|
@ -317,8 +305,7 @@ void RunMod() {
|
|||
DbpString("\n"_YELLOW_("!!") "Waiting for a card reader...");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(state == STATE_EMU){
|
||||
} else if (state == STATE_EMU) {
|
||||
LED_A_OFF();
|
||||
LED_C_ON();
|
||||
|
||||
|
@ -363,29 +350,23 @@ void RunMod() {
|
|||
if (receivedCmd[0] == ISO14443A_CMD_REQA && len == 1) { // Received a REQUEST
|
||||
DbpString(_YELLOW_("+") "REQUEST Received");
|
||||
p_response = &responses[ATQA];
|
||||
}
|
||||
else if (receivedCmd[0] == ISO14443A_CMD_HALT && len == 4) { // Received a HALT
|
||||
} else if (receivedCmd[0] == ISO14443A_CMD_HALT && len == 4) { // Received a HALT
|
||||
DbpString(_YELLOW_("+") "Received a HALT");
|
||||
p_response = NULL;
|
||||
}
|
||||
else if (receivedCmd[0] == ISO14443A_CMD_WUPA && len == 1) { // Received a WAKEUP //Este!!
|
||||
} else if (receivedCmd[0] == ISO14443A_CMD_WUPA && len == 1) { // Received a WAKEUP //Este!!
|
||||
DbpString(_YELLOW_("+") "WAKEUP Received");
|
||||
p_response = &responses[ATQA];
|
||||
prevCmd = 0;
|
||||
}
|
||||
else if (receivedCmd[1] == 0x20 && receivedCmd[0] == ISO14443A_CMD_ANTICOLL_OR_SELECT && len == 2) { // Received request for UID (cascade 1)
|
||||
} else if (receivedCmd[1] == 0x20 && receivedCmd[0] == ISO14443A_CMD_ANTICOLL_OR_SELECT && len == 2) { // Received request for UID (cascade 1)
|
||||
DbpString(_YELLOW_("+") "Request for UID C1");
|
||||
p_response = &responses[UIDC1];
|
||||
}
|
||||
else if (receivedCmd[1] == 0x70 && receivedCmd[0] == ISO14443A_CMD_ANTICOLL_OR_SELECT && len == 9) { // Received a SELECT (cascade 1)
|
||||
} else if (receivedCmd[1] == 0x70 && receivedCmd[0] == ISO14443A_CMD_ANTICOLL_OR_SELECT && len == 9) { // Received a SELECT (cascade 1)
|
||||
DbpString(_YELLOW_("+") "Request for SELECT S1");
|
||||
p_response = &responses[SAKC1];
|
||||
}
|
||||
else if (receivedCmd[0] == ISO14443A_CMD_RATS && len == 4) { // Received a RATS request
|
||||
} else if (receivedCmd[0] == ISO14443A_CMD_RATS && len == 4) { // Received a RATS request
|
||||
DbpString(_YELLOW_("+") "Request for RATS");
|
||||
p_response = &responses[RATS];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Dbprintf(_YELLOW_("[") "Card reader command " _YELLOW_("]"));
|
||||
Dbhexdump(len, receivedCmd, false);
|
||||
|
||||
|
@ -411,37 +392,31 @@ void RunMod() {
|
|||
memcpy(&dynamic_response_info.response[1], ppsea, sizeof(ppsea));
|
||||
dynamic_response_info.response_n = sizeof(ppsea) + 1;
|
||||
prevCmd++;
|
||||
}
|
||||
else if(receivedCmd[2] == 0xA4 && receivedCmd[10] == 0x03 && receivedCmd[11] == 0x10 && prevCmd == 1){ //Respond Visa AID
|
||||
} else if (receivedCmd[2] == 0xA4 && receivedCmd[10] == 0x03 && receivedCmd[11] == 0x10 && prevCmd == 1) { //Respond Visa AID
|
||||
memcpy(&dynamic_response_info.response[1], visauid, sizeof(visauid));
|
||||
dynamic_response_info.response_n = sizeof(visauid) + 1;
|
||||
prevCmd++;
|
||||
}
|
||||
else if(receivedCmd[1] == 0x80 && receivedCmd[2] == 0xA8 && receivedCmd[6] == 0x83 && prevCmd == 2){ //GET PROCESSING
|
||||
} else if (receivedCmd[1] == 0x80 && receivedCmd[2] == 0xA8 && receivedCmd[6] == 0x83 && prevCmd == 2) { //GET PROCESSING
|
||||
memcpy(&dynamic_response_info.response[1], processing, sizeof(processing));
|
||||
dynamic_response_info.response_n = sizeof(processing) + 1;
|
||||
prevCmd++;
|
||||
}
|
||||
else if(receivedCmd[1] == 0x00 && receivedCmd[2] == 0xB2 && prevCmd == 3){ //SFI
|
||||
} else if (receivedCmd[1] == 0x00 && receivedCmd[2] == 0xB2 && prevCmd == 3) { //SFI
|
||||
memcpy(&dynamic_response_info.response[1], card, sizeof(card));
|
||||
dynamic_response_info.response_n = sizeof(card) + 1;
|
||||
prevCmd++;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
memcpy(&dynamic_response_info.response[1], finished, sizeof(finished));
|
||||
dynamic_response_info.response_n = sizeof(finished) + 1;
|
||||
if (prevCmd == 5) {
|
||||
prevCmd = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Dbprintf(_YELLOW_("!!") "Received unknown command!");
|
||||
if (prevCmd < 4) {
|
||||
memcpy(dynamic_response_info.response, receivedCmd, len);
|
||||
dynamic_response_info.response_n = len;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
dynamic_response_info.response_n = 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue