p = angr.Project('./signal.exe') good = (0x0040179E) bad = (0x004016E6)
start = 0x00401760
state = p.factory.blank_state(addr=start) simgr = p.factory.simulation_manager(state) simgr.explore(find=good, avoid=bad) result = simgr.found[0]
for i in range(3): print (result.posix.dumps(i))
不用一会就拿到flag了
757515121f3d478
angr-ctf-0
学习angr的基本使用
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
import angr import sys binary = './angr_0' good = 0x401329
p = angr.Project(binary) state = p.factory.entry_state() simulation = p.factory.simgr(state) simulation.explore(find=good) if simulation.found: solution_state = simulation.found[0] for i in range(3): print (solution_state.posix.dumps(i)) else: raise Exception("Could not find the solution")
angr-ctf-1
这道题需要找到avoid, 这里有个小技巧,就是跑进avoid里去选
不然外部有多个avoid的话, 你要写很多个avoid
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
import angr import sys binary = './angr_1'
good = (0x4012D0) bad = (0x40127B)
p = angr.Project(binary) state = p.factory.entry_state() simulation = p.factory.simgr(state) simulation.explore(find=good, avoid=bad) if simulation.found: solution_state = simulation.found[0] for i in range(3): print (solution_state.posix.dumps(i)) else: raise Exception("Could not find the solution")
defis_good(state): returnb'Good Job'in state.posix.dumps(1) defis_bad(state): returnb'Try again'in state.posix.dumps(1) p = angr.Project(binary) state = p.factory.entry_state() simulation = p.factory.simgr(state) simulation.explore(find=is_good, avoid=is_bad) if simulation.found: solution_state = simulation.found[0] for i in range(3): print (solution_state.posix.dumps(i)) else: raise Exception("Could not find the solution")