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? // maybe this is fine on some tags?
} }
break; break;
} }
} }
if (key_auth_cmd != 0) { if (key_auth_cmd != 0) {
@ -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 // Compute how many keys can fit in bigbuf
// a key is 6 bytes // 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); uint8_t *dictkeys = BigBuf_calloc(key_mem_available * MF_KEY_LENGTH);
if (dictkeys == NULL) { if (dictkeys == NULL) {

View file

@ -583,19 +583,19 @@ int rdv40_spiffs_read_as_filetype(const char *filename, uint8_t *dst, uint32_t s
RDV40SpiFFSFileType filetype = filetype_in_spiffs((char *)filename); RDV40SpiFFSFileType filetype = filetype_in_spiffs((char *)filename);
switch (filetype) { switch (filetype) {
case RDV40_SPIFFS_FILETYPE_REAL: { case RDV40_SPIFFS_FILETYPE_REAL: {
rdv40_spiffs_read(filename, dst, size, level); rdv40_spiffs_read(filename, dst, size, level);
break; break;
} }
case RDV40_SPIFFS_FILETYPE_SYMLINK: { case RDV40_SPIFFS_FILETYPE_SYMLINK: {
rdv40_spiffs_read_as_symlink(filename, dst, size, level); rdv40_spiffs_read_as_symlink(filename, dst, size, level);
break; break;
} }
case RDV40_SPIFFS_FILETYPE_BOTH: case RDV40_SPIFFS_FILETYPE_BOTH:
case RDV40_SPIFFS_FILETYPE_UNKNOWN: case RDV40_SPIFFS_FILETYPE_UNKNOWN:
default: { default: {
break; break;
} }
} }
) )
} }

View file

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

View file

@ -2768,9 +2768,9 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
PrintAndLogEx(INFO, " keytype ....... " _YELLOW_("%c"), (keytype == MF_KEY_B) ? 'B' : 'A'); PrintAndLogEx(INFO, " keytype ....... " _YELLOW_("%c"), (keytype == MF_KEY_B) ? 'B' : 'A');
PrintAndLogEx(INFO, " known key ..... " _YELLOW_("%s"), sprint_hex_inrow(key, sizeof(key))); PrintAndLogEx(INFO, " known key ..... " _YELLOW_("%s"), sprint_hex_inrow(key, sizeof(key)));
switch(has_staticnonce) { switch (has_staticnonce) {
case NONCE_STATIC: { case NONCE_STATIC: {
PrintAndLogEx(INFO, " card PRNG ..... " _YELLOW_("STATIC")); PrintAndLogEx(INFO, " card PRNG ..... " _YELLOW_("STATIC"));
break; break;
} }
case NONCE_STATIC_ENC: { case NONCE_STATIC_ENC: {
@ -2778,11 +2778,11 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
break; break;
} }
case NONCE_NORMAL: { case NONCE_NORMAL: {
PrintAndLogEx(INFO, " card PRNG ..... " _YELLOW_("%s"), prng_type ? "WEAK" : "HARD"); PrintAndLogEx(INFO, " card PRNG ..... " _YELLOW_("%s"), prng_type ? "WEAK" : "HARD");
break; break;
} }
default: { 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; break;
} }
} }
@ -2956,7 +2956,7 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
noValidKeyFound: noValidKeyFound:
PrintAndLogEx(FAILED, "No usable key was found!"); PrintAndLogEx(FAILED, "No usable key was found!");
if (use_flashmemory == false && fnlen == 0) { 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) { if (has_staticnonce == NONCE_STATIC_ENC) {

View file

@ -2433,7 +2433,7 @@ int loadFileDICTIONARY_safe_ex(const char *preferredName, const char *suffix, vo
fclose(f); fclose(f);
if (verbose) { 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: out:

View file

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

View file

@ -4400,6 +4400,7 @@
"--slow Slower acquisition (required by some non standard cards)", "--slow Slower acquisition (required by some non standard cards)",
"-l, --legacy legacy mode (use the slow `hf mf chk`)", "-l, --legacy legacy mode (use the slow `hf mf chk`)",
"-v, --verbose verbose output", "-v, --verbose verbose output",
"--mem Use dictionary from flashmemory",
"--ns No save to file", "--ns No save to file",
"--mini MIFARE Classic Mini / S20", "--mini MIFARE Classic Mini / S20",
"--1k MIFARE Classic 1k / S50 (default)", "--1k MIFARE Classic 1k / S50 (default)",
@ -4412,7 +4413,7 @@
"--i2 AVX2", "--i2 AVX2",
"--i5 AVX512" "--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": { "hf mf brute": {
"command": "hf mf brute", "command": "hf mf brute",
@ -13356,6 +13357,6 @@
"metadata": { "metadata": {
"commands_extracted": 767, "commands_extracted": 767,
"extracted_by": "PM3Help2JSON v1.00", "extracted_by": "PM3Help2JSON v1.00",
"extracted_on": "2025-03-21T07:07:05" "extracted_on": "2025-03-22T12:16:04"
} }
} }