manticore/examples/script/lads-baby-re.py
Mark Mossberg fbe3a197ba Install instructions updates (#171)
* Install instructions updates

* Update README.md

* also need pip

* need to update, plus compact a few things

* add -y

* grammar?

* typos

* Add bountysource link

* consistency

* Point users to the examples dir and wiki

I thought these links were cluttering things a bit, and 2 out of 3 of
them aren’t official documentation yet we’re linking to them in the
first line of the README. I updated the wiki to address these directly
in a way I think is more clear.

* link to Z3 releases

* oops, don't know where that came from

* ensure people run the latest pip

* be more explicit

* Add an Issue Template

* be more explicit

* no longer appropriate here

* unnecessary

* add note about 16.04

* move issue template to hidden folder

* Spelling

* be explicit, makes copy/paste easier
2017-04-24 12:19:10 -04:00

30 lines
657 B
Python
Executable File

#!/usr/bin/env python
import sys
from manticore import Manticore
'''
Solves modified version of baby-re, compiled for arm.
'''
if __name__ == '__main__':
path = sys.argv[1]
m = Manticore(path)
@m.hook(0x109f0)
def myhook(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.run()