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
|
return knownPrefix + knownSuffix
|
||||||
else:
|
else:
|
||||||
# good input, we stepped further
|
# good input, we stepped further
|
||||||
knownPrefix += res
|
# let's examine it - check if we hit the win breakpoint :)
|
||||||
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 :)
|
|
||||||
if bm.HitWin() or not bm.HitLose():
|
if bm.HitWin() or not bm.HitLose():
|
||||||
EnableLogging()
|
EnableLogging()
|
||||||
print("BARF found the flag - or at least managed to hit the 'win' breakpoint!")
|
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()
|
DisableLogging()
|
||||||
return knownPrefix + knownSuffix
|
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)
|
# 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.
|
# It does this by combining knownPrefix + keyFragment and knownSuffix with an "impossible" character.
|
||||||
|
Loading…
Reference in New Issue
Block a user