Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Getting python struct.error: unpack requires a string argument of length #1

Open
StephenQuirolgico opened this Issue Jul 9, 2013 · 2 comments

Comments

Projects
None yet
2 participants

For some apps, we are getting a python struct error. I don't know if this is a problem with androwarn, python, or the APK file itself. Below is an example error message. How can we fix this?

Traceback (most recent call last):
File "/home/blive/androwarn/androwarn-master/androwarn.py", line 116, in
main(options, arguments)
File "/home/blive/androwarn/androwarn-master/androwarn.py", line 95, in main
a, d, x = AnalyzeAPK(APK_FILE)
File "/home/blive/androwarn/androwarn-master/androwarn/analysis/analysis.py", line 48, in AnalyzeAPK
a = APK(filename, raw)
File "/home/blive/androwarn/androwarn-master/androguard/core/bytecodes/apk.py", line 156, in init
self.zip = zipfile.ZipFile( StringIO.StringIO( self.raw ), mode=mode )
File "/usr/lib/python2.7/zipfile.py", line 714, in __init

self._GetContents()
File "/usr/lib/python2.7/zipfile.py", line 748, in _GetContents
self._RealGetContents()
File "/usr/lib/python2.7/zipfile.py", line 807, in _RealGetContents
x._decodeExtra()
File "/usr/lib/python2.7/zipfile.py", line 373, in _decodeExtra
tp, ln = unpack('<HH', extra[:4])
struct.error: unpack requires a string argument of length 4

Thanks,
Steve Quirolgico

Owner

maaaaz commented Jul 13, 2013

Hello Steve,

Would it possible for you to give me an example of an APK file leading to the crashes you reported ?
If you do not want it to appear publicly, consider sending me a message : tdebize (at) mail (dot) com

Best regards.

We used QuranAndroid which is on Google Play. Also, we have found a workaround for this error by unpacking and repacking the APK using zip/unzip on Ubuntu. However, it should probably still be fixed in androwarn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment