]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
CHG: `hf 14a read` - started to add a Magic tag gen2 detection. SKipping it for...
authoriceman1001 <iceman@iuse.se>
Tue, 28 Feb 2017 07:16:02 +0000 (08:16 +0100)
committericeman1001 <iceman@iuse.se>
Tue, 28 Feb 2017 07:16:02 +0000 (08:16 +0100)
FIX:  `lf read` - ophs..  it works again.
ADD: `lf em 4x05--`  - added a chipset definition
CHG: better kali fix - from @pwpivi

armsrc/mifarecmd.c
client/cmdhf14a.c
client/cmdlf.c
client/cmdlfem4x.c
client/whereami.c

index db49a9598a8935a219e7e76130bece230592e6a9..2ab076b626575975a396f905dc2510633124cef1 100644 (file)
@@ -1360,24 +1360,48 @@ void MifareCGetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain){
 void MifareCIdent(){\r
        #define GEN_1A 1\r
        #define GEN_1B 2\r
+       #define GEN_2  4\r
        // variables\r
        uint8_t isGen = 0;\r
-       uint8_t receivedAnswer[1] = {0x00};\r
-       uint8_t receivedAnswerPar[1] = {0x00};\r
-\r
+       uint8_t rec[1] = {0x00};\r
+       uint8_t recpar[1] = {0x00};\r
+       \r
+       // Generation 1 test\r
        ReaderTransmitBitsPar(wupC1, 7, NULL, NULL);\r
-       if(!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {\r
-               goto OUT;\r
-       }\r
-       isGen |= GEN_1B;\r
+       if(!ReaderReceive(rec, recpar) || (rec[0] != 0x0a)) {\r
+               goto TEST2;\r
+       };\r
+       isGen = GEN_1B;\r
        \r
        ReaderTransmit(wupC2, sizeof(wupC2), NULL);\r
-       if(!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {\r
+       if(!ReaderReceive(rec, recpar) || (rec[0] != 0x0a)) {\r
                goto OUT;\r
-       }       \r
+       };      \r
        isGen = GEN_1A;\r
+       goto OUT;\r
 \r
-OUT:   \r
+TEST2:;\r
+/*\r
+       // Generation 2 test\r
+       struct Crypto1State mpcs = {0, 0};\r
+       struct Crypto1State *pcs = &mpcs;\r
+\r
+       // halt previous.\r
+       mifare_classic_halt(NULL, 0);\r
+       \r
+       //select\r
+       if (!iso14443a_select_card(NULL, NULL, NULL, true, 0)) {\r
+               goto OUT;\r
+       };\r
+       \r
+       // MIFARE_CLASSIC_WRITEBLOCK 0xA0\r
+       // ACK 0x0a\r
+       uint16_t len = mifare_sendcmd_short(pcs, 1, 0xA0, 0, rec, recpar, NULL);\r
+       if ((len != 1) || (rec[0] != 0x0A)) {   \r
+               isGen = GEN_2;  \r
+       };\r
+       */\r
+OUT:;\r
        // removed the if,  since some magic tags misbehavies and send an answer to it.\r
        mifare_classic_halt(NULL, 0);\r
        cmd_send(CMD_ACK,isGen, 0, 0, 0, 0);\r
index cb3a67ed38b702ce75546fd25d096435dff3c4b9..21c97fa24555d23cf2bab13521ea560c20cba863 100644 (file)
@@ -391,18 +391,21 @@ int CmdHF14AReader(const char *Cmd) {
        
        // try to see if card responses to "chinese magic backdoor" commands.
        uint8_t isGeneration = 0;
-       
        clearCommandBuffer();
        c.cmd = CMD_MIFARE_CIDENT;
        c.arg[0] = 0;
        c.arg[1] = 0;
        c.arg[2] = 0;   
        SendCommand(&c);
-       if (WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {
+       if (WaitForResponseTimeout(CMD_ACK, &resp, 1500))
                isGeneration = resp.arg[0] & 0xff;
-       }
-       if ( isGeneration )
-               PrintAndLog("Answers to magic commands (GEN %s): YES", ((isGeneration & 0x2 )==2)?"1B":"1A");
+       
+       switch( isGeneration ){
+               case 1: PrintAndLog("Answers to magic commands (GEN 1a): YES"); break;
+               case 2: PrintAndLog("Answers to magic commands (GEN 1b): YES"); break;
+               //case 4: PrintAndLog("Answers to magic commands (GEN 2): YES"); break;
+               default: PrintAndLog("Answers to magic commands: NO"); break;
+       }               
 
        // disconnect
        SendCommand(&cDisconnect);
index 8ab065bb45b0a51f31dc48d6a927188bb00db274..414e4a2be1bbb675fcfd0197bd24883b6ee97d38 100644 (file)
@@ -567,14 +567,11 @@ int CmdLFRead(const char *Cmd) {
                        break;
                default:
                        PrintAndLog("Unknown parameter '%c'", param_getchar(Cmd, cmdp));
-                       errors = 1;
+                       errors = TRUE;
                        break;
                }
                if(errors) break;
        }
-       
-       // No args
-       if (cmdp == 0) errors = 1;
 
        //Validations
        if (errors) return usage_lf_read();
index ff7a5f69b8d7046049556db17a0adf011c17a09a..7383756b65909077cab3f0ea959e7b007fec32dd 100644 (file)
@@ -797,7 +797,7 @@ int EM4x05ReadWord_ext(uint8_t addr, uint32_t pwd, bool usePwd, uint32_t *word)
        }
        int testLen = (GraphTraceLen < 1000) ? GraphTraceLen : 1000;
        if (graphJustNoise(GraphBuffer, testLen)) {
-               PrintAndLog("no tag not found");
+               PrintAndLog("no tag found");
                return -1;
        }
        return demodEM4x05resp(word);
@@ -981,6 +981,7 @@ void printEM4x05info(uint32_t block0, uint32_t serial) {
        
        switch (chipType) {
                case 9:  PrintAndLog("\n Chip Type:   %u | EM4305", chipType); break;
+               case 8:  PrintAndLog("\n Chip Type:   %u | EM4205", chipType); break;
                case 4:  PrintAndLog(" Chip Type:   %u | Unknown", chipType); break;
                case 2:  PrintAndLog(" Chip Type:   %u | EM4469", chipType); break;
                //add more here when known
index aa702adc22a19105927a04ed60d7631190bb40ea..a85318895f8dc4dfb07bcd6bcd96ea8287397aa0 100644 (file)
 extern "C" {
 #endif
 
+#if defined(__linux__)
+// make realpath() available:
 #define _DEFAULT_SOURCE
+#endif
 
 #if !defined(WAI_MALLOC) || !defined(WAI_FREE) || !defined(WAI_REALLOC)
 #include <stdlib.h>
Impressum, Datenschutz