androguard / androguard

Reverse engineering and pentesting for Android applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python version compatibility

ehrenb opened this issue · comments

When installing in Python 3.8, I get the following error:

androguard --help
Traceback (most recent call last):
  File "/home/branden/venvs/androguard-dev-3.8/bin/androguard", line 5, in <module>
    from androguard.cli.cli import entry_point
  File "/home/branden/projects/androguard/androguard/cli/cli.py", line 13, in <module>
    from androguard.cli.main import (androarsc_main,
  File "/home/branden/projects/androguard/androguard/cli/main.py", line 20, in <module>
    from androguard.ui import DynamicUI
  File "/home/branden/projects/androguard/androguard/ui/__init__.py", line 14, in <module>
    from androguard.ui.selection import SelectionViewList
  File "/home/branden/projects/androguard/androguard/ui/selection.py", line 20, in <module>
    class SelectionViewList(UserList[_T]):
TypeError: 'ABCMeta' object is not subscriptable

(androguard-dev-3.8) ➜  androguard git:(master) ✗ python3 --version
Python 3.8.10

With Python 3.9, I can successfully run the CLI:

androguard --help                             
Usage: androguard [OPTIONS] COMMAND [ARGS]...

  Androguard is a full Python tool to reverse Android Applications.

Options:
  --version           Show the version and exit.
  --verbose, --debug  Print more
  --help              Show this message and exit.

Commands:
  analyze      Open a IPython Shell and start reverse engineering.
  apkid        Return the packageName/versionCode/versionName per APK as...
  arsc         Decode resources.arsc either directly from a given file or...
  axml         Parse the AndroidManifest.xml.
  cg           Create a call graph based on the data of Analysis and...
  decompile    Decompile an APK and create Control Flow Graphs.
  disassemble  Disassemble Dalvik Code with size SIZE starting from an...
  dtrace       Start dynamically an installed APK on the phone and start...
  dump         Start and dump dynamically an installed APK on the phone
  sign         Return the fingerprint(s) of all certificates inside an APK.
  trace        Push an APK on the phone and start to trace all...

(androguard-dev-3.9) ➜  androguard git:(master) ✗ python3 --version
Python 3.9.18

This appears to be a difference between 3.8->3.9 (https://stackoverflow.com/a/59956132). Are we intending to support 3.8+, or all the way back to 3.6, as the setup.py and toml suggest?

nice catch!
it seems that the ABCMeta object from the abc module was made subscriptable in Python 3.9 to support generics, and therefore the error.

Given that python 3.8 is currently receiving only security updates and within 2024 it will be its end of life, and that we have very limited capabilities in maintaining/improving the codebase, I don't think its wise to spend time in making it backwards compatible.

I will release patch version 4.0.2 within the next days and update the corresponding files to reflect that python 3.9 will be a minimum

nice catch! it seems that the ABCMeta object from the abc module was made subscriptable in Python 3.9 to support generics, and therefore the error.

Given that python 3.8 is currently receiving only security updates and within 2024 it will be its end of life, and that we have very limited capabilities in maintaining/improving the codebase, I don't think its wise to spend time in making it backwards compatible.

I will release patch version 4.0.2 within the next days and update the corresponding files to reflect that python 3.9 will be a minimum

Hi @erev0s , can we update the CI tests.yml to reflect the min version of Python3.9? It currently shows as testing on Python3.10:

https://github.com/androguard/androguard/blob/master/.github/workflows/tests.yml#L19

Better yet, could we tests across 3.9,3.10,3.11, and 3.12? There's no current issue now, but this could cause some confusion in the future.