#include "util.h"
#include "printf.h"
#include "string.h"
+
#include <stdarg.h>
#include "legicrf.h"
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);
+ LED_A_OFF();
break;
case CMD_LF_SIMULATE_BIDIR:
SimulateTagLowFrequencyBidir(c->arg[0], c->arg[1]);
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);
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);
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
- *rit ^= ( (*rit ^= *start), *start ^= *rit);\r
+ *rit ^= (*rit ^= *start, *start ^= *rit);\r
\r
quicksort(start, rit - 1);\r
quicksort(rit + 1, stop);\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
- 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
- OnError(3);\r
+ //OnError(3);\r
return;\r
};\r
\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
- 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
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
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
if (len) {\r
if (MF_DBGLEVEL >= MF_DBG_ERROR)\r
Dbprintf("Halt error");\r
- OnError(3);\r
+ //OnError(3);\r
return;\r
}\r
\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
#include "cmdparser.h"
#include "cmdhflegic.h"
#include "cmdmain.h"
-
+#include "util.h"
static int CmdHelp(const char *Cmd);
static command_t CommandTable[] =
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
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
#include "cmdparser.h"
#include "cmdmain.h"
#include "cmddata.h"
+#include "util.h"
#include "cmdlf.h"
#include "cmdlfhid.h"
#include "cmdlfti.h"
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
#define CMD_MIFARE_READBL 0x0620
#define CMD_MIFAREU_READBL 0x0720
-
#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