反编译及手机平板apk提取
生活随笔
收集整理的這篇文章主要介紹了
反编译及手机平板apk提取
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
文章目錄
- 反編譯與手機(jī)平板apk提取
- 反編譯
- 下載
- apktool.bat內(nèi)容
- apktool相關(guān)參數(shù)
- 操縱步驟:
- 1.把設(shè)備中的framework-res.apk提取出來(lái)
- 2.把framework-res.apk解析到對(duì)應(yīng)文件夾
- 4. 反編譯apk
- 5.搞定
- 提取設(shè)備系統(tǒng)apk
- 用python寫(xiě)一個(gè)通用的apk提取代碼
反編譯與手機(jī)平板apk提取
僅用于安卓設(shè)備
反編譯
本文只做介紹
下載
apktool官網(wǎng): https://ibotpeaches.github.io/Apktool/install/apktool官方下載地址: https://bitbucket.org/iBotPeaches/apktool/downloads/apktool.bat內(nèi)容
@echo off set PATH=%CD%;%PATH%; java -jar "%~dp0\apktool.jar" %1 %2 %3 %4 %5 %6 %7 %8 %9apktool相關(guān)參數(shù)
參數(shù): Apktool v2.5.0 - a tool for reengineering Android apk files with smali v2.4.0 and baksmali v2.4.0 Copyright 2010 Ryszard Wi?niewski <brut.alll@gmail.com> Copyright 2010 Connor Tumbleson <connor.tumbleson@gmail.com>usage: apktool-advance,--advanced prints advance information.-version,--version prints the version then exits usage: apktool if|install-framework [options] <framework.apk>-p,--frame-path <dir> Stores framework files into <dir>.-t,--tag <tag> Tag frameworks using <tag>. usage: apktool d[ecode] [options] <file_apk>-f,--force Force delete destination directory.-o,--output <dir> The name of folder that gets written. Default is apk.out-p,--frame-path <dir> Uses framework files located in <dir>.-r,--no-res Do not decode resources.-s,--no-src Do not decode sources.-t,--frame-tag <tag> Uses framework files tagged by <tag>. usage: apktool b[uild] [options] <app_path>-f,--force-all Skip changes detection and build all files.-o,--output <dir> The name of apk that gets written. Default is dist/name.apk-p,--frame-path <dir> Uses framework files located in <dir>.For additional info, see: https://ibotpeaches.github.io/Apktool/ For smali/baksmali info, see: https://github.com/JesusFreke/smali操縱步驟:
1.把設(shè)備中的framework-res.apk提取出來(lái)
adb pull /system/framework/framework-res.apk2.把framework-res.apk解析到對(duì)應(yīng)文件夾
apktool_2.5.0 if -p C:\Users\Lvan8\Desktop\temp framework-res.apk D:\G_Working\自動(dòng)化小工具需求\性能工具\反編譯工具\ApkToolBoxStudio_jb51\ApkToolBox Studio_v1.6.4\tool>apktool_2.5.0 if -p C:\Users\Lvan8\Desktop\temp framework-res.apk I: Framework installed to: C:\Users\Lvan8\Desktop\temp\1.apk4. 反編譯apk
- 1.d 就是將apk反編譯成文件夾的形式
- 2.-p 后面跟的就是上一個(gè)步驟中framework指定的地址
- 3.-f 理解為強(qiáng)制的意思
- 4.最后接需要反編譯的文件的名字(我放在和apptool同一個(gè)目錄下)
反編譯的時(shí)候想要放在別的目錄下,需要加上 -o 參數(shù) ,因?yàn)榘姹旧?jí)了
#把對(duì)應(yīng)文件夾下面的apk反編譯到主目錄下的temp文件夾里面 #每次編譯都會(huì)覆蓋掉temp下面的所有內(nèi)容 window_apk_path = '../resources/all_apk_files/IconPackCircularAndroidOverlay.apk' save_path = '../temp/' os.system(f'apktool_2.5.0.bat d -p {framework_path} -f {window_apk_path} -o {save_path}') apktool反編譯時(shí)經(jīng)常會(huì)出現(xiàn)下面的信息1.Input file was not found or was not readable.3.Exception in thread "main" brut.androlib.AndrolibException: Could not decode ars c fil..........解決方案:1和2是因?yàn)閍pktool升級(jí)到2.0以上時(shí),使用方式已經(jīng)替換,格式為:apktool d [-s] -f <apkPath> -o <folderPath>,參數(shù)具體的意思可以直接打apktool回車(chē)(windows)查看幫助3是因?yàn)閍pktool版本過(guò)低導(dǎo)致,請(qǐng)升級(jí)到最新版本,地址: https://bitbucket.org/iBotPeaches/apktool/downloads5.搞定
D:\G_Working\自動(dòng)化小工具需求\性能工具\反編譯工具\ApkToolBoxStudio_jb51\ApkToolBox Studio_v1.6.4\tool>apktool_2.5.0.bat d -p C:\Users\Lvan8\Desktop\temp -f setting.apk I: Using Apktool 2.5.0 on setting.apk I: Loading resource table... I: Decoding AndroidManifest.xml with resources... I: Loading resource table from file: C:\Users\Lvan8\Desktop\temp\1.apk I: Regular manifest package... I: Decoding file-resources... I: Decoding values */* XMLs... I: Baksmaling classes.dex... I: Baksmaling classes2.dex... I: Copying assets and libs... I: Copying unknown files... I: Copying original files...D:\G_Working\自動(dòng)化小工具需求\性能工具\反編譯工具\ApkToolBoxStudio_jb51\ApkToolBox Studio_v1.6.4\tool>完整得資源文件
提取設(shè)備系統(tǒng)apk
adb pull system/app test adb pull system/priv-app test adb pull data/app test#注解: /system/app 存放rom本身附帶的軟件即系統(tǒng)軟件; /data/app 存放用戶(hù)安裝的軟件;#注意: /system/priv-app/下的apk不用系統(tǒng)簽名,就能夠獲取signatureOrSystem權(quán)限。 /system/app/下的apk,要獲取signatureOrSystem權(quán)限,必須用系統(tǒng)簽名才行。 /data/app下面的apk無(wú)法提取,需要把它復(fù)制到別的目錄下,在下載到電腦 adb shell cp /data/app/com.xueqiu.android-TKqF3b6wXa1KQ3KyKK6o6Q==/base.apk /sdcard/temp123#獲取apk包名 aapt dump badging PartnerBookmarksProvider.apk#獲取包名所在路徑 adb shell pm path 包名用python寫(xiě)一個(gè)通用的apk提取代碼
import os#獲取apk的包名 import timeclass Pull_apk():def __init__(self,package_name,windows_apk_path):""": package_name : apk的包名: windows_apk_path : 指定電腦存儲(chǔ)apk的路徑"""self.get_package_name = package_nameself.self.windows_apk_path = windows_apk_pathdef pull_select_apk(self):#獲取apk所在的路徑apk_path_cmdshow = os.popen(f"adb shell pm path {self.get_package_name}").read()apk_path = apk_path_cmdshow.split(":")[1].strip()apk_name = apk_path.split("/")[-1]windows_apk_path = self.windows_apk_path#嘗試提取到windows系統(tǒng),如果提取不了,則復(fù)制到設(shè)備的sdcard目錄中,再提取到Windowstry:msg = os.popen(f'adb pull {apk_path} {windows_apk_path} ').read()print("----------------")if "1 file pulled" in msg:print("apk復(fù)制成功")else:#復(fù)制到sdcard目錄下os.system(f'adb shell cp {apk_path} /sdcard/')time.sleep(3)os.system(f'adb pull /sdcard/{apk_name} {windows_apk_path}')print("else分支,apk復(fù)制成功")except Exception as e :print(e)return apk_name歡迎關(guān)注我的微信公眾號(hào):
夢(mèng)無(wú)磯的測(cè)試開(kāi)發(fā)之路
總結(jié)
以上是生活随笔為你收集整理的反编译及手机平板apk提取的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 使用 BigDecimal 进行浮点数运
- 下一篇: vive android模拟器,Vrid