]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/appmain.c
Merge pull request #90 from 4m4rOk/master
[proxmark3-svn] / armsrc / appmain.c
index 3eac2580d4d43b1455150b1b89f62272d8c72d68..ee6ab7fbb6fbde98f662446a81a54b5df8b2a097 100644 (file)
@@ -9,6 +9,7 @@
 // The main application code. This is the first thing called after start.c
 // executes.
 //-----------------------------------------------------------------------------
+#include <stdarg.h>
 #include "usb_cdc.h"
 #include "proxmark3.h"
 #include "apps.h"
@@ -596,21 +597,25 @@ void StandAloneMode14a()
                                                        Dbprintf("Simulating ISO14443a tag with uid: %08x [Bank: %u]", tmpuid & 0xFFFFFFFF , selected);
                                                }
                                                
-                                               if (uids[selected].sak == 8 && uids[selected].atqa[0] == 4 && uids[selected].atqa[1] == 0) {
-                                                       DbpString("Mifare Classic");
-                                                       SimulateIso14443aTag(1, flags, data); // Mifare Classic
-                                               }
-                                               else if (uids[selected].sak == 0 && uids[selected].atqa[0] == 0x44 && uids[selected].atqa[1] == 0) {
+                                               if (uids[selected].sak == 0x08 && uids[selected].atqa[0] == 0x04 && uids[selected].atqa[1] == 0) {
+                                                       DbpString("Mifare Classic 1k");
+                                                       SimulateIso14443aTag(1, flags, data);
+                                               } else if (uids[selected].sak == 0x18 && uids[selected].atqa[0] == 0x02 && uids[selected].atqa[1] == 0) {
+                                                       DbpString("Mifare Classic 4k (4b uid)");
+                                                       SimulateIso14443aTag(8, flags, data);
+                                               } else if (uids[selected].sak == 0x08 && uids[selected].atqa[0] == 0x44 && uids[selected].atqa[1] == 0) {
+                                                       DbpString("Mifare Classic 4k (7b uid)");
+                                                       SimulateIso14443aTag(8, flags, data);
+                                               } else if (uids[selected].sak == 0x00 && uids[selected].atqa[0] == 0x44 && uids[selected].atqa[1] == 0) {
                                                        DbpString("Mifare Ultralight");
-                                                       SimulateIso14443aTag(2, flags, data); // Mifare Ultralight
-                                               }
-                                               else if (uids[selected].sak == 20 && uids[selected].atqa[0] == 0x44 && uids[selected].atqa[1] == 3) {
+                                                       SimulateIso14443aTag(2, flags, data);
+                                               } else if (uids[selected].sak == 0x20 && uids[selected].atqa[0] == 0x04 && uids[selected].atqa[1] == 0x03) {
                                                        DbpString("Mifare DESFire");
-                                                       SimulateIso14443aTag(3, flags, data); // Mifare DESFire
+                                                       SimulateIso14443aTag(3, flags, data);
                                                }
                                                else {
                                                        Dbprintf("Unrecognized tag type -- defaulting to Mifare Classic emulation");
-                                                       SimulateIso14443aTag(1, flags, data); // Mifare Classic
+                                                       SimulateIso14443aTag(1, flags, data);
                                                }
                                        }
                                        else if (button_action == BUTTON_SINGLE_CLICK) {
@@ -1001,10 +1006,10 @@ void UsbPacketReceived(uint8_t *packet, int len)
                        WritePCF7931(c->d.asBytes[0],c->d.asBytes[1],c->d.asBytes[2],c->d.asBytes[3],c->d.asBytes[4],c->d.asBytes[5],c->d.asBytes[6], c->d.asBytes[9], c->d.asBytes[7]-128,c->d.asBytes[8]-128, c->arg[0], c->arg[1], c->arg[2]);
                        break;
                case CMD_EM4X_READ_WORD:
-                       EM4xReadWord(c->arg[1], c->arg[2],c->d.asBytes[0]);
+                       EM4xReadWord(c->arg[0], c->arg[1], c->arg[2]);
                        break;
                case CMD_EM4X_WRITE_WORD:
-                       EM4xWriteWord(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes[0]);
+                       EM4xWriteWord(c->arg[0], c->arg[1], c->arg[2]);
                        break;
                case CMD_AWID_DEMOD_FSK: // Set realtime AWID demodulation
                        CmdAWIDdemodFSK(c->arg[0], 0, 0, 1);
@@ -1013,7 +1018,7 @@ void UsbPacketReceived(uint8_t *packet, int len)
                        CopyVikingtoT55xx(c->arg[0], c->arg[1], c->arg[2]);
             break;
                case CMD_COTAG:
-                       Cotag();
+                       Cotag(c->arg[0]);
                        break;
 #endif
 
@@ -1191,6 +1196,10 @@ void UsbPacketReceived(uint8_t *packet, int len)
                        SniffMifare(c->arg[0]);
                        break;
 
+               case CMD_MIFARE_SETMOD:
+                       MifareSetMod(c->arg[0], c->d.asBytes);
+                       break;
+
                //mifare desfire
                case CMD_MIFARE_DESFIRE_READBL: break;
                case CMD_MIFARE_DESFIRE_WRITEBL: break;
@@ -1224,6 +1233,24 @@ void UsbPacketReceived(uint8_t *packet, int len)
             break;
         case CMD_EMV_DUMP_CARD:
             EMVdumpcard();
+                       break;
+/*                     
+       case CMD_EMV_READ_RECORD:
+            EMVReadRecord(c->arg[0], c->arg[1], NULL);
+            break; 
+        case CMD_EMV_CLONE:
+            EMVClone(c->arg[0], c->arg[1]);
+            break;
+       case CMD_EMV_SIM:
+            EMVSim();
+            break;
+        case CMD_EMV_TEST:
+            EMVTest();
+            break;
+        case CMD_EMV_FUZZ_RATS:
+            EMVFuzz_RATS(c->arg[0],c->d.asBytes);
+            break;
+                       */
 #endif
 #ifdef WITH_ICLASS
                // Makes use of ISO14443a FPGA Firmware
@@ -1298,7 +1325,7 @@ void UsbPacketReceived(uint8_t *packet, int len)
                        // arg0 = startindex
                        // arg1 = length bytes to transfer
                        // arg2 = RFU
-                       //Dbprintf("transfer to client parameters: %llu | %llu | %llu", c->arg[0], c->arg[1], c->arg[2]);
+                       //Dbprintf("transfer to client parameters: %" PRIu64 " | %" PRIu64 " | %" PRIu64, c->arg[0], c->arg[1], c->arg[2]);
                        
                        for(size_t i = 0; i < c->arg[1]; i += USB_CMD_DATA_SIZE) {
                                len = MIN( (c->arg[1] - i), USB_CMD_DATA_SIZE);
Impressum, Datenschutz