improved staticnonce tristate processing
This commit is contained in:
@@ -1956,12 +1956,17 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
|
||||
isMagic = detect_classic_magic();
|
||||
|
||||
if (isMifareClassic) {
|
||||
|
||||
int res = detect_classic_static_nonce();
|
||||
if (res == 1)
|
||||
if (res == NONCE_STATIC)
|
||||
PrintAndLogEx(SUCCESS, "Static nonce: " _YELLOW_("yes"));
|
||||
if (res == 2 && verbose)
|
||||
PrintAndLogEx(SUCCESS, "Static nonce: " _RED_("fail"));
|
||||
if (res != 1) { // not static
|
||||
|
||||
if (res == NONCE_FAIL && verbose)
|
||||
PrintAndLogEx(SUCCESS, "Static nonce: " _RED_("read failed"));
|
||||
|
||||
if (res == NONCE_NORMAL) {
|
||||
|
||||
// not static
|
||||
res = detect_classic_prng();
|
||||
if (res == 1)
|
||||
PrintAndLogEx(SUCCESS, "Prng detection: " _GREEN_("weak"));
|
||||
|
||||
@@ -1144,19 +1144,14 @@ int detect_classic_static_nonce(void) {
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_HF_MIFARE_STATIC_NONCE, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
|
||||
if (WaitForResponseTimeout(CMD_HF_MIFARE_STATIC_NONCE, &resp, 500)) {
|
||||
if (WaitForResponseTimeout(CMD_HF_MIFARE_STATIC_NONCE, &resp, 1000)) {
|
||||
|
||||
if (resp.status == PM3_ESOFT)
|
||||
return 2;
|
||||
return NONCE_FAIL;
|
||||
|
||||
if (resp.data.asBytes[0] == 0)
|
||||
return 0;
|
||||
|
||||
if (resp.data.asBytes[0] != 0)
|
||||
return 1;
|
||||
return resp.data.asBytes[0];
|
||||
}
|
||||
return 2;
|
||||
return NONCE_FAIL;
|
||||
}
|
||||
|
||||
/* try to see if card responses to "chinese magic backdoor" commands. */
|
||||
|
||||
Reference in New Issue
Block a user