mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
hf mf darkside - textual adaptation to current style
This commit is contained in:
parent
abacf673dc
commit
28efc8b097
2 changed files with 27 additions and 25 deletions
|
@ -314,7 +314,6 @@ static int CmdHF14AMfAcl(const char *Cmd) {
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int CmdHF14AMfDarkside(const char *Cmd) {
|
static int CmdHF14AMfDarkside(const char *Cmd) {
|
||||||
CLIParserContext *ctx;
|
CLIParserContext *ctx;
|
||||||
CLIParserInit(&ctx, "hf mf darkside",
|
CLIParserInit(&ctx, "hf mf darkside",
|
||||||
|
@ -343,31 +342,32 @@ static int CmdHF14AMfDarkside(const char *Cmd) {
|
||||||
CLIParserFree(ctx);
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
uint64_t key = 0;
|
uint64_t key = 0;
|
||||||
|
uint64_t t1 = msclock();
|
||||||
int isOK = mfDarkside(blockno, key_type, &key);
|
int isOK = mfDarkside(blockno, key_type, &key);
|
||||||
PrintAndLogEx(NORMAL, "");
|
t1 = msclock() - t1;
|
||||||
|
|
||||||
switch (isOK) {
|
switch (isOK) {
|
||||||
case -1 :
|
case -1 :
|
||||||
PrintAndLogEx(WARNING, "button pressed. Aborted.");
|
PrintAndLogEx(WARNING, "button pressed, aborted");
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
case -2 :
|
case -2 :
|
||||||
PrintAndLogEx(FAILED, "card is not vulnerable to Darkside attack (doesn't send NACK on authentication requests).");
|
PrintAndLogEx(FAILED, "card is not vulnerable to Darkside attack (doesn't send NACK on authentication requests)");
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
case -3 :
|
case -3 :
|
||||||
PrintAndLogEx(FAILED, "card is not vulnerable to Darkside attack (its random number generator is not predictable).");
|
PrintAndLogEx(FAILED, "card is not vulnerable to Darkside attack (its random number generator is not predictable)");
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
case -4 :
|
case -4 :
|
||||||
PrintAndLogEx(FAILED, "card is not vulnerable to Darkside attack (its random number generator seems to be based on the wellknown");
|
PrintAndLogEx(FAILED, "card is not vulnerable to Darkside attack (its random number generator seems to be based on the wellknown");
|
||||||
PrintAndLogEx(FAILED, "generating polynomial with 16 effective bits only, but shows unexpected behaviour.");
|
PrintAndLogEx(FAILED, "generating polynomial with 16 effective bits only, but shows unexpected behaviour");
|
||||||
return PM3_ESOFT;
|
|
||||||
case -5 :
|
|
||||||
PrintAndLogEx(WARNING, "aborted via keyboard.");
|
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
|
case PM3_EOPABORTED :
|
||||||
|
PrintAndLogEx(WARNING, "aborted via keyboard");
|
||||||
|
return PM3_EOPABORTED;
|
||||||
default :
|
default :
|
||||||
PrintAndLogEx(SUCCESS, "found valid key: "_YELLOW_("%012" PRIx64), key);
|
PrintAndLogEx(SUCCESS, "found valid key: "_GREEN_("%012" PRIx64), key);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
PrintAndLogEx(NORMAL, "");
|
PrintAndLogEx(SUCCESS, "time in darkside " _YELLOW_("%.0f") " seconds\n",(float)t1 / 1000.0);
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,10 +44,8 @@ int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key) {
|
||||||
bool first_run = true;
|
bool first_run = true;
|
||||||
|
|
||||||
// message
|
// message
|
||||||
PrintAndLogEx(INFO, "--------------------------------------------------------------------------------");
|
PrintAndLogEx(INFO, "Expected execution time is about 25seconds on average");
|
||||||
PrintAndLogEx(INFO, "Executing darkside attack. Expected execution time: 25sec on average");
|
PrintAndLogEx(INFO, "Press pm3-button to abort");
|
||||||
PrintAndLogEx(INFO, "press pm3-button on the Proxmark3 device to abort both Proxmark3 and client");
|
|
||||||
PrintAndLogEx(INFO, "--------------------------------------------------------------------------------");
|
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
|
@ -63,16 +61,19 @@ int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key) {
|
||||||
|
|
||||||
//flush queue
|
//flush queue
|
||||||
while (kbd_enter_pressed()) {
|
while (kbd_enter_pressed()) {
|
||||||
|
SendCommandNG(CMD_BREAK_LOOP, NULL, 0);
|
||||||
return PM3_EOPABORTED;
|
return PM3_EOPABORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintAndLogEx(INFO, "." NOLF);
|
PrintAndLogEx(NORMAL, "");
|
||||||
|
PrintAndLogEx(INFO, "Running darkside " NOLF);
|
||||||
|
|
||||||
// wait cycle
|
// wait cycle
|
||||||
while (true) {
|
while (true) {
|
||||||
PrintAndLogEx(NORMAL, "." NOLF);
|
PrintAndLogEx(NORMAL, "." NOLF);
|
||||||
|
|
||||||
if (kbd_enter_pressed()) {
|
if (kbd_enter_pressed()) {
|
||||||
|
SendCommandNG(CMD_BREAK_LOOP, NULL, 0);
|
||||||
return PM3_EOPABORTED;
|
return PM3_EOPABORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +113,7 @@ int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PrintAndLogEx(NORMAL, "\n");
|
PrintAndLogEx(NORMAL, "");
|
||||||
|
|
||||||
if (par_list == 0 && first_run == true) {
|
if (par_list == 0 && first_run == true) {
|
||||||
PrintAndLogEx(SUCCESS, "Parity is all zero. Most likely this card sends NACK on every authentication.");
|
PrintAndLogEx(SUCCESS, "Parity is all zero. Most likely this card sends NACK on every authentication.");
|
||||||
|
@ -122,8 +123,9 @@ int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key) {
|
||||||
uint32_t keycount = nonce2key(uid, nt, nr, ar, par_list, ks_list, &keylist);
|
uint32_t keycount = nonce2key(uid, nt, nr, ar, par_list, ks_list, &keylist);
|
||||||
|
|
||||||
if (keycount == 0) {
|
if (keycount == 0) {
|
||||||
PrintAndLogEx(FAILED, "key not found (lfsr_common_prefix list is null). Nt=%08x", nt);
|
PrintAndLogEx(FAILED, "Key not found (lfsr_common_prefix list is null). Nt = %08x", nt);
|
||||||
PrintAndLogEx(FAILED, "this is expected to happen in 25%% of all cases. Trying again with a different reader nonce...");
|
PrintAndLogEx(FAILED, "This is expected to happen in 25%% of all cases.");
|
||||||
|
PrintAndLogEx(FAILED, "Trying again with a different reader nonce...");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,12 +136,12 @@ int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key) {
|
||||||
if (keycount == 0) {
|
if (keycount == 0) {
|
||||||
free(last_keylist);
|
free(last_keylist);
|
||||||
last_keylist = keylist;
|
last_keylist = keylist;
|
||||||
PrintAndLogEx(FAILED, "no candidates found, trying again");
|
PrintAndLogEx(FAILED, "No candidates found, trying again");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintAndLogEx(SUCCESS, "found " _YELLOW_("%u") " candidate key%s", keycount, (keycount > 1) ? "s." : ".");
|
PrintAndLogEx(SUCCESS, "found " _YELLOW_("%u") " candidate key%s", keycount, (keycount > 1) ? "s" : "");
|
||||||
|
|
||||||
*key = UINT64_C(-1);
|
*key = UINT64_C(-1);
|
||||||
uint8_t keyBlock[PM3_CMD_DATA_SIZE];
|
uint8_t keyBlock[PM3_CMD_DATA_SIZE];
|
||||||
|
@ -164,7 +166,7 @@ int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key) {
|
||||||
if (*key != UINT64_C(-1)) {
|
if (*key != UINT64_C(-1)) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
PrintAndLogEx(FAILED, "all key candidates failed. Restarting darkside attack");
|
PrintAndLogEx(FAILED, "All key candidates failed. Restarting darkside");
|
||||||
free(last_keylist);
|
free(last_keylist);
|
||||||
last_keylist = keylist;
|
last_keylist = keylist;
|
||||||
first_run = true;
|
first_run = true;
|
||||||
|
@ -555,7 +557,7 @@ int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo,
|
||||||
free(statelists[1].head.slhead);
|
free(statelists[1].head.slhead);
|
||||||
num_to_bytes(key64, 6, resultKey);
|
num_to_bytes(key64, 6, resultKey);
|
||||||
|
|
||||||
PrintAndLogEx(SUCCESS, "\ntarget block: %3u key type: %c -- found valid key [ " _GREEN_("%s") " ]",
|
PrintAndLogEx(SUCCESS, "\ntarget block %4u key type %c -- found valid key [ " _GREEN_("%s") " ]",
|
||||||
package->block,
|
package->block,
|
||||||
package->keytype ? 'B' : 'A',
|
package->keytype ? 'B' : 'A',
|
||||||
sprint_hex_inrow(resultKey, 6)
|
sprint_hex_inrow(resultKey, 6)
|
||||||
|
@ -568,7 +570,7 @@ int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo,
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
PrintAndLogEx(SUCCESS, "\ntarget block: %3u key type: %c",
|
PrintAndLogEx(SUCCESS, "\ntarget block %4u key type %c",
|
||||||
package->block,
|
package->block,
|
||||||
package->keytype ? 'B' : 'A'
|
package->keytype ? 'B' : 'A'
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue