From a4e8dd9b81952e7e2706fd2ebd6895bf4a2bb154 Mon Sep 17 00:00:00 2001 From: maride Date: Fri, 13 May 2022 23:27:15 +0200 Subject: [PATCH] Avoid printing intermediate key if win breakpoint is already hit --- src/Bruteforce.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Bruteforce.py b/src/Bruteforce.py index 7793ae5..dfa0787 100644 --- a/src/Bruteforce.py +++ b/src/Bruteforce.py @@ -59,12 +59,7 @@ def Bruteforce(bm, tm, knownPrefix, knownSuffix, chunksize): return knownPrefix + knownSuffix else: # good input, we stepped further - knownPrefix += res - EnableLogging() - print(f"Found new scorer, we're now at '{knownPrefix}[...]{knownSuffix}'") - DisableLogging() - - # let's examine it further - check if we hit the win breakpoint :) + # let's examine it - check if we hit the win breakpoint :) if bm.HitWin() or not bm.HitLose(): EnableLogging() print("BARF found the flag - or at least managed to hit the 'win' breakpoint!") @@ -72,6 +67,12 @@ def Bruteforce(bm, tm, knownPrefix, knownSuffix, chunksize): DisableLogging() return knownPrefix + knownSuffix + # No win breakpoint hit, but still a good step forward - proceed + knownPrefix += res + EnableLogging() + print(f"Found new scorer, we're now at '{knownPrefix}[...]{knownSuffix}'") + DisableLogging() + # Finds out the base score when filling the binary with partly correct chars (e.g. the already found-to-be-correct prefix) # It does this by combining knownPrefix + keyFragment and knownSuffix with an "impossible" character.