# decompiler

反编译

<https://github.com/iBotPeaches/Apktool>

<https://github.com/google/android-classyshark>

## 反编译APP，并重编译安装

1. 找来一个apk: `test.apk`
2. 使用apktool进行`反编译`

   ```
   $ apktool d test.apk   #会在同目录下生成一个test的目录，所有反编译文件都在里边
   ```

   这时可以在其里用vi，编辑一个文件如`res/values/strings.xml`、`smali`的smali文件、`AndroidManifest.xml`配置 的一些可编辑的值；

   ![](/files/-M6gntMTDmKR1jCPvVHP)
3. 使用apktool`再打包`

   ```
   $ apktool b test    #这里的test是刚才反编译生成的目录
   ```

   ![](/files/-M6gntMUccS8AtqkgDH3)

   如果此时一切正常，会生成`test/build`、`test/dist`

   ![](/files/-M6gntMVAs_ai3gc_e-i)
4. 此时生成的`test/dist/test.apk`还需要重签名，可不用原证书签名。

   ```
   $ jarsigner -verbose -certs -keystore ./android_sign.keystore -storepass {pwd} -keypass {pwd} -digestalg SHA1 -sigalg MD5withRSA -signedjar {sign_test}.apk {test}.apk {pwd}
   $
   //# {pwd}：为证书的相关密码
   //# {sign_test): 目标apk名
   //# {test}: 源apk名
   $ adb install test.apk   #把此程序一道安装到手机上进行验证！
   ```

   此时生成的sign\_test.apk就是一个反编译后再重编译的apk。可以安装的。

**特别注意**： 本反编译与再打包，只适用于第一次打包，如果该程序被加固过。当前的apktool\@2.2.2 反编译与打包未加固的程序都成功！(20170302)

## Reinforcement加固

1. [腾讯](https://jiagu.qcloud.com/)
2. [百度加固](http://app.baidu.com/jiagu)
3. [360加固保](http://dev.360.cn/protect/welcome)
4. [梆梆](http://www.bangcle.com/)
5. [通付盾](https://www.payegis.com.cn/)
6. [爱加密](http://safe.ijiami.cn/)
7. [娜迦](http://www.nagain.com/)

## Apktool

<https://ibotpeaches.github.io/Apktool/documentation/>

```
apktool d {test}.apk  # d-decoding 解码
apktool b {test}.apk  # b-build  编译
```

## JEB

download： <http://jebbuilds2.s3.amazonaws.com/jeb2demo/jeb-demo-2.2.10.201610102203.zip>

<https://www.pnfsoftware.com/jeb2/downloads>

## dex2jar

<https://github.com/pxb1988/dex2jar>

```
d2j-dex2jar.sh -f ~/path/to/apk_to_decompile.apk
```

## JD-gui

<https://github.com/java-decompiler/jd-gui>

## Bitbucket

<https://bitbucket.org/mstrobel/procyon> jar

## Fiddler

Android网络捉包 <https://www.telerik.com/download/fiddler>

<http://www.androidtcpdump.com/android-tcpdump/downloads>

## Charles

网络抓包


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jiek.gitbook.io/android/decompiler.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
