Skip to content

Commit

Permalink
Merge pull request #2 from NahidaBuer/main
Browse files Browse the repository at this point in the history
✨ add android 14 support
  • Loading branch information
wanghongenpin authored Dec 2, 2023
2 parents 7300f85 + 1512fee commit bb7cfd5
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ProxyPin Certificate
这是一个Magisk 模块 用于安装ProxyPin系统证书, 安装完后需要重启手机.
这是一个 Magisk 模块 用于安装ProxyPin系统证书, 安装完后需要重启手机.

抓包下载地址
https://github.com/wanghongenpin/network_proxy_flutter
4 changes: 2 additions & 2 deletions module.prop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id=ProxyPinCA
name=ProxyPinCA
version=1.0.0
versionCode=1
version=1.1.0
versionCode=2
author=ProxyPin
description=ProxyPin certificate.
39 changes: 39 additions & 0 deletions post-fs-data.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/system/bin/sh

if [ -d /apex/com.android.conscrypt/cacerts ]; then
# 检测到 android 14 以上,存在该证书目录
CERT_HASH=243f0bfb
MODDIR=${0%/*}
NEW_CERT_FILE=${MODDIR}/system/etc/security/cacerts/${CERT_HASH}.0
LOG_PATH="/cache/ProxyPinCA.log"
echo "Found /apex/com.android.conscrypt/cacerts." >> ${LOG_PATH}
echo "Adding new certificate to /apex/com.android.conscrypt/cacerts." >> ${LOG_PATH}

# 创建一个临时目录
TEMP_DIR="/data/local/tmp/proxypin-ca-certs"
mkdir -p "$TEMP_DIR"

# 挂载临时文件系统
mount -t tmpfs tmpfs "$TEMP_DIR"

# 复制原始证书到临时目录
cp -f /apex/com.android.conscrypt/cacerts/* "$TEMP_DIR"

# 添加新证书到临时目录
cp -f "$NEW_CERT_FILE" "$TEMP_DIR"

# 检查新证书是否成功添加
if [ -f "$TEMP_DIR/$(basename "$NEW_CERT_FILE")" ]; then
# 如果新证书成功添加,则挂载回原始目录
mount --bind "$TEMP_DIR" /apex/com.android.conscrypt/cacerts
echo "Mount success!" >> ${LOG_PATH}
else
echo "Failed to add new certificate." >> ${LOG_PATH}
fi

# 卸载临时目录
umount "$TEMP_DIR"
rmdir "$TEMP_DIR"
else
echo "/apex/com.android.conscrypt/cacerts not exists." >> ${LOG_PATH}
fi

0 comments on commit bb7cfd5

Please sign in to comment.