Add lose address (counterpart to win address)

This commit is contained in:
2021-06-18 13:54:16 +02:00
parent b1450323fd
commit 3991b4f482
4 changed files with 23 additions and 7 deletions

View File

@@ -11,14 +11,17 @@ class BreakpointManager:
posB = None
negB = None
winB = None
loseB = None
def __init__(self, pAddr, nAddr, wAddr):
def __init__(self, pAddr, nAddr, wAddr, lAddr):
if pAddr:
self.posB = CounterBreakpoint(pAddr, True)
if nAddr:
self.negB = CounterBreakpoint(nAddr, False)
if wAddr:
self.winB = CounterBreakpoint(wAddr, True)
if lAddr:
self.loseB = CounterBreakpoint(lAddr, False)
def GetScore(self):
score = 0
@@ -47,4 +50,10 @@ class BreakpointManager:
def HitWin(self):
if self.winB:
return self.winB.GetScore() != 0
return False
def HitLose(self):
if self.loseB:
return self.loseB.GetScore() != 0
return True

View File

@@ -65,7 +65,7 @@ def Bruteforce(bm, tm, knownPrefix, knownSuffix, chunksize):
DisableLogging()
# let's examine it further - check if we hit the win breakpoint :)
if bm.HitWin():
if bm.HitWin() or not bm.HitLose():
EnableLogging()
print("BARF found the flag - or at least managed to hit the 'win' breakpoint!")
print(f"Winning guess for the flag is '{knownPrefix + knownSuffix}'")