OLD/MIX convert to NG: Phase C5
This commit is contained in:
1 parent
d1cc742987
commit
5589cbf847
6 files changed
+68
-26
No files matched your search
@@ -3395,7 +3395,7 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
|
||||
res = mf_check_keys_fast(sector_cnt, true, true, 1, key_cnt, keyBlock, e_sector, use_flashmemory, verbose);
|
||||
} else {
|
||||
|
||||
uint32_t chunksize = key_cnt > (PM3_CMD_DATA_SIZE / MIFARE_KEY_SIZE) ? (PM3_CMD_DATA_SIZE / MIFARE_KEY_SIZE) : key_cnt;
|
||||
uint32_t chunksize = key_cnt > MFC_CHKKEYS_FAST_MAX_KEYS ? MFC_CHKKEYS_FAST_MAX_KEYS : key_cnt;
|
||||
bool firstChunk = true, lastChunk = false;
|
||||
|
||||
for (uint8_t strategy = 1; strategy < 3; strategy++) {
|
||||
@@ -4045,7 +4045,7 @@ static int CmdHF14AMfChk_fast(const char *Cmd) {
|
||||
return PM3_EMALLOC;
|
||||
}
|
||||
|
||||
uint32_t chunksize = (keycnt > (PM3_CMD_DATA_SIZE / MIFARE_KEY_SIZE)) ? (PM3_CMD_DATA_SIZE / MIFARE_KEY_SIZE) : keycnt;
|
||||
uint32_t chunksize = (keycnt > MFC_CHKKEYS_FAST_MAX_KEYS) ? MFC_CHKKEYS_FAST_MAX_KEYS : keycnt;
|
||||
bool firstChunk = true, lastChunk = false;
|
||||
|
||||
int i = 0;
|
||||
@@ -4240,7 +4240,7 @@ static int CmdHF14AMfSmartBrute(const char *Cmd) {
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
uint32_t chunksize = 100 > (PM3_CMD_DATA_SIZE / MIFARE_KEY_SIZE) ? (PM3_CMD_DATA_SIZE / MIFARE_KEY_SIZE) : 100;
|
||||
uint32_t chunksize = 100 > MFC_CHKKEYS_FAST_MAX_KEYS ? MFC_CHKKEYS_FAST_MAX_KEYS : 100;
|
||||
uint8_t *keyBlock = calloc(MIFARE_KEY_SIZE, chunksize);
|
||||
|
||||
if (keyBlock == NULL)
|
||||
|
||||
@@ -261,19 +261,30 @@ int mf_check_keys_fast_ex(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastCh
|
||||
|
||||
uint64_t t2 = msclock();
|
||||
|
||||
if (size > MFC_CHKKEYS_FAST_MAX_KEYS) {
|
||||
PrintAndLogEx(WARNING, "chunk of %u keys is too large for one frame, max %zu", size, (size_t)MFC_CHKKEYS_FAST_MAX_KEYS);
|
||||
return PM3_EOUTOFBOUND;
|
||||
}
|
||||
|
||||
uint8_t buf[PM3_CMD_DATA_SIZE] = {0};
|
||||
mf_chkkeys_fast_t *payload = (mf_chkkeys_fast_t *)buf;
|
||||
payload->sectorcnt = sectorsCnt;
|
||||
payload->first_chunk = firstChunk;
|
||||
payload->last_chunk = lastChunk;
|
||||
payload->strategy = strategy;
|
||||
payload->use_flashmemory = use_flashmemory;
|
||||
payload->key_count = size;
|
||||
payload->singlesector_params = singleSectorParams;
|
||||
memcpy(payload->keys, keyBlock, MIFARE_KEY_SIZE * size);
|
||||
|
||||
// send keychunk
|
||||
clearCommandBuffer();
|
||||
SendCommandOLD(CMD_HF_MIFARE_CHKKEYS_FAST
|
||||
, (sectorsCnt | (firstChunk << 8) | (lastChunk << 12) | (singleSectorParams << 16))
|
||||
, ((use_flashmemory << 8) | strategy)
|
||||
, size
|
||||
, keyBlock
|
||||
, (MIFARE_KEY_SIZE * size)
|
||||
);
|
||||
SendCommandNG(CMD_HF_MIFARE_CHKKEYS_FAST, buf, sizeof(mf_chkkeys_fast_t) + (MIFARE_KEY_SIZE * size));
|
||||
|
||||
PacketResponseNG resp;
|
||||
|
||||
uint32_t timeout = 0;
|
||||
while (WaitForResponseTimeout(CMD_ACK, &resp, 2000) == false) {
|
||||
while (WaitForResponseTimeout(CMD_HF_MIFARE_CHKKEYS_FAST, &resp, 2000) == false) {
|
||||
|
||||
while (kbd_enter_pressed()) {
|
||||
SendCommandNG(CMD_BREAK_LOOP, NULL, 0);
|
||||
@@ -304,7 +315,7 @@ int mf_check_keys_fast_ex(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastCh
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
}
|
||||
// time to convert the returned data.
|
||||
uint8_t curr_keys = resp.oldarg[0];
|
||||
uint8_t curr_keys = (uint8_t)resp.status;
|
||||
|
||||
if ((singleSectorParams >> 15) & 1) {
|
||||
|
||||
|
||||
Reference in new issue
Block a user