HTTPS 트래픽 검사를 위해 Android APK (또는 AAB, XAPK)를 준비하는 Python 스크립트 (이전 bash ).
이 스크립트는 APK 파일을 재구성하고 사용자 자격 증명 스토리지를 신뢰할 수 있도록 Android> = 7에서 SSL 고정을 우회 할 수 있습니다. 처리 후 출력 APK 파일은 HTTPS 트래픽 검사를 준비합니다.
AAB 파일이 제공되면 스크립트가 범용 APK를 생성하여 처리합니다. XAPK 파일이 스크립트를 제공하지 않은 경우, 모든 APK 파일을 처리하고 처리합니다.
MacOS, Linux 및 Windows에서 작동합니다.
[테스트 필요] 창의 성능은 아마도 MacOS / Linux보다 몇 배 (~ 3.5)가 낮을 것입니다 ( apktool APK를 해독하는 데 시간이 더 걸립니다).
그것:
java 제외).bundletool (AAB 파일이 제공 한 경우)을 통해 AAB 파일을 APK 파일로 디코딩하거나 Xapk 파일 (Xapk의 경우)을 삭제합니다.apktool 사용하여 APK 파일을 디코딩합니다.network_security_config.xml 패치 (또는 파일이 누락 된 경우 생성);apktool 통해 새 APK 파일을 인코딩합니다.uber-apk-signer 통해 패치 된 APK 파일에 서명합니다.선택적으로 스크립트는 다음을 허용합니다.
adb 를 통해 패치 된 APK 파일을 장치에 직접 설치하십시오.루트 액세스가 필요하지 않습니다.
아래 목록에서 도구를 설치하십시오.
adb 에 경로를 추가하는 것을 잊지 마십시오)아래 도구는 누락 된 경우 스크립트로 다운로드됩니다.
전제 조건 :
pip3 install -r requirements.txt 실행스크립트를 시작할 수 있습니다
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-Device에 패치 된 APK 파일을 설치하십시오.
python3 apk-rebuild.py input.apk -r -i
소스 파일의 경로는 첫 번째 인수로 지정되어야합니다.
the network_security_config.xml 에 <debug-overrides> android:networkSecurityConfig AndroidManifest.xml > 요소를 application 에 추가하도록 요청할 수 있습니다. https://developer.android.com/training/articles/security-config#debug-overrides.버그 보고서, 기능 요청 또는 아이디어에 대해 논의하려면 여기에서 문제를 엽니 다.
많은 감사 :