]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
Reverted some minor things, altered other things to get it to compile cleanly
authorMartin Holst Swende <martin@swende.se>
Thu, 8 Jan 2015 16:51:52 +0000 (17:51 +0100)
committerMartin Holst Swende <martin@swende.se>
Thu, 8 Jan 2015 16:51:52 +0000 (17:51 +0100)
armsrc/appmain.c
armsrc/apps.h
armsrc/crapto1.c
armsrc/mifarecmd.c
client/cmdhflegic.c
client/cmdhfmf.c
client/cmdlf.c
client/lualibs/html_dumplib.lua
include/usb_cmd.h

index ca16ee60f472da16b8ef45bb8752ea0db7040240..530dc39cd04b4fa15603998bb069cb27e2fc9029 100644 (file)
@@ -18,6 +18,7 @@
 #include "util.h"
 #include "printf.h"
 #include "string.h"
 #include "util.h"
 #include "printf.h"
 #include "string.h"
+
 #include <stdarg.h>
 
 #include "legicrf.h"
 #include <stdarg.h>
 
 #include "legicrf.h"
@@ -667,7 +668,9 @@ void UsbPacketReceived(uint8_t *packet, int len)
                        WriteTItag(c->arg[0],c->arg[1],c->arg[2]);
                        break;
                case CMD_SIMULATE_TAG_125K:
                        WriteTItag(c->arg[0],c->arg[1],c->arg[2]);
                        break;
                case CMD_SIMULATE_TAG_125K:
+                       LED_A_ON();
                        SimulateTagLowFrequency(c->arg[0], c->arg[1], 1);
                        SimulateTagLowFrequency(c->arg[0], c->arg[1], 1);
+                       LED_A_OFF();
                        break;
                case CMD_LF_SIMULATE_BIDIR:
                        SimulateTagLowFrequencyBidir(c->arg[0], c->arg[1]);
                        break;
                case CMD_LF_SIMULATE_BIDIR:
                        SimulateTagLowFrequencyBidir(c->arg[0], c->arg[1]);
@@ -799,7 +802,7 @@ void UsbPacketReceived(uint8_t *packet, int len)
                        MifareUReadBlock(c->arg[0],c->d.asBytes);
                        break;
                case CMD_MIFAREU_READCARD:
                        MifareUReadBlock(c->arg[0],c->d.asBytes);
                        break;
                case CMD_MIFAREU_READCARD:
-                       MifareUReadCard(c->arg[0],c->d.asBytes);
+                       MifareUReadCard(c->arg[0], c->arg[1], c->d.asBytes);
                         break;
                case CMD_MIFARE_READSC:
                        MifareReadSector(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes);
                         break;
                case CMD_MIFARE_READSC:
                        MifareReadSector(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes);
index eafee559a899bc17976cabfe10786212c000fbc7..ce721525d5cf91bd53fe2022169837c21ec77728 100644 (file)
@@ -177,7 +177,7 @@ void ReaderMifare(bool first_try);
 int32_t dist_nt(uint32_t nt1, uint32_t nt2);
 void MifareReadBlock(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *data);
 void MifareUReadBlock(uint8_t arg0,uint8_t *datain);
 int32_t dist_nt(uint32_t nt1, uint32_t nt2);
 void MifareReadBlock(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *data);
 void MifareUReadBlock(uint8_t arg0,uint8_t *datain);
-void MifareUReadCard(uint8_t arg0,uint8_t *datain);
+void MifareUReadCard(uint8_t arg0, int arg1, uint8_t *datain);
 void MifareReadSector(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain);
 void MifareWriteBlock(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain);
 void MifareUWriteBlock(uint8_t arg0,uint8_t *datain);
 void MifareReadSector(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain);
 void MifareWriteBlock(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain);
 void MifareUWriteBlock(uint8_t arg0,uint8_t *datain);
index df0834b89fec0f1e252b81bed833f2da0b0cfd32..9d491d1271ff1fdcda05b5ae980e1530f8d00ccc 100644 (file)
@@ -44,12 +44,12 @@ static void quicksort(uint32_t* const start, uint32_t* const stop)
                else if(*rit > *start)\r
                        --rit;\r
                else\r
                else if(*rit > *start)\r
                        --rit;\r
                else\r
-                       *it ^= ( (*it ^= *rit ), *rit ^= *it);\r
+                       *it ^= (*it ^= *rit, *rit ^= *it);\r
 \r
        if(*rit >= *start)\r
                --rit;\r
        if(rit != start)\r
 \r
        if(*rit >= *start)\r
                --rit;\r
        if(rit != start)\r
-               *rit ^= ( (*rit ^= *start), *start ^= *rit);\r
+               *rit ^= (*rit ^= *start, *start ^= *rit);\r
 \r
        quicksort(start, rit - 1);\r
        quicksort(rit + 1, stop);\r
 \r
        quicksort(start, rit - 1);\r
        quicksort(rit + 1, stop);\r
index 2619a9763c1fc8f95dea093580b61716ce5a4f3a..ecd8728db9c4b9dcf3168b3207665cd1bf676597 100644 (file)
@@ -102,21 +102,21 @@ void MifareUReadBlock(uint8_t arg0,uint8_t *datain)
        int len = iso14443a_select_card(uid, NULL, &cuid);\r
        if(!len) {\r
                if (MF_DBGLEVEL >= MF_DBG_ERROR)        Dbprintf("Can't select card");\r
        int len = iso14443a_select_card(uid, NULL, &cuid);\r
        if(!len) {\r
                if (MF_DBGLEVEL >= MF_DBG_ERROR)        Dbprintf("Can't select card");\r
-               OnError(1);\r
+               //OnError(1);\r
                return;\r
                };\r
         \r
        len = mifare_ultra_readblock(cuid, blockNo, dataout);\r
        if(len) {\r
                if (MF_DBGLEVEL >= MF_DBG_ERROR)        Dbprintf("Read block error");\r
                return;\r
                };\r
         \r
        len = mifare_ultra_readblock(cuid, blockNo, dataout);\r
        if(len) {\r
                if (MF_DBGLEVEL >= MF_DBG_ERROR)        Dbprintf("Read block error");\r
-               OnError(2);\r
+               //OnError(2);\r
                return;\r
                };\r
         \r
        len = mifare_ultra_halt(cuid);\r
        if(len) {\r
                if (MF_DBGLEVEL >= MF_DBG_ERROR)        Dbprintf("Halt error");\r
                return;\r
                };\r
         \r
        len = mifare_ultra_halt(cuid);\r
        if(len) {\r
                if (MF_DBGLEVEL >= MF_DBG_ERROR)        Dbprintf("Halt error");\r
-               OnError(3);\r
+               //OnError(3);\r
                return;\r
                };\r
                \r
                return;\r
                };\r
                \r
@@ -201,11 +201,11 @@ void MifareUReadCard(uint8_t arg0, int arg1, uint8_t *datain)
        int count_Pages = 0;\r
        byte_t dataout[176] = {0x00};;\r
        uint8_t uid[10] = {0x00};\r
        int count_Pages = 0;\r
        byte_t dataout[176] = {0x00};;\r
        uint8_t uid[10] = {0x00};\r
-        uint32_t cuid;\r
+       uint32_t cuid;\r
 \r
 \r
-        LED_A_ON();\r
-        LED_B_OFF();\r
-        LED_C_OFF();\r
+       LED_A_ON();\r
+       LED_B_OFF();\r
+       LED_C_OFF();\r
 \r
        if (MF_DBGLEVEL >= MF_DBG_ALL) \r
                Dbprintf("Pages %d",Pages);\r
 \r
        if (MF_DBGLEVEL >= MF_DBG_ALL) \r
                Dbprintf("Pages %d",Pages);\r
@@ -218,7 +218,7 @@ void MifareUReadCard(uint8_t arg0, int arg1, uint8_t *datain)
        if (!len) {\r
                if (MF_DBGLEVEL >= MF_DBG_ERROR)\r
                        Dbprintf("Can't select card");\r
        if (!len) {\r
                if (MF_DBGLEVEL >= MF_DBG_ERROR)\r
                        Dbprintf("Can't select card");\r
-               OnError(1);\r
+               //OnError(1);\r
                return;\r
        }\r
        \r
                return;\r
        }\r
        \r
@@ -229,7 +229,7 @@ void MifareUReadCard(uint8_t arg0, int arg1, uint8_t *datain)
                if (len) {\r
                        if (MF_DBGLEVEL >= MF_DBG_ERROR)\r
                                Dbprintf("Read block %d error",i);\r
                if (len) {\r
                        if (MF_DBGLEVEL >= MF_DBG_ERROR)\r
                                Dbprintf("Read block %d error",i);\r
-                       OnError(2);\r
+                       //OnError(2);\r
                        return;\r
                } else {\r
                        count_Pages++;\r
                        return;\r
                } else {\r
                        count_Pages++;\r
@@ -240,7 +240,7 @@ void MifareUReadCard(uint8_t arg0, int arg1, uint8_t *datain)
        if (len) {\r
                if (MF_DBGLEVEL >= MF_DBG_ERROR)\r
                        Dbprintf("Halt error");\r
        if (len) {\r
                if (MF_DBGLEVEL >= MF_DBG_ERROR)\r
                        Dbprintf("Halt error");\r
-               OnError(3);\r
+               //OnError(3);\r
                return;\r
        }\r
        \r
                return;\r
        }\r
        \r
@@ -255,8 +255,8 @@ void MifareUReadCard(uint8_t arg0, int arg1, uint8_t *datain)
                len = 176;\r
 \r
        cmd_send(CMD_ACK, 1, 0, 0, dataout, len);       \r
                len = 176;\r
 \r
        cmd_send(CMD_ACK, 1, 0, 0, dataout, len);       \r
-        FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);\r
-        LEDsoff();\r
+       FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);\r
+       LEDsoff();\r
 }\r
 \r
 \r
 }\r
 \r
 \r
index 35ba1f28c49d6d4d64b58b774d7ce571c8feed03..7ee601b232888aaece3aa1fe70b42d1731879d85 100644 (file)
@@ -16,7 +16,7 @@
 #include "cmdparser.h"
 #include "cmdhflegic.h"
 #include "cmdmain.h"
 #include "cmdparser.h"
 #include "cmdhflegic.h"
 #include "cmdmain.h"
-
+#include "util.h"
 static int CmdHelp(const char *Cmd);
 
 static command_t CommandTable[] = 
 static int CmdHelp(const char *Cmd);
 
 static command_t CommandTable[] = 
index 66c0b25d1d97f3f1b32c870929e54feb779df4b8..aae6290d066697e676383308713afe66273722ad 100644 (file)
@@ -662,6 +662,8 @@ int CmdHF14AMfRestore(const char *Cmd)
        for (sectorNo = 0; sectorNo < numSectors; sectorNo++) {\r
                if (fread(keyA[sectorNo], 1, 6, fkeys) == 0) {\r
                        PrintAndLog("File reading error (dumpkeys.bin).");\r
        for (sectorNo = 0; sectorNo < numSectors; sectorNo++) {\r
                if (fread(keyA[sectorNo], 1, 6, fkeys) == 0) {\r
                        PrintAndLog("File reading error (dumpkeys.bin).");\r
+\r
+                       fclose(fkeys);\r
                        return 2;\r
                }\r
        }\r
                        return 2;\r
                }\r
        }\r
@@ -669,6 +671,7 @@ int CmdHF14AMfRestore(const char *Cmd)
        for (sectorNo = 0; sectorNo < numSectors; sectorNo++) {\r
                if (fread(keyB[sectorNo], 1, 6, fkeys) == 0) {\r
                        PrintAndLog("File reading error (dumpkeys.bin).");\r
        for (sectorNo = 0; sectorNo < numSectors; sectorNo++) {\r
                if (fread(keyB[sectorNo], 1, 6, fkeys) == 0) {\r
                        PrintAndLog("File reading error (dumpkeys.bin).");\r
+                       fclose(fkeys);\r
                        return 2;\r
                }\r
        }\r
                        return 2;\r
                }\r
        }\r
index 572cda6ca418a9babcd6bbc0b77f706eea0769e2..65d6fdd5f92064576b4209b2c1afd4f42b69d715 100644 (file)
@@ -19,6 +19,7 @@
 #include "cmdparser.h"
 #include "cmdmain.h"
 #include "cmddata.h"
 #include "cmdparser.h"
 #include "cmdmain.h"
 #include "cmddata.h"
+#include "util.h"
 #include "cmdlf.h"
 #include "cmdlfhid.h"
 #include "cmdlfti.h"
 #include "cmdlf.h"
 #include "cmdlfhid.h"
 #include "cmdlfti.h"
index 44b6b352b00e41cfd0b7fa89116cbce1b486d46d..3a28d5ae6f988cf5b30c0ffb40094342bca797e6 100644 (file)
@@ -49,7 +49,7 @@ end
 
 local function save_TEXT(data,filename)
        -- Open the output file
 
 local function save_TEXT(data,filename)
        -- Open the output file
-       local outfile = io.open(filename, "wb")
+       local outfile = io.open(filename, "w")
        if outfile == nil then 
                return oops(string.format("Could not write to file %s",tostring(filename)))
        end
        if outfile == nil then 
                return oops(string.format("Could not write to file %s",tostring(filename)))
        end
index c2e0b95bda0d4ff30d856914414cf9a17edc52cb..69c3c1b6a0920a388650265a892e281b9e348977 100644 (file)
@@ -150,10 +150,8 @@ typedef struct {
 
 #define CMD_MIFARE_READBL                                                 0x0620
 #define CMD_MIFAREU_READBL                                               0x0720
 
 #define CMD_MIFARE_READBL                                                 0x0620
 #define CMD_MIFAREU_READBL                                               0x0720
-
 #define CMD_MIFARE_READSC                                                 0x0621
 #define CMD_MIFAREU_READCARD                                             0x0721
 #define CMD_MIFARE_READSC                                                 0x0621
 #define CMD_MIFAREU_READCARD                                             0x0721
-
 #define CMD_MIFARE_WRITEBL                                                0x0622
 #define CMD_MIFAREU_WRITEBL                                                                      0x0722
 #define CMD_MIFAREU_WRITEBL_COMPAT                                                           0x0723
 #define CMD_MIFARE_WRITEBL                                                0x0622
 #define CMD_MIFAREU_WRITEBL                                                                      0x0722
 #define CMD_MIFAREU_WRITEBL_COMPAT                                                           0x0723
Impressum, Datenschutz