Skip to content

Instantly share code, notes, and snippets.

@vavkamil
Created September 10, 2019 14:47
Show Gist options
  • Save vavkamil/ad5ddbeec4685c6bca271063d0c95054 to your computer and use it in GitHub Desktop.
Save vavkamil/ad5ddbeec4685c6bca271063d0c95054 to your computer and use it in GitHub Desktop.
One Liner For Installing Burp Certificate Into Android Nougat and Later
# https://securitychops.com/2019/08/31/dev/random/one-liner-to-install-burp-cacert-into-android.html
#
curl --proxy http://127.0.0.1:8080 -o cacert.der http://burp/cert \
&& openssl x509 -inform DER -in cacert.der -out cacert.pem \
&& cp cacert.der $(openssl x509 -inform PEM -subject_hash_old -in cacert.pem |head -1).0 \
&& adb root \
&& adb remount \
&& adb push $(openssl x509 -inform PEM -subject_hash_old -in cacert.pem |head -1).0 /sdcard/ \
&& echo -n "mv /sdcard/$(openssl x509 -inform PEM -subject_hash_old -in cacert.pem |head -1).0 /system/etc/security/cacerts/" | adb shell \
&& echo -n "chmod 644 /system/etc/security/cacerts/$(openssl x509 -inform PEM -subject_hash_old -in cacert.pem |head -1).0" | adb shell \
&& echo -n "reboot" | adb shell \
&& rm $(openssl x509 -inform PEM -subject_hash_old -in cacert.pem |head -1).0 \
&& rm cacert.pem \
&& rm cacert.der
@x0xman
Copy link

x0xman commented Jun 27, 2022

Who wants to run it in the Windows system [ WSL ] , this command is run via "WSL"

curl --proxy http://127.0.0.1:8080 -o cacert.der http://burp/cert  \
&& openssl x509 -inform DER -in cacert.der -out cacert.pem \
&& cp cacert.der $(openssl x509 -inform PEM -subject_hash_old -in cacert.pem |head -1).0 \
&& adb.exe root \
&& adb.exe remount \
&& adb.exe push $(openssl x509 -inform PEM -subject_hash_old -in cacert.pem |head -1).0 /sdcard/ \
&& echo -n "mv /sdcard/$(openssl x509 -inform PEM -subject_hash_old -in cacert.pem |head -1).0 /system/etc/security/cacerts/" | adb.exe shell \
&& echo -n "chmod 644 /system/etc/security/cacerts/$(openssl x509 -inform PEM -subject_hash_old -in cacert.pem |head -1).0" | adb.exe shell \
&& echo -n "reboot" | adb.exe shell \
&& rm $(openssl x509 -inform PEM -subject_hash_old -in cacert.pem |head -1).0 \
&& rm cacert.pem \
&& rm cacert.der

@Pawnzr
Copy link

Pawnzr commented Dec 9, 2022

nice one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment