This commit is contained in:
iceman1001 2025-03-22 15:46:55 +01:00
commit 4c97151ecc
9 changed files with 67 additions and 67 deletions

View file

@ -129,7 +129,7 @@ static bool mifare_wakeup_auth(struct Crypto1State *pcs, MifareWakeupType wakeup
// maybe this is fine on some tags?
}
break;
}
}
}
if (key_auth_cmd != 0) {
@ -1838,7 +1838,7 @@ static void chkKey_scanB(struct chk_t *c, struct sector_t *k_sector, uint8_t *fo
// failed to select, return immediately
return;
}
if (res == 0) {
num_to_bytes(c->key, 6, k_sector[s].keyB);
found[(s * 2) + 1] = 1;
@ -1934,7 +1934,7 @@ void MifareChkKeys_fast(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *da
// Compute how many keys can fit in bigbuf
// a key is 6 bytes
uint16_t key_mem_available = MIN( (BigBuf_get_size() / MF_KEY_LENGTH), (keyCount + (size / MF_KEY_LENGTH)));
uint16_t key_mem_available = MIN((BigBuf_get_size() / MF_KEY_LENGTH), (keyCount + (size / MF_KEY_LENGTH)));
uint8_t *dictkeys = BigBuf_calloc(key_mem_available * MF_KEY_LENGTH);
if (dictkeys == NULL) {
@ -2200,7 +2200,7 @@ out:
// skip already found A keys
if (found[(s * 2)] == 0) {
chk_data.keyType = MF_KEY_A;
chk_data.keyType = MF_KEY_A;
status = chkKey(&chk_data);
if (status == 0) {
memcpy(k_sector[s].keyA, datain + (i * MF_KEY_LENGTH), MF_KEY_LENGTH);
@ -3287,11 +3287,11 @@ void MifareHasStaticEncryptedNonce(uint8_t block_no, uint8_t key_type, uint8_t *
goto OUT;
};
first_nt_counter++;
} else {
for (uint8_t i = 0; i < nr_nested; i++) {
if (need_first_auth) {
cuid = 0;

View file

@ -577,25 +577,25 @@ int rdv40_spiffs_make_symlink(const char *linkdest, const char *filename, RDV40S
// preexistence, avoiding a link being created if filename exists, or avoiding a file being created if
// symlink exists with same name
int rdv40_spiffs_read_as_filetype(const char *filename, uint8_t *dst, uint32_t size, RDV40SpiFFSSafetyLevel level) {
RDV40_SPIFFS_SAFE_FUNCTION(
RDV40SpiFFSFileType filetype = filetype_in_spiffs((char *)filename);
switch (filetype) {
case RDV40_SPIFFS_FILETYPE_REAL: {
case RDV40_SPIFFS_FILETYPE_REAL: {
rdv40_spiffs_read(filename, dst, size, level);
break;
}
case RDV40_SPIFFS_FILETYPE_SYMLINK: {
}
case RDV40_SPIFFS_FILETYPE_SYMLINK: {
rdv40_spiffs_read_as_symlink(filename, dst, size, level);
break;
}
}
case RDV40_SPIFFS_FILETYPE_BOTH:
case RDV40_SPIFFS_FILETYPE_UNKNOWN:
default: {
default: {
break;
}
}
}
)
}

View file

@ -1960,8 +1960,8 @@ static int detect_nxp_card_print(uint8_t sak, uint16_t atqa, uint64_t select_sta
if (
((atqa & 0x0001) == 0x0001) ||
((atqa & 0x0004) == 0x0004)
) {
((atqa & 0x0004) == 0x0004)
) {
printTag("HID SEOS (smartmx / javacard)");
type |= HID_SEOS;
@ -2386,8 +2386,7 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
if (
(card.ats_len == 7 && memcmp(card.ats, "\x05\x78\x77\x80\x02\x9C\x3A", 7) == 0) ||
(card.ats_len == 7 && memcmp(card.ats, "\x05\x78\x77\x94\x02\x6D\xC8", 7) == 0)
)
{
) {
isSEOS = true;
isNTAG424 = false;
isMifareDESFire = false;

View file

@ -2755,7 +2755,7 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
return PM3_ESOFT;
}
//
//
has_staticnonce = detect_classic_static_encrypted_nonce(0, MF_KEY_A, g_mifare_default_key);
}
@ -2768,9 +2768,9 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
PrintAndLogEx(INFO, " keytype ....... " _YELLOW_("%c"), (keytype == MF_KEY_B) ? 'B' : 'A');
PrintAndLogEx(INFO, " known key ..... " _YELLOW_("%s"), sprint_hex_inrow(key, sizeof(key)));
switch(has_staticnonce) {
switch (has_staticnonce) {
case NONCE_STATIC: {
PrintAndLogEx(INFO, " card PRNG ..... " _YELLOW_("STATIC"));
PrintAndLogEx(INFO, " card PRNG ..... " _YELLOW_("STATIC"));
break;
}
case NONCE_STATIC_ENC: {
@ -2778,11 +2778,11 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
break;
}
case NONCE_NORMAL: {
PrintAndLogEx(INFO, " card PRNG ..... " _YELLOW_("%s"), prng_type ? "WEAK" : "HARD");
PrintAndLogEx(INFO, " card PRNG ..... " _YELLOW_("%s"), prng_type ? "WEAK" : "HARD");
break;
}
default: {
PrintAndLogEx(INFO, " card PRNG ..... " _YELLOW_("Could not determine PRNG,") " " _RED_("read failed."));
PrintAndLogEx(INFO, " card PRNG ..... " _YELLOW_("Could not determine PRNG,") " " _RED_("read failed."));
break;
}
}
@ -2956,9 +2956,9 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
noValidKeyFound:
PrintAndLogEx(FAILED, "No usable key was found!");
if (use_flashmemory == false && fnlen == 0) {
PrintAndLogEx(HINT, "Hint: Try `" _YELLOW_("hf mf autopwn -f mfc_default_keys")"` i.e. the Randy special");
PrintAndLogEx(HINT, "Hint: Try `" _YELLOW_("hf mf autopwn -f mfc_default_keys")"` i.e. the Randy special");
}
if (has_staticnonce == NONCE_STATIC_ENC) {
PrintAndLogEx(HINT, "Hint: Static encrypted nonce detected, run `" _YELLOW_("script run fm11rf08s_recovery.py") "`");
}

View file

@ -95,7 +95,7 @@ void SendCommandOLD(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, c
PrintAndLogEx(WARNING, "Sending " _RED_("%zu") " bytes of payload is too much for OLD frames, abort", len);
return;
// return PM3_EOUTOFBOUND;
}
}
c.cmd = cmd;
c.arg[0] = arg0;

View file

@ -2433,7 +2433,7 @@ int loadFileDICTIONARY_safe_ex(const char *preferredName, const char *suffix, vo
fclose(f);
if (verbose) {
PrintAndLogEx(SUCCESS, "Loaded " _GREEN_("%2d") " keys from dictionary file `" _YELLOW_("%s") "`", *keycnt, path);
PrintAndLogEx(SUCCESS, "Loaded " _GREEN_("%d") " keys from dictionary file `" _YELLOW_("%s") "`", *keycnt, path);
}
out:

View file

@ -262,12 +262,12 @@ int mf_check_keys_fast_ex(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastCh
// 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)
);
, (sectorsCnt | (firstChunk << 8) | (lastChunk << 12) | (singleSectorParams << 16))
, ((use_flashmemory << 8) | strategy)
, size
, keyBlock
, (MIFARE_KEY_SIZE * size)
);
PacketResponseNG resp;
uint32_t timeout = 0;
@ -382,8 +382,8 @@ int mf_check_keys_fast_ex(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastCh
}
int mf_check_keys_fast(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastChunk, uint8_t strategy
, uint32_t size, uint8_t *keyBlock, sector_t *e_sector, bool use_flashmemory
, bool verbose) {
, uint32_t size, uint8_t *keyBlock, sector_t *e_sector, bool use_flashmemory
, bool verbose) {
return mf_check_keys_fast_ex(sectorsCnt, firstChunk, lastChunk, strategy, size, keyBlock, e_sector, use_flashmemory, verbose, false, 0);
}
@ -393,7 +393,7 @@ int mf_check_keys_fast(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastChunk
int mf_check_keys_file(uint8_t *destfn, uint64_t *key) {
if (key) {
*key = -1;
*key = -1;
}
struct {
@ -483,7 +483,7 @@ int mf_key_brute(uint8_t blockNo, uint8_t keyType, const uint8_t *key, uint64_t
// progress
if (counter % 20 == 0) {
PrintAndLogEx(SUCCESS, "tried %s.. \t %u keys", sprint_hex(candidates + i, 6), counter * KEYS_IN_BLOCK);
}
}
}
return found;
}
@ -1190,10 +1190,10 @@ int mf_chinese_wipe(uint8_t *uid, const uint8_t *atqa, const uint8_t *sak, uint8
res = mf_chinese_set_block(blockNo, blockK, NULL, params);
} else {
res = mf_chinese_set_block(blockNo, blockD, NULL, params);
}
}
}
if (res == PM3_SUCCESS) {
if (res == PM3_SUCCESS) {
break;
}
@ -1221,25 +1221,25 @@ int mf_chinese_set_block(uint8_t blockNo, uint8_t *data, uint8_t *uid, uint8_t p
return PM3_ETIMEOUT;
}
uint8_t isOK = resp.oldarg[0] & 0xFF;
if (uid != NULL) {
memcpy(uid, resp.data.asBytes, 4);
}
uint8_t isOK = resp.oldarg[0] & 0xFF;
if (uid != NULL) {
memcpy(uid, resp.data.asBytes, 4);
}
if (isOK == 0) {
uint8_t reason = (resp.oldarg[1] & 0xFF);
if (reason == 4) {
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(WARNING, "GDM magic write signature block failed");
} else if (reason == 5) {
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(WARNING, "Write block failed");
}
return PM3_EUNDEF;
uint8_t reason = (resp.oldarg[1] & 0xFF);
if (reason == 4) {
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(WARNING, "GDM magic write signature block failed");
} else if (reason == 5) {
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(WARNING, "Write block failed");
}
return PM3_EUNDEF;
}
return PM3_SUCCESS;
}
@ -1284,10 +1284,10 @@ int mf_chinese_gen_3_block(uint8_t *block, int blockLen, uint8_t *newBlock) {
return PM3_ETIMEOUT;
}
if (resp.status == PM3_SUCCESS && newBlock) {
memcpy(newBlock, resp.data.asBytes, MFBLOCK_SIZE);
}
return resp.status;
if (resp.status == PM3_SUCCESS && newBlock) {
memcpy(newBlock, resp.data.asBytes, MFBLOCK_SIZE);
}
return resp.status;
}
int mf_chinese_gen_3_freeze(void) {
@ -1446,7 +1446,7 @@ int detect_classic_nackbug(bool verbose) {
default: {
PrintAndLogEx(ERR, "errorcode from device " _RED_("[%i]"), ok);
return PM3_EUNDEF;
}
}
}
break;
}
@ -1486,10 +1486,10 @@ returns:
3 = has encrypted nonce
*/
int detect_classic_static_encrypted_nonce_ex(uint8_t block_no, uint8_t key_type, const uint8_t *key, uint8_t block_no_nested
, uint8_t key_type_nested, const uint8_t *key_nested
, uint8_t nr_nested, bool reset, bool hardreset
, bool addread, bool addauth, bool incblk2
, bool corruptnrar, bool corruptnrarparity, bool verbose) {
, uint8_t key_type_nested, const uint8_t *key_nested
, uint8_t nr_nested, bool reset, bool hardreset
, bool addread, bool addauth, bool incblk2
, bool corruptnrar, bool corruptnrarparity, bool verbose) {
uint8_t cdata[1 + 1 + MIFARE_KEY_SIZE + 1 + 1 + MIFARE_KEY_SIZE + 1 + 1 + 1 + 1 + 1 + 1 + 1] = { 0 };
cdata[0] = block_no;

View file

@ -112,9 +112,9 @@ int detect_classic_nackbug(bool verbose);
uint16_t detect_mf_magic(bool is_mfc, uint8_t key_type, uint64_t key);
int detect_classic_static_nonce(void);
int detect_classic_static_encrypted_nonce_ex(uint8_t block_no, uint8_t key_type, const uint8_t *key
, uint8_t block_no_nested, uint8_t key_type_nested, const uint8_t *key_nested
, uint8_t nr_nested, bool reset, bool hardreset, bool addread, bool addauth
, bool incblk2, bool corruptnrar, bool corruptnrarparity, bool verbose);
, uint8_t block_no_nested, uint8_t key_type_nested, const uint8_t *key_nested
, uint8_t nr_nested, bool reset, bool hardreset, bool addread, bool addauth
, bool incblk2, bool corruptnrar, bool corruptnrarparity, bool verbose);
int detect_classic_static_encrypted_nonce(uint8_t block_no, uint8_t key_type, const uint8_t *key);
bool detect_mfc_ev1_signature(void);
int read_mfc_ev1_signature(uint8_t *signature);

View file

@ -4400,6 +4400,7 @@
"--slow Slower acquisition (required by some non standard cards)",
"-l, --legacy legacy mode (use the slow `hf mf chk`)",
"-v, --verbose verbose output",
"--mem Use dictionary from flashmemory",
"--ns No save to file",
"--mini MIFARE Classic Mini / S20",
"--1k MIFARE Classic 1k / S50 (default)",
@ -4412,7 +4413,7 @@
"--i2 AVX2",
"--i5 AVX512"
],
"usage": "hf mf autopwn [-hablv] [-k <hex>]... [-s <dec>] [-f <fn>] [--suffix <txt>] [--slow] [--ns] [--mini] [--1k] [--2k] [--4k] [--in] [--im] [--is] [--ia] [--i2] [--i5]"
"usage": "hf mf autopwn [-hablv] [-k <hex>]... [-s <dec>] [-f <fn>] [--suffix <txt>] [--slow] [--mem] [--ns] [--mini] [--1k] [--2k] [--4k] [--in] [--im] [--is] [--ia] [--i2] [--i5]"
},
"hf mf brute": {
"command": "hf mf brute",
@ -13356,6 +13357,6 @@
"metadata": {
"commands_extracted": 767,
"extracted_by": "PM3Help2JSON v1.00",
"extracted_on": "2025-03-21T07:07:05"
"extracted_on": "2025-03-22T12:16:04"
}
}