iphone 越狱后,无法访问/var/mobile/Containers问题

iphone 越狱后,无法访问/var/mobile/Containers问题

对于最新应用来说,需要授予一项权限, 执行下列脚本将会授权

如下,如果没有执行脚本,即使越狱,也会提示没有权限:

iPhone:/var/mobile/Containers/Data root# ls
ls: cannot open directory '.': Operation not permitted

将下面的脚本存入到某份文件,然后执行:

需要在 Cileo 这类越狱软件中安装软件包 ldid

#!/bin/bash
# Author: Shoaloak (Axel Koolhaas) 2024
# Description: Fix iOS binary entitlements/access for "Operation not permitted"

ENTITLEMENT="com.apple.private.security.container-manager"
binaries=("sh" "bash" "zsh" "dash"      # Shell 
          "ls" "cat" "find" "cp" "mv"   # File management
          "rm" "mkdir" "rmdir" "touch"
          "file" "ln" "du" "scp"
          "chmod" "chown" "chgrp"       # Permissions
          "plutil" "otool" "nm" "lldb"  # Debugging
          )

# Confirmation
echo "This script will inject an entitlement into key binaries."
read -p "Are you sure? (y/n)" -n 1 -r
echo

if [[ ! $REPLY =~ ^[Yy]$ ]]; then
    echo "Aborted."
    exit 1
fi

temp_dir=$(mktemp -d)
trap 'rm -rf -- "$temp_dir"' EXIT # Remove temp_dir on exit

for bin in "${binaries[@]}"; do
    # Check if binary exists
    if ! command -v $bin &> /dev/null; then
        echo "Binary '$bin' not found. Skipping."
        continue
    fi

    # Check if the binary already has the entitlement
    if ldid -e "$(which $bin)" | grep -q "${ENTITLEMENT}"; then
        echo "Binary '$bin' already has the entitlement. Skipping."
        continue
    fi

    # Logging
    echo "Injecting entitlement into $bin..."

    # Dump current entitlements
    ldid -e "$(which $bin)" > "${temp_dir}/${bin}.xml"

    # Inject new entitlement using sed
    sed -i'' "s|</dict>|    <key>${ENTITLEMENT}</key>\
    <true/>\
</dict>|" "${temp_dir}/${bin}.xml"

    # Overwrite binary
    ldid -S"${temp_dir}/${bin}.xml" "$(which $bin)"
done

echo "Entitlement injection completed."

Copyright: 采用 知识共享署名4.0 国际许可协议进行许可

Links: https://zwc365.com/2024/04/19/iphone-yue-yu-hou--wu-fa-fang-wen-varmobilecontainers-wen-ti

Buy me a cup of coffee ☕.