# 抓包检测
if [ -e /sys/class/net/tun0 ] ; then
echo -e "\033[31m请断开VPN连接"
exit
fi

package_names=("org.telegram.messenger" "org.telegram.messenger.web" "tw.nekomimi.nekogram" "org.telegram.csc.messenger" "org.thunderdog.challegram" "nekox.messenger" "xyz.nextalone.nagram")

installed_packages=()

for package_name in "${package_names[@]}"
do
    if pm list packages | grep -q "^package:${package_name}$"; then
        installed_packages+=("$package_name")
    fi
done

echo -e "\033[33m╔════════════════════════════════════════════╗"
echo -e "\033[33m╠\033[31m███ \033[37m 3.4 PUBG M无限游客"
echo -e "\033[33m╠\033[33m原作者：\033[37m██ ██ \033[90m(破解加密不留名)"
echo -e "\033[33m╠\033[33m解密者 FuckError11 ▋优化&修改者 FuckError11"
echo -e "\033[33m╠════════════════════════════════════════════"
echo -e "\033[33;1m╠ \033[33;1m选择要重置游客的游戏版本\033[0m"
echo -e "\033[33m╠════════════════════════════════════════════"
echo -e "\033[33m╠ \033[31m[ 1 ]\033[37m[全球服 - GL](com.tencent.ig)"
echo -e "\033[33m╠ \033[31m[ 2 ]\033[37m[日韩服 - KR](com.pubg.krmobile)"
echo -e "\033[33m╠ \033[31m[ 3 ]\033[37m[越南服 - VNG](com.vng.pubgmobile)"
echo -e "\033[33m╠ \033[31m[ 4 ]\033[37m[台湾服 - TW](com.rekoo.pubgm)"
echo -e "\033[33m╠ \033[31m[ 5 ]\033[37m[印度服 - BGMI](com.pubg.imobile)"
echo -e "\033[33m╠════════════════════════════════════════════"
echo -e "\033[33m╠ \033[31m[ 6 ]\033[37mJOIN TG Channel(加入TG频道)"
echo -e "\033[33m╠ \033[31m[ Other ]\033[31mEXIT(退出)"
echo -e "\033[33m╠════════════════════════════════════════════"
echo -e "\033[33m╠ \033[31m[提醒]\033[37m原作者只表示可用于全球服，本人仅增加更多选项，具体效果未测试"
echo -e "\033[33m╚════════════════════════════════════════════╝"
read UserEcho
case $UserEcho in
    1)
        PackageName="com.tencent.ig"
        ;;
    2)
        PackageName="com.pubg.krmobile"
        ;;
    3)
        PackageName="com.vng.pubgmobile"
        ;;
    4)
        PackageName="com.rekoo.pubgm"
        ;;
    5)
        PackageName="com.pubg.imobile"
        ;;
    6)
        for installed_package in "${installed_packages[@]}"
        do
            url="https://t.me/ErrorKernel"
            output=$(am start -a android.intent.action.VIEW -d "$url" -n "$installed_package"/org.telegram.ui.LaunchActivity 2>&1)
            if [ $? -eq 0 ]; then
                echo -e "\033[32mSuccess！"
            else
                echo -e "\033[31mFailed！"
            fi
            exit
        done
        ;;
    *)
    echo -e "\033[90m退出程序"
    exit 
        ;;

esac
echo -e "\033[1;33;40m-包名 ${PackageName} 支持版本:3.4.0\e[0m"
rm -rf /data/data/${PackageName}/shared_prefs /storage/emulated/0/Documents/
mkdir /data/data/${PackageName}/shared_prefs
chmod 777 /data/data/${PackageName}/shared_prefs
rm -rf /data/data/${PackageName}/files

GUEST="/data/data/${PackageName}/shared_prefs/device_id.xml"
rm -rf $GUEST
echo "<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
    <string name=\"random\"></string>
    <string name=\"install\"></string>
    <string name=\"uuid\">$RANDOM$RANDOM-$RANDOM-$RANDOM-$RANDOM-$RANDOM$RANDOM$RANDOM</string>
</map>" > $GUEST
rm -rf /data/data/${PackageName}/databases
rm -rf /data/media/0/Android/data/${PackageName}/files/login-identifier.txt
rm -rf /data/media/0/Android/data/${PackageName}/files/UE4Game/ShadowTrackerExtra/ShadowTrackerExtra/Intermediate
touch /data/media/0/Android/data/${PackageName}/files/UE4Game/ShadowTrackerExtra/ShadowTrackerExtra/Intermediate
rm -rf /data/media/0/Android/data/${PackageName}/files/TGPA
touch /data/media/0/Android/data/${PackageName}/files/TGPA
rm -rf /data/media/0/Android/data/${PackageName}/files/ProgramBinaryCache
touch /data/media/0/Android/data/${PackageName}/files/ProgramBinaryCache
iptables -I OUTPUT -d cloud.vmp.onezapp.com -j REJECT
iptables -I INPUT -s cloud.vmp.onezapp.com -j REJECT
clear
am start -n ${PackageName}/com.epicgames.ue4.SplashActivity &>/dev/null

rm -rf /data/data/${PackageName}/shared_prefs /storage/emulated/0/Documents/
mkdir /data/data/${PackageName}/shared_prefs
chmod 777 /data/data/${PackageName}/shared_prefs
rm -rf /data/data/${PackageName}/files
rm -rf /data/data/${PackageName}/shared_prefs
mkdir /data/data/${PackageName}/shared_prefs
chmod 777 /data/data/${PackageName}/shared_prefs
mkdir -p /data/data/${PackageName}/files/ano_tmp
chmod 000 /data/data/${PackageName}/files/ano_tmp
nanyeyyds="/data/data/${PackageName}/shared_prefs/device_id.xml"
rm -rf $nanyeyyds
echo "<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
    <string name=\"random\"></string>
    <string name=\"install\"></string>
    <string name=\"uuid\">$RANDOM$RANDOM-$RANDOM-$RANDOM-$RANDOM-$RANDOM$RANDOM$RANDOM</string>
</map>" > $nanyeyyds
sleep 0.5
rm -rf /data/data/${PackageName}/databases
rm -rf /data/media/0/Android/data/${PackageName}/files/login-identifier.txt
rm -rf /data/media/0/Android/data/${PackageName}/files/UE4Game/ShadowTrackerExtra/ShadowTrackerExtra/Intermediate
touch /data/media/0/Android/data/${PackageName}/files/UE4Game/ShadowTrackerExtra/ShadowTrackerExtra/Intermediate
rm -rf /data/media/0/Android/data/${PackageName}/files/TGPA
touch /data/media/0/Android/data/${PackageName}/files/TGPA
rm -rf /data/media/0/Android/data/${PackageName}/files/ProgramBinaryCache
touch /data/media/0/Android/data/${PackageName}/files/ProgramBinaryCache
sleep 0.5
rm -rf /data/data/${PackageName}/shared_prefs /storage/emulated/0/Documents/
mkdir /data/data/${PackageName}/shared_prefs
chmod 777 /data/data/${PackageName}/shared_prefs
rm -rf /data/data/${PackageName}/files
sleep 0.5
nanyenb="/data/data/${PackageName}/shared_prefs/device_id.xml"
rm -rf $nanyenb
echo "<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
    <string name=\"random\"></string>
    <string name=\"install\"></string>
    <string name=\"uuid\">$RANDOM$RANDOM-$RANDOM-$RANDOM-$RANDOM-$RANDOM$RANDOM$RANDOM</string>
</map>" > $nanyenb
rm -rf /data/data/${PackageName}/databases
rm -rf /data/media/0/Android/data/${PackageName}/files/login-identifier.txt
rm -rf /data/media/0/Android/data/${PackageName}/files/UE4Game/ShadowTrackerExtra/ShadowTrackerExtra/Intermediate
touch /data/media/0/Android/data/${PackageName}/files/UE4Game/ShadowTrackerExtra/ShadowTrackerExtra/Intermediate
rm -rf /data/media/0/Android/data/${PackageName}/files/TGPA
touch /data/media/0/Android/data/${PackageName}/files/TGPA
rm -rf /data/media/0/Android/data/${PackageName}/files/ProgramBinaryCache
touch /data/media/0/Android/data/${PackageName}/files/ProgramBinaryCache
iptables -I OUTPUT -d cloud.vmp.onezapp.com -j REJECT
iptables -I INPUT -s cloud.vmp.onezapp.com -j REJECT
clear

rm -rf /data/data/${PackageName}/shared_prefs /storage/emulated/0/Documents/
mkdir /data/data/${PackageName}/shared_prefs
chmod 777 /data/data/${PackageName}/shared_prefs
rm -rf /data/data/${PackageName}/files

GUEST="/data/data/${PackageName}/shared_prefs/device_id.xml"
rm -rf $GUEST
echo "<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
    <string name=\"random\"></string>
    <string name=\"install\"></string>
    <string name=\"uuid\">$RANDOM$RANDOM-$RANDOM-$RANDOM-$RANDOM-$RANDOM$RANDOM$RANDOM</string>
</map>" > $GUEST
rm -rf /data/data/${PackageName}/databases
rm -rf /data/media/0/Android/data/${PackageName}/files/login-identifier.txt
rm -rf /data/media/0/Android/data/${PackageName}/files/UE4Game/ShadowTrackerExtra/ShadowTrackerExtra/Intermediate
touch /data/media/0/Android/data/${PackageName}/files/UE4Game/ShadowTrackerExtra/ShadowTrackerExtra/Intermediate
rm -rf /data/media/0/Android/data/${PackageName}/files/TGPA
touch /data/media/0/Android/data/${PackageName}/files/TGPA
rm -rf /data/media/0/Android/data/${PackageName}/files/ProgramBinaryCache
touch /data/media/0/Android/data/${PackageName}/files/ProgramBinaryCache
iptables -I OUTPUT -d cloud.vmp.onezapp.com -j REJECT
iptables -I INPUT -s cloud.vmp.onezapp.com -j REJECT
clear
am start -n ${PackageName}/com.epicgames.ue4.SplashActivity &>/dev/null





echo -e "\033[1;33;40m-已刷新游客 \e[0m"
echo -e "\033[1;33;40m-当前包名 ${PackageName} 支持版本:3.4.0\e[0m"
echo -e "\033[1;33;40m-Root重置游客 已刷新成功\e[0m"
echo