Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
iceman1001 committed Oct 18, 2024
1 parent 91004aa commit 0c2ef9d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 33 deletions.
40 changes: 20 additions & 20 deletions armsrc/mifaresim.c
Original file line number Diff line number Diff line change
Expand Up @@ -831,9 +831,9 @@ void Mifare1ksim(uint16_t flags, uint8_t exitAfterNReads, uint8_t *datain, uint1
uint8_t nt_par_err = buf[(cardAUTHKEY * 8) + 2];
uint32_t nt_enc = bytes_to_num(response, 4);
response_par[0] = ((((nt_par_err >> 3) & 1) ^ oddparity8((nt_enc >> 24) & 0xFF)) << 7 |
(((nt_par_err >> 2) & 1) ^ oddparity8((nt_enc >> 16) & 0xFF)) << 6 |
(((nt_par_err >> 1) & 1) ^ oddparity8((nt_enc >> 8) & 0xFF)) << 5 |
(((nt_par_err >> 0) & 1) ^ oddparity8((nt_enc >> 0) & 0xFF)) << 4);
(((nt_par_err >> 2) & 1) ^ oddparity8((nt_enc >> 16) & 0xFF)) << 6 |
(((nt_par_err >> 1) & 1) ^ oddparity8((nt_enc >> 8) & 0xFF)) << 5 |
(((nt_par_err >> 0) & 1) ^ oddparity8((nt_enc >> 0) & 0xFF)) << 4);
ar_nr_resp[0].cuid = cuid;
ar_nr_resp[0].sector = cardAUTHSC;
ar_nr_resp[0].keytype = cardAUTHKEY;
Expand Down Expand Up @@ -1192,7 +1192,7 @@ void Mifare1ksim(uint16_t flags, uint8_t exitAfterNReads, uint8_t *datain, uint1
(cardAUTHSC == ar_nr_resp[i].sector) &&
(cardAUTHKEY == ar_nr_resp[i].keytype)
)
) {
) {
// if first auth for sector, or matches sector and keytype of previous auth
if (ar_nr_resp[i].state != SECOND) {
// if we haven't already collected 2 nonces for this sector
Expand Down Expand Up @@ -1363,15 +1363,15 @@ void Mifare1ksim(uint16_t flags, uint8_t exitAfterNReads, uint8_t *datain, uint1
running_nested_auth_attack = false;
if (g_dbglevel >= DBG_INFO) {
Dbprintf("Collected nested AR/NR which can be used to extract sector %d " _YELLOW_("%s")
, ar_nr_resp[0].sector
, (ar_nr_resp[0].keytype == AUTHKEYA) ? "key A" : "key B"
, ar_nr_resp[0].sector
, (ar_nr_resp[0].keytype == AUTHKEYA) ? "key A" : "key B"
);
Dbprintf("../tools/mfc/card_reader/mfkey32nested %08x %08x %08x %08x %08x",
ar_nr_resp[0].cuid, //UID
ar_nr_resp[0].nonce, //NT
ar_nr_resp[0].nonce2,//NT_ENC
ar_nr_resp[0].nr, //NR1
ar_nr_resp[0].ar //AR1
ar_nr_resp[0].cuid, //UID
ar_nr_resp[0].nonce, //NT
ar_nr_resp[0].nonce2,//NT_ENC
ar_nr_resp[0].nr, //NR1
ar_nr_resp[0].ar //AR1
);
}
}
Expand All @@ -1383,17 +1383,17 @@ void Mifare1ksim(uint16_t flags, uint8_t exitAfterNReads, uint8_t *datain, uint1
index = i;
if (g_dbglevel >= DBG_INFO) {
Dbprintf("Collected two pairs of AR/NR which can be used to extract sector %d " _YELLOW_("%s")
, ar_nr_resp[i].sector
, (ar_nr_resp[i].keytype == AUTHKEYA) ? "key A" : "key B"
, ar_nr_resp[i].sector
, (ar_nr_resp[i].keytype == AUTHKEYA) ? "key A" : "key B"
);
Dbprintf("../tools/mfc/card_reader/mfkey32v2 %08x %08x %08x %08x %08x %08x %08x",
ar_nr_resp[i].cuid, //UID
ar_nr_resp[i].nonce, //NT
ar_nr_resp[i].nr, //NR1
ar_nr_resp[i].ar, //AR1
ar_nr_resp[i].nonce2,//NT2
ar_nr_resp[i].nr2, //NR2
ar_nr_resp[i].ar2 //AR2
ar_nr_resp[i].cuid, //UID
ar_nr_resp[i].nonce, //NT
ar_nr_resp[i].nr, //NR1
ar_nr_resp[i].ar, //AR1
ar_nr_resp[i].nonce2,//NT2
ar_nr_resp[i].nr2, //NR2
ar_nr_resp[i].ar2 //AR2
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion client/src/cmdhfmf.c
Original file line number Diff line number Diff line change
Expand Up @@ -4067,7 +4067,7 @@ void readerAttack(sector_t *k_sector, size_t k_sectors_cnt, nonces_t data, bool
if (setEmulatorMem) {
uint8_t memBlock[16];
mfEmlGetMem(memBlock, (sector * 4) + 3, 1);
if ((memBlock[6]==0) && (memBlock[7]==0) && (memBlock[8]==0)) {
if ((memBlock[6] == 0) && (memBlock[7] == 0) && (memBlock[8] == 0)) {
// ACL not yet set?
memBlock[6] = 0xFF;
memBlock[7] = 0x07;
Expand Down
4 changes: 2 additions & 2 deletions common_arm/flashmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,8 @@ void Flashmem_print_status(void) {
break;
default:
Dbprintf(" Device ID............... " _YELLOW_("%02X / %02X (Winbond)"),
device_type.manufacturer_id,
device_type.device_id
device_type.manufacturer_id,
device_type.device_id
);
break;
}
Expand Down
25 changes: 15 additions & 10 deletions doc/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -1355,9 +1355,10 @@
"--skip ISO14443-3 select only (skip RATS)",
"--ecp Use enhanced contactless polling",
"--mag Use Apple magsafe polling",
"-@ continuous reader mode"
"-@ continuous reader mode",
"-w, --wait wait for card"
],
"usage": "hf 14a reader [-hks@] [--drop] [--skip] [--ecp] [--mag]"
"usage": "hf 14a reader [-hks@w] [--drop] [--skip] [--ecp] [--mag]"
},
"hf 14a sim": {
"command": "hf 14a sim",
Expand Down Expand Up @@ -4590,12 +4591,14 @@
"-h, --help This help",
"-a input key type is key A(def)",
"-b input key type is key B",
"-c <dec> input key type is key A + offset",
"-k, --key <hex> key, 6 hex bytes, only for option -c",
"--mini MIFARE Classic Mini / S20",
"--1k MIFARE Classic 1k / S50 (def)",
"--2k MIFARE Classic/Plus 2k",
"--4k MIFARE Classic 4k / S70"
],
"usage": "hf mf ecfill [-hab] [--mini] [--1k] [--2k] [--4k]"
"usage": "hf mf ecfill [-hab] [-c <dec>] [-k <hex>] [--mini] [--1k] [--2k] [--4k]"
},
"hf mf eclr": {
"command": "hf mf eclr",
Expand Down Expand Up @@ -5370,7 +5373,7 @@
"hf mf sim --1k -u 11223344556677 -> MIFARE Classic 1k with 7b UID",
"hf mf sim --1k -u 11223344 -i -x -> Perform reader attack in interactive mode",
"hf mf sim --2k -> MIFARE 2k",
"hf mf sim --4k -> MIFARE 4k"
"hf mf sim --4k -> MIFARE 4khf mf sim --1k -x -e --> Keep simulation running and populate with found reader keys"
],
"offline": false,
"options": [
Expand All @@ -5384,12 +5387,13 @@
"--sak <hex> Provide explicit SAK (1 bytes, overrides option t)",
"-n, --num <dec> Automatically exit simulation after <numreads> blocks have been read by reader. 0 = infinite",
"-i, --interactive Console will not be returned until simulation finishes or is aborted",
"-x Performs the 'reader attack', nr/ar attack against a reader",
"-e, --emukeys Fill simulator keys from found keys",
"-x Performs the 'reader attack', nr/ar attack against a reader.",
"-y Performs the nested 'reader attack'. This requires preloading nt & nt_enc in emulator memory. Implies -x.",
"-e, --emukeys Fill simulator keys from found keys. Requires -x or -y. Implies -i. Simulation will restart automatically.",
"-v, --verbose verbose output",
"--cve trigger CVE 2021_0430"
],
"usage": "hf mf sim [-hixev] [-u <hex>] [--mini] [--1k] [--2k] [--4k] [--atqa <hex>] [--sak <hex>] [-n <dec> ] [--cve]"
"usage": "hf mf sim [-hixyev] [-u <hex>] [--mini] [--1k] [--2k] [--4k] [--atqa <hex>] [--sak <hex>] [-n <dec> ] [--cve]"
},
"hf mf staticnested": {
"command": "hf mf staticnested",
Expand Down Expand Up @@ -12405,9 +12409,10 @@
],
"offline": true,
"options": [
"-h, --help This help"
"-h, --help This help",
"-j, --json Dump prefs as JSON"
],
"usage": "prefs show [-h]"
"usage": "prefs show [-hj]"
},
"prefs set client.debug": {
"command": "prefs set client.debug",
Expand Down Expand Up @@ -12973,6 +12978,6 @@
"metadata": {
"commands_extracted": 748,
"extracted_by": "PM3Help2JSON v1.00",
"extracted_on": "2024-10-12T11:55:26"
"extracted_on": "2024-10-18T15:36:53"
}
}

0 comments on commit 0c2ef9d

Please sign in to comment.