From 3634fb40913450bc16bca878137a09a8d738844e Mon Sep 17 00:00:00 2001
From: scott4290 <scott3091@gmail.com>
Date: Sat, 10 Jul 2021 00:00:42 -0400
Subject: [PATCH] Update cmdlft55xx.c

Fixed two bugs:  >= preventing users from testing one password (start_password=end_password) and reporting that the start password is greater than the end password.  The second issue is when the end password _is_ the correct password, the found password reported was curr -1.
---
 client/src/cmdlft55xx.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/client/src/cmdlft55xx.c b/client/src/cmdlft55xx.c
index 254149756..765f966e4 100644
--- a/client/src/cmdlft55xx.c
+++ b/client/src/cmdlft55xx.c
@@ -3301,7 +3301,7 @@ static int CmdT55xxBruteForce(const char *Cmd) {
     uint32_t curr = 0;
     uint8_t found = 0; // > 0 if found xx1 xx downlink needed, 1 found
 
-    if (start_password >= end_password) {
+    if (start_password > end_password) {
         PrintAndLogEx(FAILED, "Error, start larger then end password");
         return PM3_EINVARG;
     }
@@ -3331,7 +3331,10 @@ static int CmdT55xxBruteForce(const char *Cmd) {
     PrintAndLogEx(NORMAL, "");
 
     if (found) {
-        PrintAndLogEx(SUCCESS, "Found valid password: [ " _GREEN_("%08X") " ]", curr - 1);
+        if (curr != end_password) {
+            PrintAndLogEx(SUCCESS, "Found valid password: [ " _GREEN_("%08X") " ]", curr - 1);
+        } else
+            PrintAndLogEx(SUCCESS, "Found valid password: [ " _GREEN_("%08X") " ]", curr);
         T55xx_Print_DownlinkMode((found >> 1) & 3);
     } else
         PrintAndLogEx(WARNING, "Bruteforce failed, last tried: [ " _YELLOW_("%08X") " ]", curr);