dump size bugs

This commit is contained in:
iceman1001 2020-08-08 11:46:22 +02:00
commit 146c8f4e8e

View file

@ -47,7 +47,7 @@ static uint8_t iClass_Key_Table[ICLASS_KEYS_MAX][8] = {
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
}; };
static int usage_hf_iclass_sim(void) { static int usage_hf_iclass_sim(void) {
@ -293,7 +293,6 @@ static int usage_hf_iclass_replay(void) {
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
return PM3_SUCCESS; return PM3_SUCCESS;
} }
static int usage_hf_iclass_loclass(void) { static int usage_hf_iclass_loclass(void) {
PrintAndLogEx(NORMAL, "Execute the offline part of loclass attack"); PrintAndLogEx(NORMAL, "Execute the offline part of loclass attack");
PrintAndLogEx(NORMAL, " An iclass dumpfile is assumed to consist of an arbitrary number of"); PrintAndLogEx(NORMAL, " An iclass dumpfile is assumed to consist of an arbitrary number of");
@ -385,7 +384,6 @@ static inline uint32_t countones(uint64_t a) {
} }
// iclass card descriptors
const char * card_types[] = { const char * card_types[] = {
"PicoPass 16K / 16", // 000 "PicoPass 16K / 16", // 000
"PicoPass 32K with current book 16K / 16", // 001 "PicoPass 32K with current book 16K / 16", // 001
@ -801,7 +799,7 @@ static int CmdHFiClassSim(const char *Cmd) {
default: { default: {
uint8_t numberOfCSNs = 0; uint8_t numberOfCSNs = 0;
clearCommandBuffer(); clearCommandBuffer();
SendCommandMIX(CMD_HF_ICLASS_SIMULATE, sim_type, numberOfCSNs, 0, CSN, 8); SendCommandMIX(CMD_HF_ICLASS_SIMULATE, sim_type, numberOfCSNs, 1, CSN, 8);
if (sim_type == ICLASS_SIM_MODE_FULL) if (sim_type == ICLASS_SIM_MODE_FULL)
PrintAndLogEx(HINT, "Try `" _YELLOW_("hf iclass esave h") "` to save the emulator memory to file"); PrintAndLogEx(HINT, "Try `" _YELLOW_("hf iclass esave h") "` to save the emulator memory to file");
@ -1534,7 +1532,7 @@ static int CmdHFiClassDump(const char *Cmd) {
//get CSN and config //get CSN and config
PacketResponseNG resp; PacketResponseNG resp;
uint8_t tag_data[255 * 8]; uint8_t tag_data[0x100 * 8];
memset(tag_data, 0xFF, sizeof(tag_data)); memset(tag_data, 0xFF, sizeof(tag_data));
clearCommandBuffer(); clearCommandBuffer();
@ -1649,7 +1647,7 @@ static int CmdHFiClassDump(const char *Cmd) {
uint32_t startindex = packet->bb_offset; uint32_t startindex = packet->bb_offset;
uint32_t blocks_read = packet->block_cnt; uint32_t blocks_read = packet->block_cnt;
uint8_t tempbuf[0xFF * 8]; uint8_t tempbuf[0x100 * 8];
// response ok - now get bigbuf content of the dump // response ok - now get bigbuf content of the dump
if (!GetFromDevice(BIG_BUF, tempbuf, sizeof(tempbuf), startindex, NULL, 0, NULL, 2500, false)) { if (!GetFromDevice(BIG_BUF, tempbuf, sizeof(tempbuf), startindex, NULL, 0, NULL, 2500, false)) {
@ -2339,6 +2337,9 @@ static int CmdHFiClass_loclass(const char *Cmd) {
char fileName[FILE_PATH_SIZE] = {0}; char fileName[FILE_PATH_SIZE] = {0};
if (param_getstr(Cmd, 1, fileName, sizeof(fileName)) > 0) { if (param_getstr(Cmd, 1, fileName, sizeof(fileName)) > 0) {
return bruteforceFileNoKeys(fileName); return bruteforceFileNoKeys(fileName);
} else {
PrintAndLogEx(WARNING, "You must specify a filename");
return PM3_EFILE;
} }
} else if (opt == 't') { } else if (opt == 't') {
char opt2 = tolower(param_getchar(Cmd, 1)); char opt2 = tolower(param_getchar(Cmd, 1));
@ -2550,6 +2551,7 @@ static void HFiClassCalcNewKey(uint8_t *CSN, uint8_t *OLDKEY, uint8_t *NEWKEY, u
} }
} }
static int CmdHFiClassCalcNewKey(const char *Cmd) { static int CmdHFiClassCalcNewKey(const char *Cmd) {
uint8_t OLDKEY[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; uint8_t OLDKEY[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
uint8_t NEWKEY[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; uint8_t NEWKEY[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};