Shell_sf1() {
    max_attempts=300
    start_line=2
    total_lines=$(wc -l < "$file_path")

    while true; do
        if tail -n +$start_line "$file_path" | gzip -cd > 解e.sh 2>/dev/null; then
            echo -e "解压缩成功，请查看当前路径！"
            exit 0
        else
            start_line=$((start_line + 1))
            if [ "$total_lines" -eq "$start_line" ]; then
                echo "算法1解压失败，正在切换算法2"
                Shell_sf2
            fi
            echo -e "解压缩失败。"
            echo -e "尝试从第 $start_line 行开始进行解压…"
            if [ $start_line -eq $max_attempts ]; then
                while true; do
                    echo "\n已尝试到第 $max_attempts 行"
                    echo "输入 'qh' 切换算法2进行尝试"
                    echo "回车则继续算法1继续尝试"
                    echo "输入其他则退出程序"
                    read user_input
                    if [ -z "$user_input" ]; then
                        start_line=301
                        echo "继续从第 301 行尝试"
                        break
                    elif [ "$user_input" == "qh" ]; then
                        echo "正在更换算法2…"
                        Shell_sf2
                    else
                        echo "退出程序"
                        exit
                    fi
                done
            fi
        fi
    done
}

# 解压算法2
Shell_sf2() {
    max_attempts=300
    start_line=2
    total_lines=$(wc -l < "$file_path")

    while true; do
        if tail -n +$start_line "$file_path" | xxd -r -p > 解e.sh 2>/dev/null; then
            echo -e "解压缩成功，请查看当前路径！"
            exit 0
        else
            start_line=$((start_line + 1))
            if [ "$total_lines" -eq "$start_line" ]; then
                echo "算法1解压失败，正在切换算法2"
                Shell_sf2
            fi
            echo -e "解压缩失败。"
            echo -e "尝试从第 $start_line 行开始进行解压…"
            if [ $start_line -eq $max_attempts ]; then
                while true; do
                    echo "\n已尝试到第 $max_attempts 行"
                    echo "输入 'qh' 切换算法2进行尝试"
                    echo "回车则继续算法1继续尝试"
                    echo "输入其他则退出程序"
                    read user_input
                    if [ -z "$user_input" ]; then
                        start_line=301
                        echo "继续从第 301 行尝试"
                        break
                    elif [ "$user_input" == "qh" ]; then
                        echo "正在更换算法3…"
                        Shell_sf3
                    else
                        echo "退出程序"
                        exit
                    fi
                done
            fi
        fi
    done
}

# 解压算法3
Shell_sf3() {
    rm 解e.sh
    max_attempts=300
    start_line=2

    while true; do
        if tail -n +$start_line "$file_path" | bzcat > 解e.sh 2>/dev/null; then
            echo -e "解压缩成功，请查看当前路径！"
            exit 0
        else
            start_line=$((start_line + 1))
            if [ "$total_lines" -eq "$start_line" ]; then
                echo "已全部尝试，解压失败"
                exit
            fi
            echo -e "解压缩失败。"
            echo -e "尝试从第 $start_line 行开始进行解压…"
            if [ $start_line -eq $max_attempts ]; then
                while true; do
                    echo "已尝试到第 $max_attempts 行，输入 'exit' 退出 (回车继续尝试):"
                    read user_input
                    if [ -z "$user_input" ]; then
                        start_line=301
                        echo "继续从第 301 行尝试"
                        break
                    elif [ "$user_input" == "exit" ]; then
                        echo "退出程序"
                        exit 1
                    else
                        echo "无效输入，请输入 'exit' 或直接回车继续尝试。"
                    fi
                done
            fi
        fi
    done
}

use(){
    r=$1
    if [ "$r" = "1" ];then
        filename=$2
        if [ ! -f "$filename" ]; then
            echo "文件不存在"
            exit
        fi
        echo "开始dump"
        chmod 777 $filename
        ulimit -c unlimited
        corp=/proc/sys/kernel/core_pattern
        core=$(cat $corp)
        echo $(pwd)/%e.%p.dump > $corp
        $filename & (sleep 0.01 && kill -SIGSEGV $!)
        sleep 1
        echo $core > $corp
        ulimit -c 0
        echo "dump完毕"
    fi
    if [ "$r" = "2" ];then
        file=$2
        if [ ! -f "$file" ]; then
            echo "文件不存在"
            exit
        fi
        mkdir -p tmp1/tmp/tmp tmp2
		mount tmp1 /data/data
		mount tmp1 /data/app
		"$file" &
		time=`date +%s`
		until [ $((`date +%s` - $time)) -ge 3 ]
		do
			cp -rf /data/data/* tmp2
			cp -rf /data/app/* tmp2
		done
		kill -9 $(pidof `basename "$file"`)
		for i in `find tmp2 -type f`
		do
			case `basename $i` in
				su|.os) continue ;;
			esac
			kill -9 `pgrep -f $i`
		done
		for i in `pgrep -f sh bash toybox busybox`
		do
			case $i in
				$$|$PPID) continue ;;
			esac
			kill -9 $i
		done
		umount /data/data
		umount /data/app
		mv `find tmp2 -type f` "${file%/*}"
		rm -rf tmp1 tmp2
    fi
    if [ "$r" = "3" ];then
        (sleep 0.2s && mount --bind osh $SHELL) &
		$SHELL
		umount -f $SHELL
    fi
    if [ "$r" = "4" ];then
        filename=$2
        if [ ! -f "$filename" ]; then
            echo "文件不存在"
            exit
        fi
        LD_PRELOAD=./libfake.so "$filename" > output.log
        LD_PRELOAD=
        echo "共享库hook成功，已保存到output.log文件"
    fi
    if [ "$r" = "5" ];then
        file=$2
        if [ ! -f "$file" ]; then
            echo "文件不存在"
            exit
        fi
        printf 请输入要改成输出模式的命令：
		read -r mode
		[ -d bin ] && rm bin/* || mkdir bin
		for i in $mode
		do
			 ln -s "${0%/*}/osh" bin/$i
		done
		readonly export PATH=`pwd`/bin:$PATH
		"$file"
    fi
    if [ "$r" = "6" ];then
        file=$2
        if [ ! -f "$file" ]; then
            echo "文件不存在"
            exit
        fi
        printf 请输入要别名成输出模式的命令：
		read -r mode
		for i in $mode
		do
			let a++
			sed -i ${a}ialias\ $i=echo "$file"
		done
		sed -i ${a}aset\ -x "$file"
		let a++
		sed -i ${a}aalias\ set=echo "$file"
		let a++
		sed -i ${a}aalias\ unalias=echo "$file"
		let a++
		sed -i ${a}aalias\ alias=echo "$file"
		"$file" 2>&1 | tee output.log
    fi
    if [ "$r" = "7" ];then
        filename=$2
        if [ ! -f "$filename" ]; then
            echo "文件不存在"
            exit
        fi
        aaaa=$(pwd)
        "$filename" & cd /proc/$!/fd;cat 3 > $aaaa/output.log
        echo "获取成功，已保存到output.log文件"
    fi
    if [ "$r" = "8" ];then
        filename=$2
        if [ ! -f "$filename" ]; then
            echo "文件不存在"
            exit
        fi
        "$filename" & cat /proc/$!/cmdline > output.log
        echo "获取成功，已保存到output.log文件"
    fi
    if [ "$r" = "9" ];then
        echo "开始解密\nBy Spra"
        ps -eo pid,comm | tac | grep -v grep | while read -r pid comm; do
            if echo "$comm" | egrep -q '\(deleted\)'; then
                cat /proc/$pid/exe > $(pwd)/tmp
                chmod 777 $(pwd)/tmp
                ulimit -c 102400
                corp=/proc/sys/kernel/core_pattern
                core=$(cat $corp)
                echo 玉龙已解密.sh > $corp
                $(pwd)/tmp & (sleep 0.01 && kill -SIGSEGV $!)
                sleep 1
                echo $core > $corp
                ulimit -c 0
                rm -rf $(pwd)/tmp
                echo "解密成功路径：$(pwd)/玉龙已解密.sh\n自行修复"
                exit
            fi
        done
    fi
    if [ "$r" = "10" ];then
        file_path=$2
        if [ ! -f "$file_path" ]; then
            echo "文件不存在"
            exit
        fi
        Shell_sf1
    fi
    if [ "$r" = "11" ];then
        File=$2
        if [ ! -f "$File" ]; then
            echo "文件不存在"
            exit
        fi
        echo "File=$File">111.sh
        echo '
        PATH=/data/data/com.termux/files/usr/bin
        decode() {
            for i in $(seq $(wc -l < "$File"))
            do
                tail -n +$i "$File" | $1 > "$File+" && exec "$0" "$File+"
            done
        } 2>/dev/null
        while IFS= read -r line
        do
            case "$line" in
                *"gzip "*"d"*)
                    decode "gzip -d" "gzip解压缩"
                ;;
                *"bunzip"*|*"bzcat"*)
                    decode "bzcat" "bzip2解压缩"
                ;;
                *"tar -"*)
                    decode "tar -xzvf - -C \"${File%/*}\"" "tar解压缩"
                ;;
                *"base64 -d"*)
                    decode "base64 -d" "base64解编码"
                ;;
                *"xxd "*"r"*)
                    decode "/system/bin/xxd -r -p" "xxd解编码"
                ;;
            esac
            let d++
            [ $d -gt 100 ]
        done < "$File"
        ' >>111.sh
        /data/data/com.termux/files/usr/bin/bash 111.sh
    fi
    if [ "$r" = "12" ];then
        file_path=$2
        if [ ! -f "$file_path" ]; then
            echo "文件不存在"
            exit
        fi
        cat $file_path > 88.sh
        sed -i 's/"\\";/"\\"";/g' 88.sh
        sed -i 's/eval/echo/g' 88.sh
        sh "88.sh" > 定量包已解密.sh
        rm 88.sh
        echo "解密成功，已保存在本地：定量包已解密.sh"
    fi
    if [ "$r" = "13" ];then
        file_path=$2
        if [ ! -f "$file_path" ]; then
            echo "文件不存在"
            exit
        fi
        cat $file_path > 88.sh
        echo -n "尾行数据："
        read a
        echo -n "尾行数据中base64："
        read b
        c=$(echo $b | base64 -d)
        d="$(echo "$c" | sed 's/eval/echo/g') > 解base64分段.sh"
        sed -i "s/$a/$d/g" 88.sh
        sh 88.sh
        rm 88.sh
        echo "解密成功，已保存在本地：解base64分段.sh"
    fi
}


clear

if [ ! -f osh ];then
    echo "H4sICNTMYmcEAzEzNzY1ODk4LnRtcADtWwlQG1UYfpsNDaWURguFYiurdpRqCQHC0XpRoFIUFbGe
[payload removed: 6308 characters in 83 lines]
UAAA" | base64 -d > a
    tar -xvf a > /dev/null
    rm a
fi

printf '\033[1m\033[33m'
cat << 'EOF'

                       _ooOoo_
                      o8888888o
                      88" . "88
                      | -_- |)
                      O\  =  /O
                   ____/`---'\____
                 .'  \\|     |//  `.
                /  \\|||  :  |||//  \
               /  _||||| -:- |||||-  \
               |   | \\\  -  /// |   |
               | \_|  ''\---/''  |   |
               \  .-\__  `-`  ___/-. /
             ___`. .'  /--.--\  `. . __
          ."" '<  `.___\_<|>_/___.'  >'"".
         | | :  `- \`.;`\ _ /`;.`/ - ` : | |
         \  \ `-.   \_ __\ /__ _/   .-` /  /
    ======`-.____`-.___\_____/___.-`____.-'======
                       `=---='
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                 佛主保佑 · 永无BUG
EOF
sleep 0.618
clear
printf \\033[32m
cat << 'EOF'
____
/ ___| _ __  _ __ __ _
\___ \| '_ \| '__/ _` |
 ___) | |_) | | | _| |
|____/| .__/|_|  \__,_|
      |_|
EOF
printf \\033[37m

echo "工具箱源码特别赞助：
NULL / M (以上属同一人)
--------------------------
北夜
--------------------------
作者：Spra
V5版本
"

[ ! -f osh ] && exit
[ ! -f libfake.so ] && exit
chmod 777 osh
chmod 777 libfake.so

echo "[1] dump
[2] 落地壳拦截
[3] 解释器替换
[4] 共享库hook
[5] 命令注释
[6] 混淆通杀
---------------------小白区下方
[7] shellc通杀
[8] shc通杀
[9] 二进制玉龙一键解密
[10] 套壳通杀(小吴版)
[11] 套壳通杀(NULL版)
[12] 定量包混淆
[13] base64分段变异
"
echo -n "请输入序号："
read xx
if [ "$xx" = "1" ]; then
    echo -n "请输入文件路径:"
    read a
    use 1 $a
fi
if [ "$xx" = "2" ]; then
    echo -n "请输入文件路径:"
    read a
    use 2 $a
fi
if [ "$xx" = "3" ]; then
    clear
    use 3
fi
if [ "$xx" = "4" ]; then
    echo -n "请输入文件路径:"
    read a
    use 4 $a
fi
if [ "$xx" = "5" ]; then
    echo -n "请输入文件路径:"
    read a
    use 5 $a
fi
if [ "$xx" = "6" ]; then
    echo -n "请输入文件路径:"
    read a
    use 6 $a
fi
if [ "$xx" = "7" ]; then
    echo -n "请输入文件路径:"
    read a
    use 7 $a
fi
if [ "$xx" = "8" ]; then
    echo -n "请输入文件路径:"
    read a
    use 8 $a
fi
if [ "$xx" = "9" ]; then
    echo -n "请在后台运行程序"
    read a
    use 9
fi
if [ "$xx" = "10" ]; then
    echo -n "请输入文件路径:"
    read a
    use 10 $a
fi
if [ "$xx" = "11" ]; then
    echo -n "需要安装termux\n请输入文件路径:"
    read a
    use 11 $a
fi
if [ "$xx" = "12" ]; then
    echo -n "请输入文件路径:"
    read a
    use 12 $a
fi
if [ "$xx" = "13" ]; then
    echo -n "请输入文件路径:"
    read a
    use 13 $a
fi