Skip to content

Instantly share code, notes, and snippets.

@ymgve
Created November 6, 2017 02:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ymgve/d2038cc303ff6ee6a6a2ac1827210d92 to your computer and use it in GitHub Desktop.
Save ymgve/d2038cc303ff6ee6a6a2ac1827210d92 to your computer and use it in GitHub Desktop.
import angr
data = open("sakura-fdb3c896d8a3029f40a38150b2e30a79", "rb").read()
findseq = []
avoid = []
index = 0
count = 0
while True:
res = data.find("\xC6\x85\xB7\xE1\xFF\xFF\x00", index)
if res == -1:
break
if count % 3 == 2:
findseq.append(0x400000 + res + 7)
avoid.append(0x400000 + res)
count += 1
index = res + 1
proj = angr.Project('./sakura-fdb3c896d8a3029f40a38150b2e30a79')
state = proj.factory.entry_state()
for find in findseq:
print hex(find)
simgr = proj.factory.simgr(state)
simgr.explore(find=find, avoid=avoid)
state = simgr.found[0]
print repr(state.posix.dumps(0))
open("input", "wb").write(state.posix.dumps(0))
# cat input | ./sakura-fdb3c896d8a3029f40a38150b2e30a79
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment