android 的.apk檔案的反編譯方法

來源:互聯網
上載者:User

[著作權歸作者wixe所有,歡迎轉載,但請事先告知作者並註明出處]

要反編譯一個apk譯檔案,需要做以下幾步:
1.找到apk安裝檔案
2.找到安裝軟體的*.dex譯檔案
3.dump dex檔案
4.分析dex檔案擷取想要的代碼

1.找到apk安裝檔案
這個比較容易,把手機或者模似器安裝好後,可以在eclipse的File Explorer下找到安裝程式的apk譯檔案,也可以通過adb命令找到:

$ adb shell
# cd /system/app
cd /system/app
# ls

2.找到安裝軟體的*.dex譯檔案
運行安裝軟體後,會在android檔案系統下產生一個*.dex檔案,一般在目錄/data/dalvik-cache下,也可以通過adb命令找到:

$ adb shell
# cd /data/dalvik-cache
cd /data/dalvik-cache
# ls

3.編譯軟體對應的dex檔案,通過以下指令:

adb shell dexdump -d -f -h /data/dalvik-cache/data@app@be.citylive.twitpic.apk@classes.dex > twitpic.text

指令參數解釋:
-d : disassemble code sections
-f : display summary information from file header
-h : display file header details
-C : decode (demangle) low-level symbol names
-S : compute sizes only

4.擷取需要的代碼:
開啟剛才得到的編譯出來的text檔案,會看到形如以下的代碼:

Class #0 header:
class_idx : 32
access_flags : 196625 (0x30011)
superclass_idx : 61
interfaces_off : 0 (0x000000)

從這個譯檔案裡我們很容易得到代碼資訊

本文來自CSDN部落格,轉載請標明出處:http://blog.csdn.net/lastsweetop/archive/2009/11/24/4864090.aspx

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.