Comments (6)
Right, I see what you mean, Build
is used in translating the string value to the right integer. I just found the table that's used, the crazy thing is that it is read from the System Properties:
from androguard.
After giving some thought over it and seeing this issue, i think the next steps make sense:
- Offer a method to do the mapping of a string to an API level
- If the mapping fails, consider having some default value being returned
- Warn the user that this is a valid case only for pre-release and the "check" is happening only against the platform running on (so its a specific edge case I would say)
given the inconsistency of other tools against this and the fact that this is an edge case, I would say it is of low priority but regardless its a "nice to have".
from androguard.
Hmm, makes me think about #1026 too. Seems like on both cases, androguard should do what the Android OS does when parsing these. That might mean just ignoring targetSdkVersion
or maybe returning a default value?
from androguard.
Hi @eighthave, Android internally makes the conversion as defined here.
It would be nice to have it and it seems easy to be implemented.
Will add a flag to it, so I can get back to it in the future or if someone else wants to pick it up.
from androguard.
I don't think Build.java is where this parsing behavior is defined, or at least I can't see anything related there. Looks like here is the parsing:
- https://android.googlesource.com/platform/frameworks/base/+/refs/heads/android14-release/core/java/android/content/pm/PackageParser.java#2201
- https://android.googlesource.com/platform/frameworks/base/+/refs/heads/android14-release/core/java/android/content/pm/PackageParser.java#2588
And the crazy thing is that it looks like the parser there supports using a string there! APK formats are always full of surprises. The documentation says this field is "an integer":
https://developer.android.com/guide/topics/manifest/uses-sdk-element#target
from androguard.
Hi @eighthave, I was not clear enough thus the confusion.
I meant that the string/int values are described in the build.java file. As you correctly pointed out the computeTargetSdkVersion method helps with this "translation" and if you notice closely you will see how the build.java is being used (Although PackageParser is deprecated the exact same things apply for ParsingPackageUtils.java).
Indeed you are right, the developer documentation from Android states it as an integer, presumably because eventually it is converted to one. I can agree that the documentation can be improved.
from androguard.
Related Issues (20)
- The new two types of TypeMapItem are not parsed in androguard.core.dex.parse HOT 8
- ResParserError: res1 must be zero! HOT 9
- get_android_resources function exception struct.error: unpack requires a buffer of 2 bytes HOT 5
- Could not install androguard in Python 3.12.2 using poetry due to no matching version pyqt5-qt5 HOT 8
- Questions about Copilot + Open Source Software Hierarchy
- Decompilation crashes during export
- Installation on ARM64 HOT 5
- handles duplicate block IDs in APK Signing Block differently from Android/apksigner HOT 3
- 4.1.1 - androguard sign --show --all is broken - same way as Androguard 3.* was broken in #764 HOT 1
- AndroGuard throws error/crashes while decompiling APK HOT 5
- generated call graph has no edge attribute HOT 3
- Has the androrisk.py file been removed in version 4.1.1? HOT 1
- Facebook app (Android 14 - version) - unpack requires a buffer of 4 bytes HOT 1
- 'MethodIdItem' object has no attribute 'get_short_string' HOT 6
- Protection level for custom permissions HOT 2
- Unable to install androguard on Asahi Linux HOT 4
- AXML/ARSC UTF-8 string decoding improvements HOT 2
- How to omit the log when using AnalyzeAPK? HOT 2
- Kindly ask a question about get_methods() HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from androguard.