mirror of
https://github.com/maride/barf.git
synced 2025-01-10 05:57:28 +00:00
Avoid printing intermediate key if win breakpoint is already hit
This commit is contained in:
parent
2413c84586
commit
a4e8dd9b81
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user