android ssl pinning bypass
1.0.0
一個Python腳本(以前的bash ),該腳本為HTTPS交通檢查準備了Android APK(或AAB,XAPK)。
該腳本允許通過重建APK文件並使用戶憑證存儲信任通過重建Android> = 7繞過SSL固定。處理後,輸出APK文件已準備好進行HTTPS流量檢查。
如果AAB文件提供的腳本會創建通用APK並對其進行處理。如果XAPK文件提供了腳本並將其解壓縮並處理每個APK文件。
在MacOS,Linux和Windows上工作。
[需要測試]窗口上的性能可能比MacOS / Linux低幾次(〜3.5)( apktool需要更長的時間來解碼APK)。
它:
java除外);bundletool (如果提供的AAB文件)或解開XAPK文件(如果XAPK);apktool解碼APK文件;network_security_config.xml以使用戶憑證存儲保持信任;apktool編碼新的APK文件;uber-apk-signer簽名修補的APK文件。(可選)腳本允許:
adb將修補的APK文件直接安裝到設備上;不需要根訪問。
從下面的列表中安裝工具:
adb的路徑添加到路徑環境變量)下面的工具將由腳本下載,以防其缺失:
前提:
pip3 install -r requirements.txt以安裝所需的python模塊腳本可以像
python3 /path/to/the/script/apk-rebuild.py
執行python3 apk-rebuild.py -h (或python3 apk-rebuild.py --help )以打印使用手冊。
usage: apk-rebuild.py [-h] [-v] [-i] [--pause] [-p] [-r] [-o OUTPUT] [--no-src] [--only-main-classes] [--ks KS]
[--ks-pass KS_PASS] [--ks-alias KS_ALIAS] [--ks-alias-pass KS_ALIAS_PASS]
file
The script allows to bypass SSL pinning on Android >= 7 via rebuilding the APK file
and making the user credential storage trusted. After processing the output APK file
is ready for HTTPS traffic inspection.
positional arguments:
file path to .apk, .aab or .xapk file for rebuilding
options:
-h, --help show this help message and exit
-v, --version show program's version number and exit
-i, --install install the rebuilded .apk file(s) via adb
--pause pause the script execution before the building the output .apk
-p, --preserve preserve the unpacked content of the .apk file(s)
-r, --remove remove the source file (.apk, .aab or .xapk) after the rebuilding
-o OUTPUT, --output OUTPUT
output .apk file name or output directory path (for .xapk source file)
--no-src use --no-src option when decompiling via apktool
--only-main-classes use --only-main-classes option when decompiling via apktool
--ks KS use custom .keystore file for .aab decoding and .apk signing
--ks-pass KS_PASS password of the custom keystore
--ks-alias KS_ALIAS key (alias) in the custom keystore
--ks-alias-pass KS_ALIAS_PASS
password for key (alias) in the custom keystore
為了重建APK文件,請使用參數。示例如下:
修補AAB文件,不要刪除未包裝的APK文件內容
python3 apk-rebuild.py input.aab --preserve
修補APK文件,修補後刪除源APK文件,然後在Android設備上安裝修補的APK文件
python3 apk-rebuild.py input.apk -r -i
源文件的路徑必須指定為第一個參數。
<debug-overrides>元素添加到the network_security_config.xml (並添加android:networkSecurityConfig屬性中的AndroidManifest.xml中的application元素) https://developer.android.com/training/articles/security-config#debug-overrides。對於錯誤報告,功能請求或討論一個想法,請在此處打開問題。
非常感謝: