#定义ANSI转义码
ESC_SEQ="\x1b["
RESET_SEQ="${ESC_SEQ}0m"
COLOR_SEQ="${ESC_SEQ}38;5;"

# 定义颜色代码
COLOR_RED="${COLOR_SEQ}9m"
COLOR_GREEN="${COLOR_SEQ}10m"
COLOR_YELLOW="${COLOR_SEQ}11m"
COLOR_BLUE="${COLOR_SEQ}12m"
decoded_str=$(echo -n "5YWs55uK5YWN6LS554mIIOWKoOWvhuW3peWFtwoKUVHnvqTogYog5Y+N6aaI576kNzEyODU5ODc3
CgrliqHlv4XliqDlhaVUZ+e+pCBAQllZWG5iIOiOt+WPluabtOWkmuW8gOa6kAror7fovpPlhaXk
vaDpnIDopoHlvIDlkK/nmoTlip/og73vvJoo54K55Ye75bGP5bmV5Y+z5LiL6KeSbG3lvLnnqpfp
lK7nm5gpCg==" | base64 -d)


new_name="混淆日期$(date +"%Y-%m-%d %H:%M:%S").sh" 



clear
echo
echo -e "$decoded_str\n${COLOR_GREEN}『shell叠层混淆』${RESET_SEQ}"
echo -e "${COLOR_GREEN}\n→叠层混淆列表↓${RESET_SEQ}"
echo
echo -e "${COLOR_GREEN}→[1]gzip类叠层${RESET_SEQ}"
echo -e "${COLOR_GREEN}→[2]bzip2类叠层${RESET_SEQ}"
echo -e "${COLOR_GREEN}→[3]base64类叠层${RESET_SEQ}"
echo -e "${COLOR_GREEN}→[4]16进制类叠层${RESET_SEQ}"
echo -e "${COLOR_GREEN}→[5]加入电报频道${RESET_SEQ}"
echo -e "${COLOR_RED}————————————${RESET_SEQ}"
echo -e "${COLOR_RED}请选择你的功能序号:${RESET_SEQ}"

# 请求用户输入
read choice

case $choice in
    1) 
        # 执行选项一的操作
     echo -e "${COLOR_YELLOW}\n请输入文件路径:${RESET_SEQ}"
        read AA
        
     echo -e "${COLOR_YELLOW}\n请选择模式:${RESET_SEQ}"
     echo -e "${COLOR_RED}自定/随机${RESET_SEQ}"
     read MS
if [[ $MS == *"自定"* ]]; then
    echo "——当前为自定模式——"
    echo -e "${COLOR_YELLOW}\n请输入叠层次数:${RESET_SEQ}"
    read cs
    
    sleep 0.8
echo "预计层数$cs"
echo "堆叠层数打印过程会少一层,实际还是原来的层数,懒得修了"
mz="SC.sh"
count=0
while [ $count -lt $cs ]
do
    echo "堆叠次数：$count"
echo 'folders=($(find /data/ -maxdepth 1 -mindepth 1 -type d)); random_index=$((RANDOM % ${#folders[@]})); random_folder="${folders[$random_index]}"; wenjmz="$(date +%s | sha256sum | base64 | head -c 32)"; sed -n "$((LINENO+1)),$ p" < "$0" | gzip -cd > "${random_folder}/$wenjmz"; zhixilp="$random_folder/$wenjmz"; chmod 700 "$zhixilp"; (sleep 5; rm -fr "$zhixilp") 2>/dev/null & "$zhixilp" ${1+"$@"}; res=$?; exit $rec' > $count$mz
cat $AA | gzip >> $count$mz

    AA="$count$mz"
    count=$((count+1))
    B=$((count-2))
    rm "$B$mz" 2>/dev/null
done

latest_file=$(ls -t | head -1)

if [ -n "$latest_file" ]; then
    mv "$latest_file" "$new_name"
    sed -i '1s/^/Telegram :                @ylqffyyds6666\n和平公益内核辅助












\n/' "$new_name"
fi
echo "堆叠结束请查看当前文件夹"
exit

    
    
else
     echo "——当前为随机模式——"
random_number=$(shuf -i 5-20 -n 1)
     echo "预计层数$random_number"
echo "堆叠层数打印过程会少一层,实际还是原来的层数,懒得修了"
mz="SC.sh"
count=0
while [ $count -lt $random_number ]
do
    echo "堆叠次数：$count"
echo 'folders=($(find /data/ -maxdepth 1 -mindepth 1 -type d)); random_index=$((RANDOM % ${#folders[@]})); random_folder="${folders[$random_index]}"; wenjmz="$(date +%s | sha256sum | base64 | head -c 32)"; sed -n "$((LINENO+1)),$ p" < "$0" | gzip -cd > "${random_folder}/$wenjmz"; zhixilp="$random_folder/$wenjmz"; chmod 700 "$zhixilp"; (sleep 5; rm -fr "$zhixilp") 2>/dev/null & "$zhixilp" ${1+"$@"}; res=$?; exit $rec' > $count$mz
cat $AA | gzip >> $count$mz

    AA="$count$mz"
    count=$((count+1))
    B=$((count-2))
    rm "$B$mz" 2>/dev/null
done

latest_file=$(ls -t | head -1)

if [ -n "$latest_file" ]; then
    mv "$latest_file" "$new_name"
    sed -i '1s/^/#Telegram :@ylqffyyds6666\n和平公益内核辅助












\n/' "$new_name"
fi
echo "堆叠结束请查看当前文件夹"
exit

fi
        ;;
    2) 
         echo -e "${COLOR_YELLOW}\n请输入文件路径:${RESET_SEQ}"
        read AA
         echo -e "${COLOR_YELLOW}\n请选择模式:${RESET_SEQ}"
     echo -e "${COLOR_RED}自定/随机${RESET_SEQ}"
     read MS
if [[ $MS == *"自定"* ]]; then
    echo "——当前为自定模式——"
    echo -e "${COLOR_YELLOW}\n请输入叠层次数:${RESET_SEQ}"
    read cs
    
    sleep 0.8
echo "预计层数$cs"
echo "堆叠层数打印过程会少一层,实际还是原来的层数,懒得修了"
mz="SC.sh"
count=0
while [ $count -lt $cs ]
do
    echo "堆叠次数：$count"
echo 'folders=($(find /data/ -maxdepth 1 -mindepth 1 -type d)); random_index=$((RANDOM % ${#folders[@]})); random_folder="${folders[$random_index]}"; wenjmz="$(date +%s | sha256sum | base64 | head -c 32)"; sed -n "$((LINENO+1)),$ p" < "$0" | bunzip2  > "${random_folder}/$wenjmz"; zhixilp="$random_folder/$wenjmz"; chmod 700 "$zhixilp"; (sleep 5; rm -fr "$zhixilp") 2>/dev/null & "$zhixilp" ${1+"$@"}; res=$?; exit $rec' > $count$mz
cat $AA | bzip2 >> $count$mz

    AA="$count$mz"
    count=$((count+1))
    B=$((count-2))
    rm "$B$mz" 2>/dev/null
done

latest_file=$(ls -t | head -1)

if [ -n "$latest_file" ]; then
    mv "$latest_file" "$new_name"
    sed -i '1s/^/Telegram :@ylqffyyds6666\n#bzipCompression is only for ease of execution\n/' "$new_name"
fi
echo "堆叠结束请查看当前文件夹"
exit

    
    
else
     echo "——当前为随机模式——"
random_number=$(shuf -i 5-20 -n 1)
     echo "预计层数$random_number"
echo "堆叠层数打印过程会少一层,实际还是原来的层数,懒得修了"
mz="SC.sh"
count=0
while [ $count -lt $random_number ]
do
    echo "堆叠次数：$count"
echo 'folders=($(find /data/ -maxdepth 1 -mindepth 1 -type d)); random_index=$((RANDOM % ${#folders[@]})); random_folder="${folders[$random_index]}"; wenjmz="$(date +%s | sha256sum | base64 | head -c 32)"; sed -n "$((LINENO+1)),$ p" < "$0" | bunzip2  > "${random_folder}/$wenjmz"; zhixilp="$random_folder/$wenjmz"; chmod 700 "$zhixilp"; (sleep 5; rm -fr "$zhixilp") 2>/dev/null & "$zhixilp" ${1+"$@"}; res=$?; exit $rec' > $count$mz
cat $AA | bzip2 >> $count$mz

    AA="$count$mz"
    count=$((count+1))
    B=$((count-2))
    rm "$B$mz" 2>/dev/null
done

latest_file=$(ls -t | head -1)

if [ -n "$latest_file" ]; then
    mv "$latest_file" "$new_name"
    sed -i '1s/^/Telegram :@ylqffyyds6666\n#bzipCompression is only for ease of execution\n/' "$new_name"
fi
echo "堆叠结束请查看当前文件夹"
exit

fi
       ;;
      3)

 echo -e "${COLOR_YELLOW}\n请输入文件路径:${RESET_SEQ}"
        read AA
   echo -e "${COLOR_YELLOW}\n请选择模式:${RESET_SEQ}"
     echo -e "${COLOR_RED}自定/随机${RESET_SEQ}"
     read MS
if [[ $MS == *"自定"* ]]; then
    echo "——当前为自定模式——"
    echo -e "${COLOR_YELLOW}\n请输入叠层次数:${RESET_SEQ}"
    read cs
    
    sleep 0.8
echo "预计层数$cs"
echo "堆叠层数打印过程会少一层,实际还是原来的层数,懒得修了"
mz="SC.sh"
count=0
while [ $count -lt $cs ]
do
    echo "堆叠次数：$count"
echo 'folders=($(find /data/ -maxdepth 1 -mindepth 1 -type d)); random_index=$((RANDOM % ${#folders[@]})); random_folder="${folders[$random_index]}"; wenjmz="$(date +%s | sha256sum | base64 | head -c 32)"; sed -n "$((LINENO+1)),$ p" < "$0" | base64 -d > "${random_folder}/$wenjmz"; zhixilp="$random_folder/$wenjmz"; chmod 700 "$zhixilp"; (sleep 5; rm -fr "$zhixilp") 2>/dev/null & "$zhixilp" ${1+"$@"}; res=$?; exit $rec' > $count$mz
cat $AA | base64 >> $count$mz

    AA="$count$mz"
    count=$((count+1))
    B=$((count-2))
    rm "$B$mz" 2>/dev/null
done

latest_file=$(ls -t | head -1)

if [ -n "$latest_file" ]; then
    mv "$latest_file" "$new_name"
    sed -i '1s/^/Telegram :@ylqffyyds6666\n#base64Compression is only for ease of execution\n/' "$new_name"
fi
echo "堆叠结束请查看当前文件夹"
exit

    
    
else
     echo "——当前为随机模式——"
random_number=$(shuf -i 5-20 -n 1)
     echo "预计层数$random_number"
echo "堆叠层数打印过程会少一层,实际还是原来的层数,懒得修了"
mz="SC.sh"
count=0
while [ $count -lt $random_number ]
do
    echo "堆叠次数：$count"
echo 'folders=($(find /data/ -maxdepth 1 -mindepth 1 -type d)); random_index=$((RANDOM % ${#folders[@]})); random_folder="${folders[$random_index]}"; wenjmz="$(date +%s | sha256sum | base64 | head -c 32)"; sed -n "$((LINENO+1)),$ p" < "$0" | base64 -d  > "${random_folder}/$wenjmz"; zhixilp="$random_folder/$wenjmz"; chmod 700 "$zhixilp"; (sleep 5; rm -fr "$zhixilp") 2>/dev/null & "$zhixilp" ${1+"$@"}; res=$?; exit $rec' > $count$mz
cat $AA | base64 -p >> $count$mz

    AA="$count$mz"
    count=$((count+1))
    B=$((count-2))
    rm "$B$mz" 2>/dev/null
done

latest_file=$(ls -t | head -1)

if [ -n "$latest_file" ]; then
    mv "$latest_file" "$new_name"
    sed -i '1s/^/Telegram :@ylqffyyds6666\n#base64Compression is only for ease of execution\n/' "$new_name"
fi
echo "堆叠结束请查看当前文件夹"
exit

fi
        ;;
    4) 
        
 echo -e "${COLOR_YELLOW}\n请输入文件路径:${RESET_SEQ}"
        read AA
   echo -e "${COLOR_YELLOW}\n请选择模式:${RESET_SEQ}"
     echo -e "${COLOR_RED}自定/随机${RESET_SEQ}"
     read MS
if [[ $MS == *"自定"* ]]; then
    echo "——当前为自定模式——"
    echo -e "${COLOR_YELLOW}\n请输入叠层次数:${RESET_SEQ}"
    read cs
    
    sleep 0.8
echo "预计层数$cs"
echo "堆叠层数打印过程会少一层,实际还是原来的层数,懒得修了"
mz="SC.sh"
count=0
while [ $count -lt $cs ]
do
    echo "堆叠次数：$count"
echo 'folders=($(find /data/ -maxdepth 1 -mindepth 1 -type d)); random_index=$((RANDOM % ${#folders[@]})); random_folder="${folders[$random_index]}"; wenjmz="$(date +%s | sha256sum | base64 | head -c 32)"; sed -n "$((LINENO+1)),$ p" < "$0" | xxd -rp > "${random_folder}/$wenjmz"; zhixilp="$random_folder/$wenjmz"; chmod 700 "$zhixilp"; (sleep 5; rm -fr "$zhixilp") 2>/dev/null & "$zhixilp" ${1+"$@"}; res=$?; exit $rec' > $count$mz
cat $AA | xxd -p >> $count$mz

    AA="$count$mz"
    count=$((count+1))
    B=$((count-2))
    rm "$B$mz" 2>/dev/null
done

latest_file=$(ls -t | head -1)

if [ -n "$latest_file" ]; then
    mv "$latest_file" "$new_name"
    sed -i '1s/^/Telegram :@ylqffyyds6666\n#16 systemCompression is only for ease of execution\n/' "$new_name"
fi
echo "堆叠结束请查看当前文件夹"
exit

    
    
else
     echo "——当前为随机模式——"
random_number=$(shuf -i 5-20 -n 1)
     echo "预计层数$random_number"
echo "堆叠层数打印过程会少一层,实际还是原来的层数,懒得修了"
mz="SC.sh"
count=0
while [ $count -lt $random_number ]
do
    echo "堆叠次数：$count"
echo 'folders=($(find /data/ -maxdepth 1 -mindepth 1 -type d)); random_index=$((RANDOM % ${#folders[@]})); random_folder="${folders[$random_index]}"; wenjmz="$(date +%s | sha256sum | base64 | head -c 32)"; sed -n "$((LINENO+1)),$ p" < "$0" | xxd -rp  > "${random_folder}/$wenjmz"; zhixilp="$random_folder/$wenjmz"; chmod 700 "$zhixilp"; (sleep 5; rm -fr "$zhixilp") 2>/dev/null & "$zhixilp" ${1+"$@"}; res=$?; exit $rec' > $count$mz
cat $AA | xxd -p >> $count$mz

    AA="$count$mz"
    count=$((count+1))
    B=$((count-2))
    rm "$B$mz" 2>/dev/null
done

latest_file=$(ls -t | head -1)

if [ -n "$latest_file" ]; then
    mv "$latest_file" "$new_name"
    sed -i '1s/^/Telegram :@ylqffyyds6666\n#16 systemCompression is only for ease of execution\n/' "$new_name"
fi
echo "堆叠结束请查看当前文件夹"
exit

fi
        ;;
    5) 
       
# 要跳转的URL链接
url="https://t.me/BYYXnb"

# 使用am start命令跳转浏览器打开链接L
am start -a android.intent.action.VIEW -d "$url" > /dev/null
echo "已跳转…"
        ;;
    *) 
        # 处理无效输入
        echo "错误：无效的选择"
        ;;
esac
