mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
add fflush back
This commit is contained in:
parent
5b695153b6
commit
c15101e45b
1 changed files with 30 additions and 17 deletions
|
@ -996,6 +996,8 @@ static int CmdHF14AMfDump(const char *Cmd) {
|
||||||
return PM3_EFILE;
|
return PM3_EFILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PrintAndLogEx(INFO, "Using `" _YELLOW_("%s") "`", keyFilename);
|
||||||
|
|
||||||
// Read keys A from file
|
// Read keys A from file
|
||||||
size_t bytes_read;
|
size_t bytes_read;
|
||||||
for (sectorNo = 0; sectorNo < numSectors; sectorNo++) {
|
for (sectorNo = 0; sectorNo < numSectors; sectorNo++) {
|
||||||
|
@ -1026,6 +1028,7 @@ static int CmdHF14AMfDump(const char *Cmd) {
|
||||||
for (sectorNo = 0; sectorNo < numSectors; sectorNo++) {
|
for (sectorNo = 0; sectorNo < numSectors; sectorNo++) {
|
||||||
for (tries = 0; tries < MIFARE_SECTOR_RETRY; tries++) {
|
for (tries = 0; tries < MIFARE_SECTOR_RETRY; tries++) {
|
||||||
PrintAndLogEx(NORMAL, "." NOLF);
|
PrintAndLogEx(NORMAL, "." NOLF);
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
payload.blockno = FirstBlockOfSector(sectorNo) + NumBlocksPerSector(sectorNo) - 1;
|
payload.blockno = FirstBlockOfSector(sectorNo) + NumBlocksPerSector(sectorNo) - 1;
|
||||||
payload.keytype = 0;
|
payload.keytype = 0;
|
||||||
|
@ -1357,7 +1360,7 @@ static int CmdHF14AMfNested(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if tag doesn't have static nonce
|
// check if tag doesn't have static nonce
|
||||||
if (detect_classic_static_nonce() == 1) {
|
if (detect_classic_static_nonce()) {
|
||||||
PrintAndLogEx(WARNING, "Static nonce detected. Quitting...");
|
PrintAndLogEx(WARNING, "Static nonce detected. Quitting...");
|
||||||
PrintAndLogEx(INFO, "\t Try use " _YELLOW_("`hf mf staticnested`"));
|
PrintAndLogEx(INFO, "\t Try use " _YELLOW_("`hf mf staticnested`"));
|
||||||
return PM3_EOPABORTED;
|
return PM3_EOPABORTED;
|
||||||
|
@ -1607,8 +1610,8 @@ static int CmdHF14AMfNestedStatic(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if tag have static nonce
|
// check if tag have static nonce
|
||||||
if (detect_classic_static_nonce() == 0) {
|
if (detect_classic_static_nonce() == false) {
|
||||||
PrintAndLogEx(WARNING, "None static nonce detected. Quitting...");
|
PrintAndLogEx(WARNING, "Normal nonce detected, or failed read of card. Quitting...");
|
||||||
PrintAndLogEx(INFO, "\t Try use " _YELLOW_("`hf mf nested`"));
|
PrintAndLogEx(INFO, "\t Try use " _YELLOW_("`hf mf nested`"));
|
||||||
return PM3_EOPABORTED;
|
return PM3_EOPABORTED;
|
||||||
}
|
}
|
||||||
|
@ -1921,7 +1924,7 @@ static int CmdHF14AMfNestedHard(const char *Cmd) {
|
||||||
if (!know_target_key && nonce_file_read == false) {
|
if (!know_target_key && nonce_file_read == false) {
|
||||||
|
|
||||||
// check if tag doesn't have static nonce
|
// check if tag doesn't have static nonce
|
||||||
if (detect_classic_static_nonce() == 1) {
|
if (detect_classic_static_nonce()) {
|
||||||
PrintAndLogEx(WARNING, "Static nonce detected. Quitting...");
|
PrintAndLogEx(WARNING, "Static nonce detected. Quitting...");
|
||||||
PrintAndLogEx(HINT, "\tTry use `" _YELLOW_("hf mf staticnested") "`");
|
PrintAndLogEx(HINT, "\tTry use `" _YELLOW_("hf mf staticnested") "`");
|
||||||
return PM3_EOPABORTED;
|
return PM3_EOPABORTED;
|
||||||
|
@ -2002,7 +2005,7 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
|
||||||
bool slow = false;
|
bool slow = false;
|
||||||
bool legacy_mfchk = false;
|
bool legacy_mfchk = false;
|
||||||
int prng_type = PM3_EUNDEF;
|
int prng_type = PM3_EUNDEF;
|
||||||
int has_staticnonce = 2;
|
int has_staticnonce;
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
bool has_filename = false;
|
bool has_filename = false;
|
||||||
bool errors = false;
|
bool errors = false;
|
||||||
|
@ -2120,16 +2123,19 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
|
||||||
// read uid to generate a filename for the key file
|
// read uid to generate a filename for the key file
|
||||||
char *fptr = GenerateFilename("hf-mf-", "-key.bin");
|
char *fptr = GenerateFilename("hf-mf-", "-key.bin");
|
||||||
|
|
||||||
|
|
||||||
|
// check if tag doesn't have static nonce
|
||||||
|
has_staticnonce = detect_classic_static_nonce();
|
||||||
|
|
||||||
// card prng type (weak=1 / hard=0 / select/card comm error = negative value)
|
// card prng type (weak=1 / hard=0 / select/card comm error = negative value)
|
||||||
|
if (has_staticnonce == NONCE_NORMAL) {
|
||||||
prng_type = detect_classic_prng();
|
prng_type = detect_classic_prng();
|
||||||
if (prng_type < 0) {
|
if (prng_type < 0) {
|
||||||
PrintAndLogEx(FAILED, "\nNo tag detected or other tag communication error");
|
PrintAndLogEx(FAILED, "\nNo tag detected or other tag communication error");
|
||||||
free(e_sector);
|
free(e_sector);
|
||||||
return prng_type;
|
return prng_type;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// check if tag doesn't have static nonce
|
|
||||||
has_staticnonce = detect_classic_static_nonce();
|
|
||||||
|
|
||||||
// print parameters
|
// print parameters
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
|
@ -2140,10 +2146,12 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
|
||||||
PrintAndLogEx(INFO, " keytype ....... " _YELLOW_("%c"), keyType ? 'B' : 'A');
|
PrintAndLogEx(INFO, " keytype ....... " _YELLOW_("%c"), keyType ? 'B' : 'A');
|
||||||
PrintAndLogEx(INFO, " known key ..... " _YELLOW_("%s"), sprint_hex(key, sizeof(key)));
|
PrintAndLogEx(INFO, " known key ..... " _YELLOW_("%s"), sprint_hex(key, sizeof(key)));
|
||||||
|
|
||||||
if (has_staticnonce)
|
if (has_staticnonce == NONCE_STATIC)
|
||||||
PrintAndLogEx(INFO, " card PRNG ..... " _YELLOW_("%s & STATIC"), prng_type ? "WEAK" : "HARD");
|
PrintAndLogEx(INFO, " card PRNG ..... " _YELLOW_("STATIC"));
|
||||||
else
|
else if (has_staticnonce == NONCE_NORMAL)
|
||||||
PrintAndLogEx(INFO, " card PRNG ..... " _YELLOW_("%s"), prng_type ? "WEAK" : "HARD");
|
PrintAndLogEx(INFO, " card PRNG ..... " _YELLOW_("%s"), prng_type ? "WEAK" : "HARD");
|
||||||
|
else
|
||||||
|
PrintAndLogEx(INFO, " card PRNG ..... " _YELLOW_("Could not determine PRNG,") " " _RED_("read failed."));
|
||||||
|
|
||||||
PrintAndLogEx(INFO, " dictionary .... " _YELLOW_("%s"), strlen(filename) ? filename : "NONE");
|
PrintAndLogEx(INFO, " dictionary .... " _YELLOW_("%s"), strlen(filename) ? filename : "NONE");
|
||||||
PrintAndLogEx(INFO, " legacy mode ... " _YELLOW_("%s"), legacy_mfchk ? "True" : "False");
|
PrintAndLogEx(INFO, " legacy mode ... " _YELLOW_("%s"), legacy_mfchk ? "True" : "False");
|
||||||
|
@ -2259,6 +2267,7 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
|
||||||
if (e_sector[i].foundKey[j] == 0) {
|
if (e_sector[i].foundKey[j] == 0) {
|
||||||
for (uint32_t k = 0; k < key_cnt; k++) {
|
for (uint32_t k = 0; k < key_cnt; k++) {
|
||||||
PrintAndLogEx(NORMAL, "." NOLF);
|
PrintAndLogEx(NORMAL, "." NOLF);
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
if (mfCheckKeys(FirstBlockOfSector(i), j, true, 1, (keyBlock + (6 * k)), &key64) == PM3_SUCCESS) {
|
if (mfCheckKeys(FirstBlockOfSector(i), j, true, 1, (keyBlock + (6 * k)), &key64) == PM3_SUCCESS) {
|
||||||
e_sector[i].Key[j] = bytes_to_num((keyBlock + (6 * k)), 6);
|
e_sector[i].Key[j] = bytes_to_num((keyBlock + (6 * k)), 6);
|
||||||
|
@ -3159,6 +3168,7 @@ static int CmdHF14AMfChk(const char *Cmd) {
|
||||||
for (uint16_t c = 0; c < keycnt; c += max_keys) {
|
for (uint16_t c = 0; c < keycnt; c += max_keys) {
|
||||||
|
|
||||||
PrintAndLogEx(NORMAL, "." NOLF);
|
PrintAndLogEx(NORMAL, "." NOLF);
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
if (kbd_enter_pressed()) {
|
if (kbd_enter_pressed()) {
|
||||||
PrintAndLogEx(INFO, "\naborted via keyboard!\n");
|
PrintAndLogEx(INFO, "\naborted via keyboard!\n");
|
||||||
|
@ -3737,6 +3747,7 @@ int CmdHF14AMfELoad(const char *Cmd) {
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
PrintAndLogEx(NORMAL, "." NOLF);
|
PrintAndLogEx(NORMAL, "." NOLF);
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
blockNum++;
|
blockNum++;
|
||||||
counter += blockWidth;
|
counter += blockWidth;
|
||||||
|
@ -4162,6 +4173,7 @@ static int CmdHF14AMfCLoad(const char *Cmd) {
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
PrintAndLogEx(NORMAL, "." NOLF);
|
PrintAndLogEx(NORMAL, "." NOLF);
|
||||||
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
PrintAndLogEx(NORMAL, "\n");
|
PrintAndLogEx(NORMAL, "\n");
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
|
@ -4424,6 +4436,7 @@ static int CmdHF14AMfCSave(const char *Cmd) {
|
||||||
PrintAndLogEx(WARNING, "Cant set emul block: %d", i);
|
PrintAndLogEx(WARNING, "Cant set emul block: %d", i);
|
||||||
}
|
}
|
||||||
PrintAndLogEx(NORMAL, "." NOLF);
|
PrintAndLogEx(NORMAL, "." NOLF);
|
||||||
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
PrintAndLogEx(NORMAL, "\n");
|
PrintAndLogEx(NORMAL, "\n");
|
||||||
PrintAndLogEx(SUCCESS, "uploaded %d bytes to emulator memory", bytes);
|
PrintAndLogEx(SUCCESS, "uploaded %d bytes to emulator memory", bytes);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue