]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/mifaresniff.c
Legic Tag Simulator (#666)
[proxmark3-svn] / armsrc / mifaresniff.c
index 20b54e820d15c9e02aff61449b3c75c16a922ca3..5391e5f9af1c35f0bc2e8b44d600955610fa52c0 100644 (file)
@@ -35,7 +35,7 @@ bool MfSniffInit(void){
        sniffSAK = 0;
        sniffUIDType = SNF_UID_4;
 
-       return FALSE;
+       return false;
 }
 
 bool MfSniffEnd(void){
@@ -43,7 +43,7 @@ bool MfSniffEnd(void){
        cmd_send(CMD_ACK,0,0,0,0,0);
        LED_B_OFF();
 
-       return FALSE;
+       return false;
 }
 
 bool RAMFUNC MfSniffLogic(const uint8_t *data, uint16_t len, uint8_t *parity, uint16_t bitCnt, bool reader) {
@@ -60,9 +60,16 @@ bool RAMFUNC MfSniffLogic(const uint8_t *data, uint16_t len, uint8_t *parity, ui
                                memset(sniffATQA, 0x00, 2);
                                sniffSAK = 0;
                                sniffState = SNF_ATQA;
+                               if (data[0] == 0x40) 
+                                       sniffState = SNF_MAGIC_WUPC2;
                        }
                        break;
                }
+               case SNF_MAGIC_WUPC2:
+                       if ((len == 1) && (reader) && (data[0] == 0x43) ) {  
+                               sniffState = SNF_CARD_IDLE;
+                       }
+                       break;
                case SNF_ATQA:{
                        if ((!reader) && (len == 2)) {          // ATQA from tag
                                memcpy(sniffATQA, data, 2);
@@ -105,11 +112,11 @@ bool RAMFUNC MfSniffLogic(const uint8_t *data, uint16_t len, uint8_t *parity, ui
                        sniffBuf[11] = sniffSAK;
                        sniffBuf[12] = 0xFF;
                        sniffBuf[13] = 0xFF;
-                       LogTrace(sniffBuf, 14, 0, 0, NULL, TRUE);
+                       LogTrace(sniffBuf, 14, 0, 0, NULL, true);
                        sniffState = SNF_CARD_CMD;
                }       // intentionally no break;
                case SNF_CARD_CMD:{     
-                       LogTrace(data, len, 0, 0, NULL, reader);
+                       LogTrace(data, len, 0, 0, parity, reader);
                        timerData = GetTickCount();
                        break;
                }
@@ -120,14 +127,14 @@ bool RAMFUNC MfSniffLogic(const uint8_t *data, uint16_t len, uint8_t *parity, ui
        }
 
 
-       return FALSE;
+       return false;
 }
 
 bool RAMFUNC MfSniffSend(uint16_t maxTimeoutMs) {
        if (BigBuf_get_traceLen() && (GetTickCount() > timerData + maxTimeoutMs)) {
                return intMfSniffSend();
        }
-       return FALSE;
+       return false;
 }
 
 // internal sending function. not a RAMFUNC.
@@ -155,5 +162,5 @@ bool intMfSniffSend() {
 
        clear_trace();
        
-       return TRUE;
+       return true;
 }
Impressum, Datenschutz