Comments (14)
Example File Downloaded: https://storage.googleapis.com/randy/DeviceOwnerCheck.apk
Command Ran:
python -c "from androguard.core.bytecodes.apk import APK; apk = APK('DeviceOwnerCheck.apk'); apk.get_android_resources()"
Stack trace:
WARNING: ooo
Traceback (most recent call last):
File "/Users/kylevarga/Code/devops/launchpad/env/lib/python2.7/site-packages/androguard/core/bytecodes/apk.py", line 627, in get_android_resources
return self.arscÄ"resources.arsc"Å
KeyError: 'resources.arsc'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/kylevarga/Code/devops/launchpad/env/lib/python2.7/site-packages/androguard/core/bytecodes/apk.py", line 630, in get_android_resources
self.arscÄ"resources.arsc"Å = ARSCParser(self.zip.read("resources.arsc"))
File "/Users/kylevarga/Code/devops/launchpad/env/lib/python2.7/site-packages/androguard/core/bytecodes/apk.py", line 1277, in __init__
mTableStrings = StringBlock(self.buff)
File "/Users/kylevarga/Code/devops/launchpad/env/lib/python2.7/site-packages/androguard/core/bytecodes/apk.py", line 744, in __init__
self.m_styles.append(unpack('<i', buff.read(4))Ä0Å)
struct.error: unpack requires a string argument of length 4
apk is a valid androguard APK object
from androguard.
This commit ( subho007@62418f1 ) on @xysec fork by @subho007 seems related to this. However it does not fix issue, just moves it further down do a different buff.read() statement somewhere else.
from androguard.
@kvarga yes you are right, this doesn't solves the problem. That was again a quick fix, with broken resources. I am currently trying to find how the size%4==0
passes and then reading 4 chunks throws an error. The problem might be that the size being computed is not correct, or the buffer faces an invalid bytes.
from androguard.
This seems closely related to the issue here: iBotPeaches/Apktool@0d950f3
However, I'm not sure how to turn this into python to help fix androguard.
from androguard.
Implementation needs to follow this: http://justanapplication.wordpress.com/2011/09/19/android-internals-resources-part-eight-resource-entries-and-values/
from androguard.
@adesnos @Lircyn any suggestions? Majority apps fails to work in androguard because of the following problem !
from androguard.
Sorry. I will take a look.
from androguard.
@adesnos thank you :) I tried to follow iBotPeaches/Apktool@0d950f3 but the issue still existed ! My patch would be in https://github.com/xysec/androguard/tree/bug/resource which still doesn't work :( any help ?
from androguard.
Any idea / progress @adesnos - Unfortunately this is beyond my limits, but about at the point I need to find an alternative in the next few weeks if this isn't going to be fixed soon. Wish I could help get this fixed.
from androguard.
@adesnos Have you had a chance to look at this?
from androguard.
@kvarga @subho007 I met the same problem!!! It occurs in the "> or = Android-SDK-21" apps.I think the problem might be that "self.header = unpack('<h', buff.read(2))[0]" is 0,it is not correct.
from androguard.
Don't know if it's related, but I get a similar error when open an apk file, the stack trace shows the error happened in zipfile.py (http://bugs.python.org/issue14315). The androguard included version (md5: 1e042f0661f8966e7a15c81651b4dfb9) generate an "unpack" error, but the (previously mentioned) patched version of zipfile.py works without any problems.
from androguard.
This seems to be fixed at uTest/Androguard
Although, a small bug remains which can be patched according to my comments at uTest/Androguard#1
from androguard.
I have implemented the fix in my repo too at subho007#8 with the fixes
from androguard.
Related Issues (20)
- Session save and load don't work / exist HOT 1
- Error trying to install HOT 2
- ValueError: 4 is not a valid HiddenApiClassDataItem.DomapiApiFlag
- Error: No such command 'cg' HOT 1
- Question about dx.get_permissions(a.get_effective_target_sdk_version())
- A malform AndroidManifest file HOT 3
- The new two types of TypeMapItem are not parsed in androguard.core.dex.parse HOT 6
- 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
- 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
- parsing APK crashes if targetSdkVersion is set to a string value HOT 5
- 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
- Get only imported, used class and modules not all names under the packages HOT 4
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.