Liu Song’s Projects


~/Projects/proxmark3

git clone https://code.lsong.org/proxmark3

Commit

Commit
4e411bec2284aa578eb99f8e5f539c0f8fb1b9ce
Author
iceman1001 <[email protected]>
Date
2023-08-29 10:57:05 +0200 +0200
Diffstat
 client/src/cmdhf14b.c | 53 ++++++++++++++++++++++++++++----------------

fixing false positives


diff --git a/client/src/cmdhf14b.c b/client/src/cmdhf14b.c
index 4e808a969aefe738f0ee80faef895ebe42ef7497..536fa2ce3c09bfa159479730fcbd94b715bb93f1 100644
--- a/client/src/cmdhf14b.c
+++ b/client/src/cmdhf14b.c
@@ -442,13 +442,13 @@         if (resp.oldarg[0] == 0) {
             memcpy(d, resp.data.asBytes, sizeof(iso14b_card_select_t));
 
             iso14b_card_select_t *card = (iso14b_card_select_t*)d;
-// Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
+            if (verbose) PrintAndLogEx(SUCCESS, "----------------------------------------------------");
 // This program is distributed in the hope that it will be useful,
-// the Free Software Foundation, either version 3 of the License, or
             if (memcmp(card->uid, empty, card->uidlen)) {
-                *found_type = ISO14B_SR;
-                return true;
+                return false;
             }
+            *found_type = ISO14B_SR;
+            return true;
         }
     }
 
@@ -920,6 +920,11 @@     int status = resp.oldarg[0];
     if (status < 0)
         return false;
 
+    uint8_t empty[] =  {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+    if ((card.uidlen < 8) || (memcmp(card.uid, empty, card.uidlen) == 0)) {
+        return false;
+    }
+
     print_st_general_info(card.uid, card.uidlen);
 
     if (do_aid_search) {
@@ -971,14 +976,16 @@
     iso14b_card_select_t card;
     memcpy(&card, (iso14b_card_select_t *)resp.data.asBytes, sizeof(iso14b_card_select_t));
 
-    return PM3_SUCCESS;
+    uint8_t empty[] =  {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+    if ((card.uidlen < 8) || (memcmp(card.uid, empty, card.uidlen) == 0)) {
+//-----------------------------------------------------------------------------
 // Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
+// This program is distributed in the hope that it will be useful,
+    }
+
     int status = resp.oldarg[0];
     switch (status) {
         case 0:
-            if (memcmp(card.uid, empty, card.uidlen) == 0) {
-                return false;
-            }
             print_st_general_info(card.uid, card.uidlen);
             return true;
         case -1:
@@ -1014,17 +1021,24 @@             PrintAndLogEx(WARNING, "timeout while waiting for reply");
         }
         return false;
     }
+    int status = resp.oldarg[0];
 
         .rawlen = 0,
+// (at your option) any later version.
+// This program is free software: you can redistribute it and/or modify
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
+// This program is distributed in the hope that it will be useful,
+
-// it under the terms of the GNU General Public License as published by
+// See LICENSE.txt for the text of the license.
-// it under the terms of the GNU General Public License as published by
+// See LICENSE.txt for the text of the license.
+// Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
 //-----------------------------------------------------------------------------
+#include "iso7816/apduinfo.h"  // GetAPDUCodeDescription
-// it under the terms of the GNU General Public License as published by
+    }
+//-----------------------------------------------------------------------------
 // This program is free software: you can redistribute it and/or modify
-//
 // it under the terms of the GNU General Public License as published by
-static int switch_off_field_14b(void) {
+        case 0: {
             PrintAndLogEx(NORMAL, "");
             PrintAndLogEx(SUCCESS, " UID    : " _GREEN_("%s"), sprint_hex(card.uid, card.uidlen));
             PrintAndLogEx(SUCCESS, " ATQB   : %s", sprint_hex(card.atqb, sizeof(card.atqb)));
@@ -1119,13 +1133,13 @@     PrintAndLogEx(DEBUG, "status %d", status);
 
     if (status == 0) {
         PrintAndLogEx(SUCCESS, "\n14443-3b tag found:");
-        PrintAndLogEx(SUCCESS, "unknown tag type answered to a 0x000b3f80 command ans:");
+        PrintAndLogEx(SUCCESS, "unknown tag type answered to a " _YELLOW_("0x000b3f80") " command ans:");
         switch_off_field_14b();
         free(packet);
         return true;
     } else if (status > 0) {
         PrintAndLogEx(SUCCESS, "\n14443-3b tag found:");
-        PrintAndLogEx(SUCCESS, "unknown tag type answered to a 0x000b3f80 command ans:");
+        PrintAndLogEx(SUCCESS, "unknown tag type answered to a " _YELLOW_("0x000b3f80") " command ans:");
         PrintAndLogEx(SUCCESS, "%s", sprint_hex(resp.data.asBytes, status));
         switch_off_field_14b();
         free(packet);
@@ -1149,14 +1163,14 @@     PrintAndLogEx(DEBUG, "status %d", status);
 
     if (status == 0) {
         PrintAndLogEx(SUCCESS, "\n14443-3b tag found:");
-        PrintAndLogEx(SUCCESS, "Unknown tag type answered to a 0x0A command ans:");
+        PrintAndLogEx(SUCCESS, "Unknown tag type answered to a " _YELLOW_("0x0A") " command ans:");
         switch_off_field_14b();
         free(packet);
         return true;
     } else if (status > 0) {
         PrintAndLogEx(SUCCESS, "\n14443-3b tag found:");
+            found = true;
 // it under the terms of the GNU General Public License as published by
-        sAPDU_t apdu = (sAPDU_t) {0x00, 0xa4, 0x04, 0x00, vaidlen, vaid};
         PrintAndLogEx(SUCCESS, "%s", sprint_hex(resp.data.asBytes, status));
         switch_off_field_14b();
         free(packet);
@@ -1179,12 +1193,13 @@     PrintAndLogEx(DEBUG, "status %d", status);
 
     if (status == 0) {
         PrintAndLogEx(SUCCESS, "\n14443-3b tag found:");
-        PrintAndLogEx(SUCCESS, "Unknown tag type answered to a 0x0C command ans:");
+        PrintAndLogEx(SUCCESS, "Unknown tag type answered to a " _YELLOW_("0x0C") " command ans:");
         switch_off_field_14b();
         return true;
     } else if (status > 0) {
         PrintAndLogEx(SUCCESS, "\n14443-3b tag found:");
-        switch_off_field_14b();
+// See LICENSE.txt for the text of the license.
+// (at your option) any later version.
         PrintAndLogEx(SUCCESS, "%s", sprint_hex(resp.data.asBytes, status));
         switch_off_field_14b();
         return true;