]> cvs.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/mifaresniff.c
Made script-based default key check a bit more intelligent, so it works not only...
[proxmark3-svn] / armsrc / mifaresniff.c
index aefe6962483315c992c5a61682f29024083e2a42..f95ca3dfc5e0f919a325be7bcc2e4adde3bf2d24 100644 (file)
@@ -31,18 +31,19 @@ int MfSniffInit(void){
 }\r
 \r
 int MfSniffEnd(void){\r
 }\r
 \r
 int MfSniffEnd(void){\r
-       UsbCommand ack = {CMD_ACK, {0, 0, 0}};\r
+//     UsbCommand ack = {CMD_ACK, {0, 0, 0}};\r
 \r
        LED_B_ON();\r
 \r
        LED_B_ON();\r
-       UsbSendPacket((uint8_t *)&ack, sizeof(UsbCommand));\r
+  cmd_send(CMD_ACK,0,0,0,0,0);\r
+//     UsbSendPacket((uint8_t *)&ack, sizeof(UsbCommand));\r
        LED_B_OFF();\r
 \r
        return 0;\r
 }\r
 \r
        LED_B_OFF();\r
 \r
        return 0;\r
 }\r
 \r
-int RAMFUNC MfSniffLogic(const uint8_t * data, int len, int bitCnt, int reader) {\r
+int RAMFUNC MfSniffLogic(const uint8_t * data, int len, uint32_t parity, int bitCnt, int reader) {\r
 \r
 \r
-       if ((len == 1) && (bitCnt = 9)) { \r
+       if ((len == 1) && (bitCnt = 9) && (data[0] > 0x0F)) { \r
                sniffState = SNF_INIT;\r
        }\r
 \r
                sniffState = SNF_INIT;\r
        }\r
 \r
@@ -121,18 +122,18 @@ int RAMFUNC MfSniffLogic(const uint8_t * data, int len, int bitCnt, int reader)
                        sniffBuf[11] = sniffSAK;\r
                        sniffBuf[12] = 0xFF;\r
                        sniffBuf[13] = 0xFF;\r
                        sniffBuf[11] = sniffSAK;\r
                        sniffBuf[12] = 0xFF;\r
                        sniffBuf[13] = 0xFF;\r
-                       LogTrace(sniffBuf, 14, 0, 0, true);\r
+                       LogTrace(sniffBuf, 14, 0, parity, true);\r
                        timerData = GetTickCount();\r
                }\r
                case SNF_CARD_CMD:{\r
                        timerData = GetTickCount();\r
                }\r
                case SNF_CARD_CMD:{\r
-                       LogTrace(data, len, 0, 0, true);\r
+                       LogTrace(data, len, 0, parity, true);\r
 \r
                        sniffState = SNF_CARD_RESP;\r
                        timerData = GetTickCount();\r
                        break;\r
                }\r
                case SNF_CARD_RESP:{\r
 \r
                        sniffState = SNF_CARD_RESP;\r
                        timerData = GetTickCount();\r
                        break;\r
                }\r
                case SNF_CARD_RESP:{\r
-                       LogTrace(data, len, 0, 0, false);\r
+                       LogTrace(data, len, 0, parity, false);\r
 \r
                        sniffState = SNF_CARD_CMD;\r
                        timerData = GetTickCount();\r
 \r
                        sniffState = SNF_CARD_CMD;\r
                        timerData = GetTickCount();\r
@@ -163,26 +164,28 @@ int intMfSniffSend() {
        \r
        if (!traceLen) return 0;\r
 \r
        \r
        if (!traceLen) return 0;\r
 \r
-       AT91C_BASE_PDC_SSC->PDC_PTCR = AT91C_PDC_RXTDIS;\r
+       FpgaDisableSscDma();\r
 \r
        while (pckLen > 0) {\r
 \r
        while (pckLen > 0) {\r
-               pckSize = min(32, pckLen);\r
-               UsbCommand ack = {CMD_ACK, {1, pckSize, pckNum}};\r
-               memcpy(ack.d.asBytes, trace + traceLen - pckLen, pckSize);\r
+               pckSize = MIN(32, pckLen);\r
+//             UsbCommand ack = {CMD_ACK, {1, pckSize, pckNum}};\r
+//             memcpy(ack.d.asBytes, trace + traceLen - pckLen, pckSize);\r
        \r
                LED_B_ON();\r
        \r
                LED_B_ON();\r
-               UsbSendPacket((uint8_t *)&ack, sizeof(UsbCommand));\r
-               SpinDelay(20);\r
+    cmd_send(CMD_ACK,1,pckSize,pckNum,trace + traceLen - pckLen,pckSize);\r
+//             UsbSendPacket((uint8_t *)&ack, sizeof(UsbCommand));\r
+//             SpinDelay(20);\r
                LED_B_OFF();\r
 \r
                pckLen -= pckSize;\r
                pckNum++;\r
        }\r
 \r
                LED_B_OFF();\r
 \r
                pckLen -= pckSize;\r
                pckNum++;\r
        }\r
 \r
-       UsbCommand ack = {CMD_ACK, {2, 0, 0}};\r
+//     UsbCommand ack = {CMD_ACK, {2, 0, 0}};\r
 \r
        LED_B_ON();\r
 \r
        LED_B_ON();\r
-       UsbSendPacket((uint8_t *)&ack, sizeof(UsbCommand));\r
+  cmd_send(CMD_ACK,2,0,0,0,0);\r
+//     UsbSendPacket((uint8_t *)&ack, sizeof(UsbCommand));\r
        LED_B_OFF();\r
 \r
        traceLen = 0;\r
        LED_B_OFF();\r
 \r
        traceLen = 0;\r
Impressum, Datenschutz