-
-
Save flyfire/fb76dc8cb7f3610a759a02286b0712d5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd ~/Library/Android/sdk/platform-tools/ | |
# Get the hash of the mitmproxy-ca certificate. | |
openssl x509 -inform PEM -subject_hash_old -in ~/.mitmproxy/mitmproxy-ca.pem | head -1 | |
# We will use this hash value, append '.0' (dot zero) and use this as the filename for the resulting Android certificate | |
cat ~/.mitmproxy/mitmproxy-ca.pem > c8750f0d.0 | |
openssl x509 -inform PEM -text -in ~/.mitmproxy/mitmproxy-ca.pem -out /dev/null >> c8750f0d.0 | |
# In an other terminal, we will start the emulator with writable /system volume | |
cd ~/Library/Android/sdk/emulator/ | |
# In order to launch an available avd, we list them first. | |
./emulator -list-avds | |
./emulator -writable-system @Pixel_3a_XL_API_28 | |
# We go back to the first terminal and we use adb tool to transfert the certificate | |
adb root | |
adb push c8750f0d.0 /storage/emulated/0/Download | |
# Then, we will mount the volume and get access to the shell | |
adb shell mount -o rw,remount /; | |
adb shell | |
# In the device Android shell, we will move the certificate inside the system partition in the folder '/system/etc/security/' | |
cp /storage/emulated/0/Download/c8750f0d.0 /system/etc/security/cacerts/ | |
chmod 644 /system/etc/security/cacerts/c8750f0d.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment