]> cvs.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdlft55xx.c
Fix some printf/scanf format strings
[proxmark3-svn] / client / cmdlft55xx.c
index ed980f9b783f1af639f94c24ca843c13d1ff1029..c64e5ef24eb00b68348d070a7b93c646de878b59 100644 (file)
@@ -311,13 +311,13 @@ int CmdT55xxSetConfig(const char *Cmd) {
        }\r
 \r
        // No args\r
-       if (cmdp == 0) return printConfiguration( config );\r
+       if (cmdp == 0) return printConfiguration( config);\r
 \r
        //Validations\r
        if (errors) return usage_t55xx_config();\r
 \r
        config.block0 = 0;\r
-       return printConfiguration ( config );\r
+       return printConfiguration ( config);\r
 }\r
 \r
 int T55xxReadBlock(uint8_t block, bool page1, bool usepwd, bool override, uint32_t password, uint8_t downlink_mode){\r
@@ -476,6 +476,25 @@ bool DecodeT5555TraceBlock() {
        return (bool) ASKDemod("64 0 1", false, false, 1);\r
 }\r
 \r
+void T55xx_Print_DownlinkMode (uint8_t downlink_mode)\r
+{\r
+       char Msg[80];\r
+       sprintf (Msg,"Downlink Mode used : ");\r
+       \r
+               switch (downlink_mode) {\r
+                       case  0 :       strcat (Msg,"default/fixed bit length"); break;\r
+                       case  1 :   strcat (Msg,"long leading reference (r 1)");   break;\r
+                       case  2 :   strcat (Msg,"leading zero reference (r 2)");   break;\r
+                       case  3 :   strcat (Msg,"1 of 4 coding reference (r 3)");  break;\r
+                       default :\r
+                                       strcat (Msg,"default/fixed bit length"); break;\r
+\r
+               }\r
+       \r
+       PrintAndLog (Msg);\r
+       \r
+}\r
+\r
 int CmdT55xxDetect(const char *Cmd){\r
        bool errors = false;\r
        bool useGB = false;\r
@@ -522,13 +541,8 @@ int CmdT55xxDetect(const char *Cmd){
        if ( !tryDetectModulation() )\r
                PrintAndLog("Could not detect modulation automatically. Try setting it manually with \'lf t55xx config\'");\r
        else {\r
-               // Add downlink mode to reference.\r
-               switch (downlink_mode) {\r
-                       case  0 :       PrintAndLog ("Downlink   : r 0 - default/fixed bit length"); break;\r
-                       case  1 :   PrintAndLog ("Downlink   : r 1 - long leading reference"); break;\r
-                       case  2 :   PrintAndLog ("Downlink   : r 2 - leading zero reference"); break;\r
-                       case  3 :   PrintAndLog ("Downlink   : r 3 - 1 of 4 coding reference"); break;\r
-               }\r
+               // Add downlink mode for reference.\r
+               T55xx_Print_DownlinkMode (downlink_mode);\r
        }\r
        return 1;\r
 }\r
@@ -681,7 +695,8 @@ bool tryDetectModulation(){
                config.block0 = tests[0].block0;\r
                config.Q5 = tests[0].Q5;\r
                config.ST = tests[0].ST;\r
-               printConfiguration( config );\r
+               \r
+               printConfiguration( config);\r
                return true;\r
        }\r
        \r
@@ -689,7 +704,7 @@ bool tryDetectModulation(){
                PrintAndLog("Found [%d] possible matches for modulation.",hits);\r
                for(int i=0; i<hits; ++i){\r
                        PrintAndLog("--[%d]---------------", i+1);\r
-                       printConfiguration( tests[i] );\r
+                       printConfiguration( tests[i]);\r
                }\r
        }\r
        return false;\r
@@ -1541,7 +1556,7 @@ int CmdT55xxBruteForce(const char *Cmd) {
                        // donwlink_mode will = 0 if > 3 or set to 0, so loop from 0 - 3\r
                        for (dl_mode = downlink_mode; dl_mode <= 3; dl_mode++){\r
                                if ( !AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, true, testpwd, dl_mode)) {\r
-                                       PrintAndLog("Aquireing data from device failed. Quitting");\r
+                                       PrintAndLog("Acquiring data from device failed. Quitting");\r
                                        free(keyBlock);\r
                                        return 0;\r
                                }\r
@@ -1551,12 +1566,9 @@ int CmdT55xxBruteForce(const char *Cmd) {
                                if ( found ) {\r
                                        PrintAndLog("Found valid password: [%08X]", testpwd);\r
                                        free(keyBlock);\r
-                                       switch (dl_mode) {\r
-                                               case  0 :       PrintAndLog ("Downlink   : r 0 - default/fixed bit length"); break;\r
-                                               case  1 :   PrintAndLog ("Downlink   : r 1 - long leading reference"); break;\r
-                                               case  2 :   PrintAndLog ("Downlink   : r 2 - leading zero reference"); break;\r
-                                               case  3 :   PrintAndLog ("Downlink   : r 3 - 1 of 4 coding reference"); break;\r
-                                       }                                       \r
+                                       \r
+                                       T55xx_Print_DownlinkMode (dl_mode);\r
+\r
                                        return 0;\r
                                }\r
                                if (!try_all_dl_modes) // Exit loop if not trying all downlink modes\r
@@ -1597,7 +1609,7 @@ int CmdT55xxBruteForce(const char *Cmd) {
                // donwlink_mode will = 0 if > 3 or set to 0, so loop from 0 - 3\r
                for (dl_mode = downlink_mode; dl_mode <= 3; dl_mode++){\r
                        if (!AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, true, i,dl_mode)) {\r
-                               PrintAndLog("Aquireing data from device failed. Quitting");\r
+                               PrintAndLog("Acquiring data from device failed. Quitting");\r
                                free(keyBlock);\r
                                return 0;\r
                        }\r
@@ -1613,12 +1625,7 @@ int CmdT55xxBruteForce(const char *Cmd) {
 \r
        if (found){\r
                PrintAndLog("Found valid password: [%08x]", i);\r
-               switch (dl_mode) {\r
-                       case  0 :       PrintAndLog ("Downlink   : r 0 - default/fixed bit length"); break;\r
-                       case  1 :   PrintAndLog ("Downlink   : r 1 - long leading reference"); break;\r
-                       case  2 :   PrintAndLog ("Downlink   : r 2 - leading Zero reference"); break;\r
-                       case  3 :   PrintAndLog ("Downlink   : r 3 - 1 of 4 coding reference"); break;\r
-               }\r
+               T55xx_Print_DownlinkMode (downlink_mode);\r
        }\r
        else{\r
                PrintAndLog("");\r
Impressum, Datenschutz