angr: Error using simuvex unicorn plugin on MacOS
I get an error when using the unicorn engine for the analysis:
s = p.factory.blank_state(addr=0x401260, add_options=simuvex.o.unicorn, remove_options={simuvex.o.LAZY_SOLVES})
I installed Angr in a pypy virtualenv so had to install unicorn manually (not available in pip), but I tried several unicorn scripts and they work ok and when installing Angr, it finds it:
Requirement already satisfied (use --upgrade to upgrade): unicorn in /Users/alvaro/virtualenvs/angr_pypy/site-packages/unicorn-1.0-py2.7.egg (from simuvex->angr)
but when I select the unicorn engine I get the following error (add_options=simuvex.o.unicorn
):
Traceback (most recent call last):
File "app_main.py", line 75, in run_toplevel
File "solve_rock_angr.py", line 40, in <module>
print main()
File "solve_rock_angr.py", line 25, in main
pg.explore(find=0x401428, avoid=0x40186d)
File "/Users/alvaro/virtualenvs/angr_pypy/site-packages/angr/path_group.py", line 806, in explore
n=n)
File "/Users/alvaro/virtualenvs/angr_pypy/site-packages/angr/path_group.py", line 830, in run
return self.step(n=n, step_func=step_func, until=until_func, stash=stash)
File "/Users/alvaro/virtualenvs/angr_pypy/site-packages/angr/path_group.py", line 520, in step
pg = pg._one_step(stash=stash, selector_func=selector_func, successor_func=successor_func, check_func=check_func, **kwargs)
File "/Users/alvaro/virtualenvs/angr_pypy/site-packages/angr/path_group.py", line 311, in _one_step
r = self._one_path_step(a, successor_func=successor_func, check_func=check_func, **kwargs)
File "/Users/alvaro/virtualenvs/angr_pypy/site-packages/angr/path_group.py", line 208, in _one_path_step
successors = a.step(**kwargs)
File "/Users/alvaro/virtualenvs/angr_pypy/site-packages/angr/path.py", line 337, in step
self._make_sim_run(throw=throw)
File "/Users/alvaro/virtualenvs/angr_pypy/site-packages/angr/path.py", line 368, in _make_sim_run
self._run = self._project.factory.sim_run(self.state, **self._run_args)
File "/Users/alvaro/virtualenvs/angr_pypy/site-packages/angr/factory.py", line 167, in sim_run
r = SimUnicorn(state, stop_points=stops)
File "/Users/alvaro/virtualenvs/angr_pypy/site-packages/simuvex/s_unicorn.py", line 29, in __init__
self.state.unicorn.setup()
File "/Users/alvaro/virtualenvs/angr_pypy/site-packages/simuvex/plugins/unicorn_engine.py", line 825, in setup
self._uc_state = _UC_NATIVE.alloc(self.uc._uch, self.cache_key)
AttributeError: 'NoneType' object has no attribute 'alloc'
_UC_NATIVE
seems to reference sim_unicorn.dylib
in MacOS. Is this a simuvex library? I can only find libunicorn.dylib
in my system.
Thanks, A
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 44 (31 by maintainers)
Sorry for my reply late to this thread. I finally solved the issue as there was some confusion going on with the filenames and paths. So here is the thing, after I did
pip install angr
, there exists the following files/Library/Python/2.7/site-packages/unicorn/lib/libunicorn.dylib
/Library/Python/2.7/site-packages/simuvex/lib/sim_unicorn.dylib
Then I did run the following commands
sudo install_name_tool -change libunicorn.1.dylib /Library/Python/2.7/site-packages/unicorn/lib/libunicorn.dylib /Library/Python/2.7/site-packages/simuvex/lib/sim_unicorn.dylib
sudo install_name_tool -change libpyvex.dylib /Library/Python/2.7/site-packages/pyvex/lib/libpyvex.dylib /Library/Python/2.7/site-packages/simuvex/lib/sim_unicorn.dylib
And now I can
import angr
without any anger! š Thanks a lot @ltfish @rhelmot for being consistently patient with me. š š@ltfish Pardon my ignorance but Iām not familiar with
DYLIB_LIBRARY_PATH
.Iām installing angr as follows:
and this is what Iām getting in the Python REPL
What do you suggest I should do?