咸鱼

咸鱼是以盐腌渍后,晒干的鱼

0%

apktool

apktool是apk反编译的核心,其他GUI工具内部都是用apktool来执行反编译任务。

主页和下载地址

主页地址: https://ibotpeaches.github.io/Apktool/install/
下载apktool.jar: https://bitbucket.org/iBotPeaches/apktool/downloads/
下载apktool.bat:https://raw.githubusercontent.com/iBotPeaches/Apktool/master/scripts/windows/apktool.bat

apktool.bat内容如下:

1
2
3
4
5
@echo off
if "%PATH_BASE%" == "" set PATH_BASE=%PATH%
set PATH=%CD%;%PATH_BASE%;
chcp 65001 2>nul >nul
java -jar -Duser.language=en -Dfile.encoding=UTF8 "%~dp0\apktool.jar" %*

反编译

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$ java -jar apktool.jar d test.apk
或者
$ ./apktool.bat d test.apk

I: Using Apktool 2.3.0 on test.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: 1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
$ ./apktool.bat b test
I: Using Apktool 2.3.0 on test
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether resources has changed...
I: Building resources...
I: Building apk file...
I: Copying unknown files/dir...

反编译结果在apk文件同名目录下

修改内容

  • assets
  • res 可以修改资源
  • smali 可以修改源码

重新打包

1
$ ./apktool.bat b ./test -o ./test_unsigned.apk

此时重新打包为apk的文件是未签名的,需要用jdk的jarsigner工具重新签名

签名

1
2
3
4
# 这里的key0:是签名Key的Alias
$ jarsigner -verbose -keystore /tmp/test.jks -signedjar test-signed.apk test_unsigned.apk key0

input key password >> ******