cryptax / droidlysis

Property extractor for Android apps
MIT License
264 stars 42 forks source link

use androguard if present #12

Closed eighthave closed 1 year ago

eighthave commented 1 year ago

8 7123ce7846f9a7e5a23717570713560f9367cf0e removed the use of androguard entirely. It can easily be used if it is present, so it doesn't have to be requirement. androguard is available from Debian, so there it is easy to install. Basically, in a function, do:

def get_axml():
    try:
        import androguard
        # do androguard things here
    except ImportError:
        pass

Or something like: https://gitlab.com/fdroid/fdroidserver/-/blob/c78aeb39473084b3459f8212730f4e15439bdbb9/fdroidserver/common.py#L2481

fdroidserver used to do that for a long time, now it requires androguard because it has proven the easiest and most reliable way to get certain bits of data. For example:

Alternatively, you might have luck with the pyaxmlparser library.

cryptax commented 1 year ago

True, but actually, I haven't encountered a sample that apktool's XML converter couldn't process for ages, so I finished by thinking this was really overkill and could be removed altogether.

cryptax commented 1 year ago

At a second thought. Let me think about it.

How would you deal with optional packages for pip requirements? I don't add androguard in requirements.txt? And if it happens to be there, in the code, I use it.

eighthave commented 1 year ago

Yeah, exactly. You can also add optional dependecies in setup.py, but I forget off hand how to do that. I think it is like profiles like "dev" or "test".

cryptax commented 1 year ago

Actually, in this particular case, I use androaxml from the command line, so checking import androguard is useless. But if androaxml.py is not present I catch the error, log it and continue.