]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/mifarecmd.c
Attempt to use raw writing capabilities via scripting engine. Not functional yet
[proxmark3-svn] / armsrc / mifarecmd.c
index e7850b3f2c316bd07d4380cd6152518da935467c..a0e0b01f967c4f127fd796ca5ea80e813834dce5 100644 (file)
@@ -82,7 +82,7 @@ void MifareReadBlock(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
 //     memcpy(ack.d.asBytes, dataoutbuf, 16);\r
        \r
        LED_B_ON();\r
 //     memcpy(ack.d.asBytes, dataoutbuf, 16);\r
        \r
        LED_B_ON();\r
-  cmd_send(CMD_ACK,isOK,0,0,0,0);\r
+  cmd_send(CMD_ACK,isOK,0,0,dataoutbuf,16);\r
 //     UsbSendPacket((uint8_t *)&ack, sizeof(UsbCommand));\r
        LED_B_OFF();\r
 \r
 //     UsbSendPacket((uint8_t *)&ack, sizeof(UsbCommand));\r
        LED_B_OFF();\r
 \r
@@ -801,7 +801,7 @@ void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai
        \r
                // reset chip\r
                if (needWipe){\r
        \r
                // reset chip\r
                if (needWipe){\r
-                       ReaderTransmitShort(wupC1);\r
+      ReaderTransmitBitsPar(wupC1,7,0);\r
                        if(!ReaderReceive(receivedAnswer) || (receivedAnswer[0] != 0x0a)) {\r
                                if (MF_DBGLEVEL >= 1)   Dbprintf("wupC1 error");\r
                                break;\r
                        if(!ReaderReceive(receivedAnswer) || (receivedAnswer[0] != 0x0a)) {\r
                                if (MF_DBGLEVEL >= 1)   Dbprintf("wupC1 error");\r
                                break;\r
@@ -821,7 +821,7 @@ void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai
 \r
                // write block\r
                if (workFlags & 0x02) {\r
 \r
                // write block\r
                if (workFlags & 0x02) {\r
-                       ReaderTransmitShort(wupC1);\r
+      ReaderTransmitBitsPar(wupC1,7,0);\r
                        if(!ReaderReceive(receivedAnswer) || (receivedAnswer[0] != 0x0a)) {\r
                                if (MF_DBGLEVEL >= 1)   Dbprintf("wupC1 error");\r
                                break;\r
                        if(!ReaderReceive(receivedAnswer) || (receivedAnswer[0] != 0x0a)) {\r
                                if (MF_DBGLEVEL >= 1)   Dbprintf("wupC1 error");\r
                                break;\r
@@ -863,8 +863,14 @@ void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai
 //     if (isOK) memcpy(ack.d.asBytes, uid, 4);\r
        \r
        // add trace trailer\r
 //     if (isOK) memcpy(ack.d.asBytes, uid, 4);\r
        \r
        // add trace trailer\r
-       memset(uid, 0x44, 4);\r
-       LogTrace(uid, 4, 0, 0, TRUE);\r
+       /**\r
+       *       Removed by Martin, the uid is overwritten with 0x44, \r
+       *       which can 't be intended. \r
+       *\r
+       *       memset(uid, 0x44, 4);\r
+       *       LogTrace(uid, 4, 0, 0, TRUE);\r
+       **/\r
+       \r
 \r
        LED_B_ON();\r
   cmd_send(CMD_ACK,isOK,0,0,uid,4);\r
 \r
        LED_B_ON();\r
   cmd_send(CMD_ACK,isOK,0,0,uid,4);\r
@@ -919,7 +925,7 @@ void MifareCGetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai
 \r
        while (true) {\r
                if (workFlags & 0x02) {\r
 \r
        while (true) {\r
                if (workFlags & 0x02) {\r
-                       ReaderTransmitShort(wupC1);\r
+      ReaderTransmitBitsPar(wupC1,7,0);\r
                        if(!ReaderReceive(receivedAnswer) || (receivedAnswer[0] != 0x0a)) {\r
                                if (MF_DBGLEVEL >= 1)   Dbprintf("wupC1 error");\r
                                break;\r
                        if(!ReaderReceive(receivedAnswer) || (receivedAnswer[0] != 0x0a)) {\r
                                if (MF_DBGLEVEL >= 1)   Dbprintf("wupC1 error");\r
                                break;\r
@@ -954,9 +960,13 @@ void MifareCGetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai
 //     if (isOK) memcpy(ack.d.asBytes, data, 18);\r
        \r
        // add trace trailer\r
 //     if (isOK) memcpy(ack.d.asBytes, data, 18);\r
        \r
        // add trace trailer\r
-       memset(data, 0x44, 4);\r
-       LogTrace(data, 4, 0, 0, TRUE);\r
-\r
+       /*\r
+       * Removed by Martin, this piece of overwrites the 'data' variable \r
+       * which is sent two lines down, and is obviously not correct. \r
+       * \r
+       * memset(data, 0x44, 4);\r
+       * LogTrace(data, 4, 0, 0, TRUE);\r
+       */\r
        LED_B_ON();\r
   cmd_send(CMD_ACK,isOK,0,0,data,18);\r
 //     UsbSendPacket((uint8_t *)&ack, sizeof(UsbCommand));\r
        LED_B_ON();\r
   cmd_send(CMD_ACK,isOK,0,0,data,18);\r
 //     UsbSendPacket((uint8_t *)&ack, sizeof(UsbCommand));\r
Impressum, Datenschutz