Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def angr_checks(self, t):
dsb = archr.arsenal.DataScoutBow(t)
apb = archr.arsenal.angrProjectBow(t, dsb)
asb = archr.arsenal.angrStateBow(t, apb)
project = apb.fire()
assert all(obj.binary.startswith("/tmp") for obj in project.loader.all_elf_objects[1:])
state = asb.fire()
initial_stack = state.solver.eval(state.memory.load(state.regs.rsp, 200), cast_to=bytes)
assert b"ARCHR=YES" in initial_stack
assert state.solver.eval_one(state.posix.brk == apb._mem_mapping['[heap]'])
assert state.solver.eval_one((state.regs.sp + 0xfff) & ~claripy.BVV(0xfff, project.arch.bits) == apb._mem_mapping['[stack-end]'])
# now screw with the memory map
apb._mem_mapping['[stack-end]'] = 0x1337000
state = asb.fire()
assert state.solver.eval_one((state.regs.sp + 0xfff) & ~claripy.BVV(0xfff, project.arch.bits) == apb._mem_mapping['[stack-end]'])
project.loader.close()
def test_crasher(self):
with archr.targets.DockerImageTarget('archr-test:crasher').build().start() as t:
cb = archr.arsenal.CoreBow(t)
r = cb.fire()
assert b"LSB core file" in subprocess.check_output(["file", r.local_core_path])