Skip to content

Instantly share code, notes, and snippets.

@sopanatx
Created December 15, 2022 13:51
Show Gist options
  • Save sopanatx/450bf293004389944a8bfd654904f078 to your computer and use it in GitHub Desktop.
Save sopanatx/450bf293004389944a8bfd654904f078 to your computer and use it in GitHub Desktop.
A shell script is used to copy a HttpCanary certificate to the system.
#!/bin/sh
echo "Running: Remount RW /system_root'..."
$(adb shell mount -o rw,remount /system_root)
echo "Done!"
echo "Running: Copying certificate to system_root'..."
$(adb shell cp -f /data/data/com.guoshi.httpcanary/cache/HttpCanary.pem /system_root/system/etc/security/cacerts/87bc3517.0)
echo "Done!"
echo "Running: chmod 644 to change permission of certificate'..."
$(adb shell chmod 644 /system_root/system/etc/security/cacerts/87bc3517.0)
echo "Done!"
echo "Running: touch for creating HttpCanary.jks'..."
$(adb shell touch /data/data/com.guoshi.httpcanary/cache/HttpCanary.jks)
echo "Done!"
echo "Running: chmod 600 to change permission of HttpCanary.jks'..."
$(adb shell chmod 600 /data/data/com.guoshi.httpcanary/cache/HttpCanary.jks)
echo "Done!"
echo "Do you want to reboot the device? (y/n)"
read answer
if [ "$answer" = "y" ]; then
echo "Running 'adb reboot'..."
$(adb reboot)
echo "Done!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment