1.首先下载httpcanary的专业版
链接: https://pan.baidu.com/s/1cgneyOGvpNR8pENQ9RFFDQ 提取码: ocmb
2.将下面的sh文件,放到手机的 /data/local/tmp 目录,命令为cert.sh
并给权限chmod 777 cert.sh
# cert.sh
set -e # Fail on error
# Create a separate temp directory, to hold the current certificates
# Without this, when we add the mount we can't read the current certs anymore.
mkdir -m 700 /data/local/tmp/cert
# Copy out the existing certificates
cp /system/etc/security/cacerts/* /data/local/tmp/cert/
# Create the in-memory mount on top of the system certs folder
mount -t tmpfs tmpfs /system/etc/security/cacerts
# Copy the existing certs back into the tmpfs mount, so we keep trusting them
mv /data/local/tmp/cert/* /system/etc/security/cacerts/
# Copy our new cert in, so we trust that too
cp /data/local/tmp/87bc3517.0 /system/etc/security/cacerts/
# Update the perms & selinux context labels, so everything is as readable as before
chown root:root /system/etc/security/cacerts/*
chmod 644 /system/etc/security/cacerts/*
chcon u:object_r:system_file:s0 /system/etc/security/cacerts/*
# Delete the temp cert directory & this script itself
rm -r /data/local/tmp/cert
# rm ${injectionScriptPath}
echo "System cert successfully injected"
需要注意的是重启手机之后证书就失效了,每次抓包前执行一下就可以了
3.设置httpcanary的部分
mv HttpCanary.pem HttpCanary.jks
mv HttpCanary.jks /data/data/com.guoshi.httpcanary.premium/cache/
其中HttpCanary.pem和87bc3517.0我我已经导出到网盘
链接: https://pan.baidu.com/s/1MhDHmxDoRFDFFbjkj5XMRQ 提取码: 7we0