]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdlfem4x.c
syntax sugar
[proxmark3-svn] / client / cmdlfem4x.c
index 89f68171bf4ca0d6de8fd13458cb3e2064b21bbf..59a1eef3182a80d961a9cf926de86a2d4a309141 100644 (file)
@@ -14,6 +14,20 @@ uint64_t g_em410xid = 0;
 
 static int CmdHelp(const char *Cmd);
 
 
 static int CmdHelp(const char *Cmd);
 
+int usage_lf_em410x_sim(void) {
+       PrintAndLog("Simulating EM410x tag");
+       PrintAndLog("");
+       PrintAndLog("Usage:  lf em 410xsim [h] <uid> <clock>");
+       PrintAndLog("Options:");
+       PrintAndLog("       h         - this help");
+       PrintAndLog("       uid       - uid (10 HEX symbols)");
+       PrintAndLog("       clock     - clock (32|64) (optional)");
+       PrintAndLog("samples:");
+       PrintAndLog("      lf em 410xsim 0F0368568B");
+       PrintAndLog("      lf em 410xsim 0F0368568B 32");
+       return 0;
+}
+
 int CmdEMdemodASK(const char *Cmd)
 {
        char cmdp = param_getchar(Cmd, 0);
 int CmdEMdemodASK(const char *Cmd)
 {
        char cmdp = param_getchar(Cmd, 0);
@@ -37,31 +51,12 @@ int CmdEM410xRead(const char *Cmd)
        uint64_t lo = 0;
 
        if(!AskEm410xDemod("", &hi, &lo, false)) return 0;
        uint64_t lo = 0;
 
        if(!AskEm410xDemod("", &hi, &lo, false)) return 0;
-       if (hi)
-               PrintAndLog ("EM410x XL pattern found");
-       else
-               PrintAndLog("EM410x pattern found: ");
 
        printEM410x(hi, lo);
        g_em410xid = lo;
        return 1;
 }
 
 
        printEM410x(hi, lo);
        g_em410xid = lo;
        return 1;
 }
 
-
-int usage_lf_em410x_sim(void) {
-       PrintAndLog("Simulating EM410x tag");
-       PrintAndLog("");
-       PrintAndLog("Usage:  lf em 410xsim [h] <uid> <clock>");
-       PrintAndLog("Options:");
-       PrintAndLog("       h         - this help");
-       PrintAndLog("       uid       - uid (10 HEX symbols)");
-       PrintAndLog("       clock     - clock (32|64) (optional)");
-       PrintAndLog("samples:");
-       PrintAndLog("      lf em 410xsim 0F0368568B");
-       PrintAndLog("      lf em 410xsim 0F0368568B 32");
-       return 0;
-}
-
 // emulate an EM410X tag
 int CmdEM410xSim(const char *Cmd)
 {
 // emulate an EM410X tag
 int CmdEM410xSim(const char *Cmd)
 {
@@ -448,7 +443,7 @@ int EM4x50Read(const char *Cmd, bool verbose) {
                        }
                }
                if (!clk) {
                        }
                }
                if (!clk) {
-                       PrintAndLog("ERROR: EM4x50 - didn't find a clock");
+                       if (verbose || g_debugMode) PrintAndLog("ERROR: EM4x50 - didn't find a clock");
                        return 0;
                }
        } else tol = clk/8;
                        return 0;
                }
        } else tol = clk/8;
@@ -802,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)) {
        }
        int testLen = (GraphTraceLen < 1000) ? GraphTraceLen : 1000;
        if (graphJustNoise(GraphBuffer, testLen)) {
-               PrintAndLog("no tag not found");
+               PrintAndLog("no tag found");
                return -1;
        }
        return demodEM4x05resp(word);
                return -1;
        }
        return demodEM4x05resp(word);
@@ -889,7 +884,7 @@ int CmdEM4x05Write(const char *Cmd) {
                PrintAndLog("Address must be between 0 and 15");
                return 1;
        }
                PrintAndLog("Address must be between 0 and 15");
                return 1;
        }
-       if ( pwd == -1 )
+       if ( pwd == 1 )
                PrintAndLog("Writing address %d data %08X", addr, data);        
        else {
                usePwd = true;
                PrintAndLog("Writing address %d data %08X", addr, data);        
        else {
                usePwd = true;
@@ -986,6 +981,7 @@ void printEM4x05info(uint32_t block0, uint32_t serial) {
        
        switch (chipType) {
                case 9:  PrintAndLog("\n Chip Type:   %u | EM4305", chipType); break;
        
        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
                case 4:  PrintAndLog(" Chip Type:   %u | Unknown", chipType); break;
                case 2:  PrintAndLog(" Chip Type:   %u | EM4469", chipType); break;
                //add more here when known
Impressum, Datenschutz