arguslab/Argus-SAF

Error during NativeFlowBench analysis

Mayuwan opened this issue · 3 comments

Hello, I am trying to test NativeFlowBenchmark, but I have a problem during program execution. Questions are as follows.

File "/home/myw/.virtualenvs/nativedroid/lib/python3.7/site-packages/nativedroid-1.1-py3.7.egg/nativedroid/analyses/nativedroid_analysis.py", line 40, in gen_summary
    if isinstance (jni_method_name_or_address, long):
NameError: name 'long' is not defined

The long parameter of the isinstance method cannot be parsed by Python. Since the long type does not exist in Python 3 or later, the long type is replaced by the int type. Recompile and install nativedroid and restart analyzing NativeFlowBenchmark, but the following problems still occur:

ERROR | 2020-02-26 07: 34: 58,289 | root | Exception calling application: unsupported operand type (s) for &: 'float' and 'int'
Traceback (most recent call last):
  File "/home/myw/.virtualenvs/nativedroid/lib/python3.7/site-packages/grpc/_server.py", line 385, in _call_behavior
    return behavior (argument, context), True
  File "/home/myw/.virtualenvs/nativedroid/lib/python3.7/site-packages/nativedroid-1.1-py3.7.egg/nativedroid/server/nativedroid_server.py", line 76, in GenSummary
    self.native_ss_file, self.java_ss_file)
  File "/home/myw/.virtualenvs/nativedroid/lib/python3.7/site-packages/nativedroid-1.1-py3.7.egg/nativedroid/analyses/nativedroid_analysis.py", line 51, in gen_summary
    analysis_center, jni_method_addr, jni_method_arguments, False)
  File "/home/myw/.virtualenvs/nativedroid/lib/python3.7/site-packages/angr/analyses/analysis.py", line 111, in call
    oself .
init __ (* args, ** kwargs)
  File "/home/myw/.virtualenvs/nativedroid/lib/python3.7/site-packages/nativedroid-1.1-py3.7.egg/nativedroid/analyses/annotation_based_analysis.py", line 51, in init
    self._state, self._arguments_summary = self._resolver.prepare_initial_state (jni_method_arguments)
  File "/home/myw/.virtualenvs/nativedroid/lib/python3.7/site-packages/nativedroid-1.1-py3.7.egg/nativedroid/analyses/resolver/armel_resolver.py", line 32, in prepare_initial_state
    state.regs.r0 = claripy.BVV (JNINativeInterface (self._project, self._analysis_center) .ptr,
  File "/home/myw/.virtualenvs/nativedroid/lib/python3.7/site-packages/nativedroid-1.1-py3.7.egg/nativedroid/analyses/resolver/jni/jni_type/jni_native_interface.py", line 3193, in init
    self._construct ()
  File "/home/myw/.virtualenvs/nativedroid/lib/python3.7/site-packages/nativedroid-1.1-py3.7.egg/nativedroid/analyses/resolver/jni/jni_type/jni_native_interface.py", line 3203, in _construct
    self._JNIEnv = self.allocate (self._fptr_size)
  File "/home/myw/.virtualenvs/nativedroid/lib/python3.7/site-packages/cle/backends/externs/init.py", line 109, in allocate
    addr = ALIGN_UP (start, alignment) | thumb
  File "/home/myw/.virtualenvs/nativedroid/lib/python3.7/site-packages/cle/utils.py", line 12, in ALIGN_UP
    return ALIGN_DOWN (base + size-1, size)
  File "/home/myw/.virtualenvs/nativedroid/lib/python3.7/site-packages/cle/utils.py", line 8, in ALIGN_DOWN
    return base & -size
TypeError: unsupported operand type (s) for &: 'float' and 'int'

There was a problem when nativedroid was executing gen_summary method, but I don't know how to solve it here. Maybe something is wrong with my operating environment. The following is my environment configuration:
ubuntu18.04, python3.7, angr8.20.1.7, Java10
Installation process:

  1. Install virtualenvwrapper and modify the configuration file bashrc.sh, then create a virtual environment called nativedroid
    2.pip3 install angr
    3.pip3 install grpcio-tools == 1.9.0
  2. Execute jn-saf and nativedroid installation script install.sh

I'm looking forward to your reply, thank you!

i think your problem is that you are using python 3. try it with python 2.7 and i think it would be ok!

Hi, I failed to install angr using pip for Python2.7
ERROR: Could not find a version that satisfies the requirement gitdb> = 4.0.1 (from gitdb2> = 2.0.0-> GitPython == 2.1.9-> angr) (from versions: 0.5.0, 0.5.1, 0.5 .2, 0.5.3, 0.5.4, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.6.4)
ERROR: No matching distribution found for gitdb> = 4.0.1 (from gitdb2> = 2.0.0-> GitPython == 2.1.9-> angr

I have noticed that you have successfully tested NativeFlowBenchMark. Can you tell me your detailed configuration environment? If possible, could you also tell me your installation steps? I'd really appreciate it.

I have successfully run nativeflowdroid with the following configuration environment: python2.7, ubuntu16.04, angr 7.8.9, java10. Thanks for your help