Created
June 12, 2016 04:54
-
-
Save leepupu/01ae2064ddc50aea9ff0d59061da1e38 to your computer and use it in GitHub Desktop.
amadhj by angr
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 | |
# import IPython | |
import claripy | |
import logging | |
import code | |
test_func = 0x4026D1 | |
concated_str = [] | |
def patch_read(s): | |
global concated_str | |
print 'patch' | |
t = [] | |
for i in range(4): | |
inp = s.se.BVS('usr_input', 8*8) | |
s.memory.store(s.regs.rsi+8*i, inp) | |
t.append(inp) | |
concated_str.append(claripy.Concat(*t)) | |
return | |
logging.basicConfig() | |
logging.getLogger('angr.surveyors.explorer').setLevel(logging.DEBUG) | |
b = angr.Project('./amadhj') | |
b.hook(0x4026FD, patch_read, length=5) | |
s = b.factory.blank_state(addr=test_func) | |
s.regs.rdi = 0x1000 # make sure symbolic symbol at same location | |
def exp(): | |
global concated_str | |
path = b.factory.path(state=s) | |
ex = b.surveyors.Explorer(start=path, find=(0x040287F,), avoid=(0x0402886,), enable_veritesting=True) | |
ex.run() | |
yyy = concated_str | |
if ex.found: | |
print "found" | |
code.interact(local=locals()) | |
for ss in concated_str: | |
print ex.found[0].state.se.any_str(ss) | |
exp() | |
# some solutions | |
# ' IRrRAFBlelUzHZYumaqXfgTARantfSd' | |
# 'A PrFURjDMboQJ ScKvoH cDl BQDqp' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment