- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在构建一个反编译 Android APK 的 Python 应用程序,进行一些修改并重新编译它。
代码如下:
from shutil import copyfile
# Copy the APK to the output directory.
copyfile('./source/rat.apk', './output/rat.apk')
# Decompiles the APK.
subprocess.call(['apktool','d','./output/rat.apk','-f'], stdout=FNULL, stderr=subprocess.STDOUT)
# Modifies address and port.
with open('./output/RAT/app/src/main/res/values/strings.xml','w+') as netaddress:
address = netaddress.read()
address.replace('youraddress','x')
address.replace('yourport','8080')
netaddress.write(address)
print(netaddress.read())
netaddress.close()
# Recompiles it.
subprocess.call(['apktool','b','./output/RAT'], stdout=FNULL, stderr=subprocess.STDOUT)
但是运行时抛出异常:
with open('./output/RAT/app/src/main/res/values/strings.xml','w+') as netaddress:
FileNotFoundError: [Errno 2] No such file or directory: './output/RAT/app/src/main/res/values/strings.xml'
更新:
当我尝试使用命令 apktool d source/rat.apk
这是我收到的输出:
18:45:51 up 1 min, 0 users, load average: 0.52, 0.58, 0.59
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
I: Using Apktool 2.0.2-dirty on rat.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: /home/stecco/apktool/framework/1.apk
W: Could not decode attr value, using undecoded value instead: ns=android, name=versionCode, value=0x00000001
I: Loading resource table from file: /home/stecco/apktool/framework/1.apk
W: Could not decode attr value, using undecoded value instead: ns=android, name=versionName, value=0x00000014
I: Loading resource table from file: /home/stecco/apktool/framework/1.apk
W: Could not decode attr value, using undecoded value instead: ns=android, name=versionCode, value=0x00000001
I: Loading resource table from file: /home/stecco/apktool/framework/1.apk
W: Could not decode attr value, using undecoded value instead: ns=android, name=versionName, value=0x00000014
Exception in thread "main" java.lang.NullPointerException
at java.io.Writer.write(Writer.java:157)
at brut.androlib.res.util.ExtMXSerializer.writeAttributeValue(ExtMXSerializer.java:38)
at org.xmlpull.mxp1_serializer.MXSerializer.attribute(MXSerializer.java:696)
at org.xmlpull.v1.wrapper.classic.XmlSerializerDelegate.attribute(XmlSerializerDelegate.java:106)
at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.writeStartTag(StaticXmlSerializerWrapper.java:267)
at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.event(StaticXmlSerializerWrapper.java:211)
at brut.androlib.res.decoder.XmlPullStreamDecoder$1.event(XmlPullStreamDecoder.java:83)
at brut.androlib.res.decoder.XmlPullStreamDecoder.decode(XmlPullStreamDecoder.java:141)
at brut.androlib.res.decoder.XmlPullStreamDecoder.decodeManifest(XmlPullStreamDecoder.java:153)
at brut.androlib.res.decoder.ResFileDecoder.decodeManifest(ResFileDecoder.java:140)
at brut.androlib.res.AndrolibResources.decodeManifestWithResources(AndrolibResources.java:199)
at brut.androlib.Androlib.decodeManifestWithResources(Androlib.java:140)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:100)
at brut.apktool.Main.cmdDecode(Main.java:165)
at brut.apktool.Main.main(Main.java:81)
通过安装 Apktool 2.4.0 解决了所有问题,似乎版本 2.0.2 确实有问题,甚至 2.2.2 和 2.3.2 也是如此。
但是当我尝试重新编译它时出现了另一个问题,它给我一个 classes.dex 而不是 apk 我该如何解决这个问题?
最佳答案
FileNotFoundError 是一个显式名称,这意味着您的代码函数无法找到该文件。没有关于此异常发生位置的更多详细信息,我能给你的唯一答案是验证:
关于android - Python 使用 ApkTool 和 Subprocess 反编译 APK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55120510/
我已经从 https://bitbucket.org/iBotPeaches/apktool/downloads 下载了 apktool_2.1.1.jar 和 apktool_2.0.0rc4.ja
我尝试在我的 Windows 7 计算机上运行 android APKtool,但出现标题中显示的错误。我已经下载了 APKtool-install-windows-r05-ibot、APKtool1
当我尝试通过apktool提取apk文件时api,相关的提取过程永远不会完成。 相同的代码适用于 Java 项目。但是当我通过虚拟设备在 Android 应用程序中使用它时,提取过程永远不会完成。 这
我从网站上下载了 Apktools,得到了 2 个文件:Apktool.txt 和 Apktool_2.2.2。我按照说明将 Apktool_2.2.2 重命名为 Apktools.jar。然后我去了
我正在尝试将 imageview 注入(inject)到反编译的 apk 的 smali 代码中。但是 imageview 使用的 drawable 需要它自己的唯一资源标识符。到目前为止,在没有从
所以我需要编辑一个apk。我看过一些有关如何使用 apktool 执行此操作的指南。 我已经安装了 jre 1.7、Android SDK 和 apktool。 我已经把apktool.jar、apk
android list xml 文件不包含该信息。 android.yml 文件可以。更改后,apk 构建命令不会生成 apk 文件。有没有可以用来编辑版本号的build.gradle文件或工具?
我可以使用 apktool 解码 apk,然后为我的普通 android 项目重新构建。 但是当我对依赖于库项目 (appcompat) 的项目尝试同样的事情时,它失败并出现以下错误。 我是否需要使用
我需要在 Windows 上反编译 & 重新编译一个 apk... 我正在关注此链接 Reverse Engineer APK 问题是我找不到发出请求的文件(请参阅上面的链接)“找到发出请求的文件 g
我已经在我的 mac 上使用 apktools 反编译了一个 apk,想知道是否可以更改 apktools 上的 png 图标和启动画面,如果可以的话如何更改,因为我在网上找不到任何指导 最佳答案 如
我用反编译了一个apk apktool d -d myapp.apk 然后我在res/drawabe中添加一个png图像最后我用“apktool b”重新编译了 apk 但实际上我认为我的图片没有映射
我已经使用建议的 gradle 方法为 android 设置了 crashlytics,并且在 android studio 中运行时一切正常。我收到了崩溃报告、统计数据和所有预期的内容(顺便说一句,
我正在尝试对 MIUI Android 2.3.5 ROM (Mms.apk) 附带的键盘应用程序的布局进行一些小改动。将文件重新编译回 apk(并使用 jarsigner 对其进行签名)并使用 ad
据我所知,apktool 和 baksmali 都能够从 .apk (.dex) 文件中生成 smali 代码,并且 apktool 使用 dexlib2。它们都是APK打包/解包工具 但我仍然不清楚
我需要在签名的 APK 文件中增加 versionCode。 我执行以下操作: apktool d myapk.apk 打开apktool.yml,增加versionCode并保存 apktool b
我使用 APKTool 2.0 Beta 9 反编译了一个 APK,然后在不更改源代码的情况下重新构建了所有 APK。然后我使用这个命令重建了 APK: java -jar apktool.jar b
我用 apktool 解码了一个 apk 文件,我没有改变任何东西。之后,我再次构建它,然后尝试安装 apk,但即使进行了一些基本更改,我仍收到以下错误。 我使用 Windows cmd 做了什么:
我使用了 apktool 2.0.0 rc4 版本并使用该工具解压了 CP.apk 文件,然后修改了一个文件并尝试使用“apktool b CP test.apk”命令重新打包 输出如下,但是工作目录
基本上,当用户上传 .apk 文件时,我需要对其进行解码并从 apk 中的 AndroidManifest.xml 文件中提取一些信息。当我从命令行 apktool decode BluetoothC
我按照此处提到的说明进行操作 - http://ibotpeaches.github.io/Apktool/install/ for Mac OS 安装Apktool 2.X 版本。我将下载并重命名的
我是一名优秀的程序员,十分优秀!