manticore/examples/script/lads-baby-re.py
Yan dde79a0bab Remove ManticoreControl object [#180] (#4)
* Remove ManticoreControl object
* Some changes were brought in from dev-symbolicate-api
* Add Manticore.terminate()
* Add State.abandon()
* Update sample scripts
* Remove ctl from README
* Fix tests
* Bring in changes from dev-symbolicate-api
* Lower-case wildcard
* string -> cstring
* abandon() docstring
* Rename "name" to "label"
* Remove obsolete comment
* Make NUL a possible value for the last byte of a cstring
* Fix AbandonState and add example binary&script
* name -> label in tests, manticore.py
* Ignore .DS_Store
* Update symbolicate_buffer docstring
2017-02-14 14:54:52 -05:00

31 lines
681 B
Python

'''
API v0.1.0
Solves modified version of baby-re, compiled for arm.
'''
import sys
from manticore import Manticore
if __name__ == '__main__':
path = sys.argv[1]
m = Manticore(path)
def myhook(ctx, state):
flag = ''
cpu = state.cpu
arraytop = cpu.R11
base = arraytop - 0x18
for i in xrange(4):
symbolic_input = cpu.read_int(base + i*4)
# TODO apis to contrain input to ascii
concrete_input = state.solve_one(symbolic_input)
flag += chr(concrete_input & 0xff)
print 'flag is:', flag
m.terminate()
m.add_hook(0x109f0, myhook)
m.start()
print 'done'