kin9-0rz / apkutils Goto Github PK
View Code? Open in Web Editor NEW一个解析APK相关文件的库 [Gitee -> Github 镜像自动同步]
Home Page: https://gitee.com/kin9-0rz/apkutils
License: MIT License
一个解析APK相关文件的库 [Gitee -> Github 镜像自动同步]
Home Page: https://gitee.com/kin9-0rz/apkutils
License: MIT License
0b612a3589be4975ff86d9c311d62cad
Hey!
I'm trying to get info from an apk but unfortunately I'm not able to read the asrc.
apk = APK(path)
asrc = apk.get_asrc()
Here is error:
File "/home/me/aaa.py", line 29, in __init__
x = self.apk.get_arsc()
File "/home/me/.local/lib/python3.6/site-packages/apkutils/__init__.py", line 224, in get_arsc
self._init_arsc()
File "/home/me/.local/lib/python3.6/site-packages/apkutils/__init__.py", line 220, in _init_arsc
raise e
File "/home/me/.local/lib/python3.6/site-packages/apkutils/__init__.py", line 218, in _init_arsc
self.arsc = ARSCParser(data)
File "/home/me/.local/lib/python3.6/site-packages/apkutils/axml/arscparser.py", line 147, in __init__
mKeyStrings = StringPoolChunk(self.buff)
File "/home/me/.local/lib/python3.6/site-packages/apkutils/axml/chunk.py", line 23, in __init__
self.header_size, self.header = self.skipNullPadding(buff)
File "/home/me/.local/lib/python3.6/site-packages/apkutils/axml/chunk.py", line 92, in skipNullPadding
header = readNext(buff)
File "/home/me/.local/lib/python3.6/site-packages/apkutils/axml/chunk.py", line 83, in readNext
header = unpack('<i', buff.read(4))[0]
struct.error: unpack requires a buffer of 4 bytes
This error doesn't come up for me with all apks.
I'm using apkutils 0.5.2
with python3.6
I'll very appreciate your support!
00c293c11f06dab857a47ff2ac2aa678
81f75832ddf1c8be482f1db8b61c64de
Any idea why I got this error on Ubuntu 16.04.
$ pip install apkutils
Collecting apkutils
Could not find a version that satisfies the requirement apkutils (from versions: )
No matching distribution found for apkutils
And when I'm trying to install from the source I got this error:
$ pip install git+https://github.com/mikusjelly/apkutils.git
Collecting git+https://github.com/mikusjelly/apkutils.git
Cloning https://github.com/mikusjelly/apkutils.git to /tmp/pip-req-build-Ogdj1H
Collecting pyelftools (from apkutils==0.5.2)
Downloading https://files.pythonhosted.org/packages/fa/9a/0674cb1725196568bdbca98304f2efb17368b57af1a4bb3fc772c026f474/pyelftools-0.25.tar.gz (499kB)
100% |████████████████████████████████| 501kB 6.7MB/s
Collecting cigam (from apkutils==0.5.2)
Could not find a version that satisfies the requirement cigam (from apkutils==0.5.2) (from versions: )
No matching distribution found for cigam (from apkutils==0.5.2)
$ python -m apkutils.apk -m 312792279738e239c01d7a8636ca83bf.apk
Traceback (most recent call last):
File "...\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "...\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "...\lib\site-packages\apkutils\apk.py", line 375, in <module>
main(_args)
File "...\lib\site-packages\apkutils\apk.py", line 354, in main
print(json.dumps(apk.get_manifest(), indent=1))
File "...\lib\site-packages\apkutils\apk.py", line 86, in get_manifest
self._init_manifest()
File "...\lib\site-packages\apkutils\apk.py", line 106, in _init_manifest
raise e
File "...\lib\site-packages\apkutils\apk.py", line 104, in _init_manifest
raise e
File "...\lib\site-packages\apkutils\apk.py", line 102, in _init_manifest
raise e
File "...\lib\site-packages\apkutils\apk.py", line 100, in _init_manifest
axml.get_xml())['manifest']
File "...\lib\site-packages\xmltodict.py", line 330, in parse
parser.Parse(xml_input, True)
xml.parsers.expat.ExpatError: duplicate attribute: line 290, column 0
0c856bbccab2a7fc7b477df68f3289d0
41b94ec1202fe6e06726362052374b6d
$ python -m apkutils.apk -s 41b94ec1202fe6e06726362052374b6d.apk
Warning, unexpected header size!
Warning, unexpected endianess tag!
Traceback (most recent call last):
File "...\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "...\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "...\lib\site-packages\apkutils\apk.py", line 375, in <module>
main(_args)
File "...\lib\site-packages\apkutils\apk.py", line 357, in main
for item in apk.get_strings():
File "...\lib\site-packages\apkutils\apk.py", line 41, in get_strings
self._init_strings()
File "...\lib\site-packages\apkutils\apk.py", line 51, in _init_strings
str_set.add(binascii.hexlify(dex_file.string(i)).decode())
File "...\lib\site-packages\apkutils\dex\dexparser.py", line 300, in string
stream.uleb128() # ignore decoded length
File "...\lib\site-packages\apkutils\dex\byteio.py", line 65, in uleb128
return self._leb128()
File "...\lib\site-packages\apkutils\dex\byteio.py", line 52, in _leb128
while self.data[self.pos] >> 7:
IndexError: index out of range
Traceback (most recent call last):
File "D:\ProgramData\Miniconda3\Scripts\iave-script.py", line 11, in <module>
load_entry_point('iave', 'console_scripts', 'iave')()
File "d:\projects\iave\iave\__main__.py", line 71, in main
iave.main(args)
File "d:\projects\iave\iave\iave.py", line 1310, in main
Statistics(apks).show()
File "d:\projects\iave\iave\iave.py", line 56, in __init__
self._process_manifest()
File "d:\projects\iave\iave\iave.py", line 61, in _process_manifest
manifest = apk_obj.get_manifest()
File "D:\ProgramData\Miniconda3\lib\site-packages\apkutils\apk.py", line 86, in get_manifest
self._init_manifest()
File "D:\ProgramData\Miniconda3\lib\site-packages\apkutils\apk.py", line 106, in _init_manifest
raise e
File "D:\ProgramData\Miniconda3\lib\site-packages\apkutils\apk.py", line 94, in _init_manifest
data = zf.read(ANDROID_MANIFEST)
File "D:\ProgramData\Miniconda3\lib\zipfile.py", line 1314, in read
with self.open(name, "r", pwd) as fp:
File "D:\ProgramData\Miniconda3\lib\zipfile.py", line 1406, in open
"required for extraction" % name)
RuntimeError: File 'AndroidManifest.xml' is encrypted, password required for extraction
估计是伪加密,zipfile会判断加密位。
5fb368d6f4dae0cda8c1735d5f3a99cc
Hi,
Thanks for your contribution to the community. I can't find any documentation for this script. Is there any way to retrieve package name and all other general info? If yes, then please update some examples.
您的代码中用到了 https://github.com/Storyyeller/enjarify 项目,根据 Apache License 2.0,您必须在您的项目说明文件中加入此repo的地址(即:来源信息),并在您修改过的 https://github.com/kin9-0rz/apkutils/blob/master/apkutils/dex/dexparser.py 等文件中注明修改。
另外,axmlparser.py
是来自您以前的项目 https://github.com/kin9-0rz/axmlparser ,本项目却使用了非 GPL-3.0
的协议。尽管显然你不会举报自己侵权,但这样可能会给使用/二次开发本项目的人(比如我)带来潜在的侵权问题。或者说,我们可能无法肯定这部分代码应当以何种协议使用。
另,能写写docstring和type hint吗……没有这些会让人用的很难受
aed7b989ab5898fee59ca39c287d1025
File "... apkutils/__init__.py", line 71, in get_strings_refx
self._init_strings_refx()
File "... apkutils/__init__.py", line 36, in _init_strings_refx
dexClass.parseData()
File "... apkutils/dex/dexparser.py", line 243, in parseData
self.data = ClassData(self.dex, self.data_off)
File "... apkutils/dex/dexparser.py", line 198, in __init__
self._parse(dex, dex.stream(offset))
File "... apkutils/dex/dexparser.py", line 220, in _parse
Method(dex, method_idx, stream.uleb128(), stream.uleb128()))
File "... apkutils/dex/dexparser.py", line 188, in __init__
self.code = CodeItem(dex, code_off) if code_off else None
File "... apkutils/dex/dexparser.py", line 178, in __init__
self.bytecode = parseBytecode(dex, insns_start_pos, insns, catch_addrs)
File "... apkutils/dex/dalvik.py", line 203, in parseBytecode
assert(0 not in catch_addrs)
AssertionError
0a5899ad02576cc557234cf748dd3818
141d30a60e48890b3d9244e07774cf5f
67ecdfbe69b37202b7541325bb1440f7
7d06e06970b9761d71fa8a31873421dc
ac8ec47603994f29bfdf949499602099
e1c89699ec7a6c0f6dacf1e323a67746
eb886cb29d5524cea0de74dfb9312fed
f4d603543501ab553954f825b2f325d2
https://github.com/zhangchunlin/apkutils
What I have done:
Because the modification is too big, and I think you may not want to make it compatible with py2, so I did not raise PR with it.
需要一个接口,获取所有方法及其包含的字符串 get_strings_refx
。
https://github.com/mikusjelly/apkutils/blob/52f0f4a15bcb3380e5043e22503adeb3e9e67a0d/apkutils/__init__.py#L89
遇到下面的AndroidManifest时,main_activity会匹配到aaa.bbb.Activity2
而不是aaa.bbb.MainActivity
<activity android:excludeFromRecents="true" android:icon="@mipmap/icf" android:label="Facebook" android:launchMode="3" android:name="aaa.bbb.Activity2" />
<activity android:label="XXXX" android:launchMode="3" android:name="aaa.bbb.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Failed to execute script 'APKAnalysis' due to unhandledexception: need to copy the
sdk/platforms/android-?/data/res/values/public.xml here
what is
sdk/platforms/android-?/data/res/values/public.xml
Vulnerable OpenSSL included in cryptography
wheels >= 0.8.1, < 39.0.1.
This package specifies cryptography
= ">=35.0.0,<36.0.0"
As per dependabot:
pyca/cryptography's wheels include a statically linked copy of OpenSSL. The versions of OpenSSL included in cryptography 0.8.1-39.0.0 are vulnerable to a security issue. More details about the vulnerabilities themselves can be found in https://www.openssl.org/news/secadv/20221213.txt and https://www.openssl.org/news/secadv/20230207.txt.
If you are building cryptography source ("sdist") then you are responsible for upgrading your copy of OpenSSL. Only users installing from wheels built by the cryptography project (i.e., those distributed on PyPI) need to update their cryptography versions.
6693e141c13a1ea3b51ff35d491b41b5.apk
使用winrar,可以解出AndroidManifest.xml,并且能够解析。
但是,apkfile目前不行。
Thanks for great tool. (I'm in China ^_^)
Can you give some hint about how to get icon file from apk? I can see using this lib can get string from asar file, but how to do next.
Hallo
I am Md Masud Rana Want to make a logo for this project if you have any requirements or idea then let me know.Its totally free for any open source projects. Thank you
01950132f634fb6095fb08325c542293
132e7cf660ae5434ea70933edbb38e67
1801d04f43ed4b15f24c925060233606
42654eaf2260ce06cb728b79d9d79d5f
5a9880a65c02049978065a9193ba83ac
83bde58260b2cabe41db4112411f21fa
8c69cc8e705da00f5a1c1e04616a99ef
9f72c23b147d16affadf777a9af633c3
cd9abd10a8590d86fca5a8a04a18c516
$ python -m apkutils -m apks\4a004d48ed4aa6d9b46b177bc64f8fff.apk
Traceback (most recent call last):
File "D:\ProgramData\Miniconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "D:\ProgramData\Miniconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\ProgramData\Miniconda3\lib\site-packages\apkutils\__main__.py", line 42, in <module>
main(_args)
File "D:\ProgramData\Miniconda3\lib\site-packages\apkutils\__main__.py", line 11, in main
if apk.get_manifest():
File "D:\ProgramData\Miniconda3\lib\site-packages\apkutils\__init__.py", line 88, in get_manifest
self._init_manifest()
File "D:\ProgramData\Miniconda3\lib\site-packages\apkutils\__init__.py", line 118, in _init_manifest
raise e
File "D:\ProgramData\Miniconda3\lib\site-packages\apkutils\__init__.py", line 107, in _init_manifest
raise e
File "D:\ProgramData\Miniconda3\lib\site-packages\apkutils\__init__.py", line 103, in _init_manifest
axml = AXML(data)
File "D:\ProgramData\Miniconda3\lib\site-packages\apkutils\axml\axmlparser.py", line 360, in __init__
self.parse()
File "D:\ProgramData\Miniconda3\lib\site-packages\apkutils\axml\axmlparser.py", line 376, in parse
self.parser.get_prefix()) + self.parser.get_name()
File "D:\ProgramData\Miniconda3\lib\site-packages\apkutils\axml\axmlparser.py", line 228, in get_name
return self.sb.getString(self.m_name)
File "D:\ProgramData\Miniconda3\lib\site-packages\apkutils\axml\chunk.py", line 107, in getString
self._cache[idx] = self.decode16(offset)
File "D:\ProgramData\Miniconda3\lib\site-packages\apkutils\axml\chunk.py", line 126, in decode16
str_len, skip = self.decodeLength(offset, 2)
File "D:\ProgramData\Miniconda3\lib\site-packages\apkutils\axml\chunk.py", line 142, in decodeLength
length = self.m_charbuff[offset]
IndexError: index out of range
你好,请问一下这个问题:
解析Manifest文件部分值为字符串资源ID,如何匹配上对应的字符串
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.