anvill
anvill copied to clipboard
Python module errors
After successfully building and installing anvill (on both macOS and Linux), 'python3 -m anvill' results in a 'No module named anvill' error.
After manually installing the anvill Python module, 'python3 -m anvill' gives the following error:
NotImplementedError: Could not find either IDA or Binary Ninja APIs
So it doesn't seem usable from the CLI as per the README.
Trying to use the IDA plugin from within IDA results in:
AttributeError: module 'anvill' has no attribute 'get_program'
Make sure your python3 version is 3.8 and try python setup.py install. This should install the anvill module into python.
After python3.8 setup.py install
and python3.8 -m anvill
I get:
$ python3.8 -m anvill
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/anvill-1.0-py3.8.egg/anvill/__init__.py", line 20, in <module>
ModuleNotFoundError: No module named 'ida_idp'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/anvill-1.0-py3.8.egg/anvill/__init__.py", line 24, in <module>
ModuleNotFoundError: No module named 'binaryninja'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 185, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib/python3.8/runpy.py", line 144, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/lib/python3.8/runpy.py", line 111, in _get_module_details
__import__(pkg_name)
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "/usr/local/lib/python3.8/dist-packages/anvill-1.0-py3.8.egg/anvill/__init__.py", line 28, in <module>
NotImplementedError: Could not find either IDA or Binary Ninja APIs
Hello @argp,
Thanks for the bug report! It seems like the Python module is now installed correctly, but IDA (depending on the installed version) may still be using its own built-in interpreter.
Would it be possible to try again, this time running IDA from the command line after the PYTHONPATH has been set to point to the anvill's Python folder?
You can use the following steps to try this out:
export PYTHONPATH="/path/to/anvill/anvill/python"
~/IDA/ida64
Running anvill from within IDA works for me now. I simply created a symlink from $ANVILL_DIR/anvill/python/anvill to $IDA_DIR/python/3/anvill.
However, the CLI version of the anvill Python module doesn't work as documented in the README.md file. I still get the above error.
I got the same error when trying to test out anvill from CLI. The tests from -DANVILL_ENABLE_TESTS=true
also failed for the same reason. I was using IDA Pro 7.6.
$ python -m anvill --bin_in /usr/bin/ls --spec_out spec.json
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/anvill/__init__.py", line 20, in <module>
import ida_idp
ModuleNotFoundError: No module named 'ida_idp'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/anvill/__init__.py", line 24, in <module>
import binaryninja
ModuleNotFoundError: No module named 'binaryninja'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 188, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib/python3.9/runpy.py", line 147, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/lib/python3.9/runpy.py", line 111, in _get_module_details
__import__(pkg_name)
File "/usr/lib/python3.9/site-packages/anvill/__init__.py", line 28, in <module>
raise NotImplementedError("Could not find either IDA or Binary Ninja APIs")
NotImplementedError: Could not find either IDA or Binary Ninja APIs
I tried specifying PYTHONPATH
and also rebuilt IDAPython from source as described in BUILDING.txt, but it still didn't work, although it did find the python module with those PYTHONPATH
.
$ PYTHONPATH=/opt/idapro-7.6/python/3:/opt/idapro-7.6/python/3/ida_64 python -m anvill --bin_in /usr/bin/ls --spec_out spec.json
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/anvill/__init__.py", line 20, in <module>
import ida_idp
File "/opt/idapro-7.6/python/3/ida_idp.py", line 19, in <module>
import _ida_idp
ImportError: /opt/idapro-7.6/python/3/ida_64/_ida_idp.so: undefined symbol: get_callable_arg_count
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/anvill/__init__.py", line 24, in <module>
import binaryninja
ModuleNotFoundError: No module named 'binaryninja'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 188, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib/python3.9/runpy.py", line 147, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/lib/python3.9/runpy.py", line 111, in _get_module_details
__import__(pkg_name)
File "/usr/lib/python3.9/site-packages/anvill/__init__.py", line 28, in <module>
raise NotImplementedError("Could not find either IDA or Binary Ninja APIs")
NotImplementedError: Could not find either IDA or Binary Ninja APIs