Created
November 6, 2017 02:26
-
-
Save ymgve/d2038cc303ff6ee6a6a2ac1827210d92 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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