mirror of
https://github.com/maride/barf.git
synced 2026-04-17 12:35:45 +00:00
Add lose address (counterpart to win address)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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}'")
|
||||
|
||||
Reference in New Issue
Block a user