前几天参加HITB-XCTF的readfile。除了常规的:cat,tac,less,more,head,tail,nl tailf
命令之外,收集了几个花式读文件内容的命令,可能只有CTF环境中才用得到吧!,记录分享一下。
ps:目标是获取flag.txt的内容
static-sh ./flag.txt
等同于/???/??????-?? ./flag.txt
static-sh ./flag.txt
#输出结果:
./flag.txt: line 1: flag{this_is_a_test}: not found
# 等同于
/???/??????-?? ./flag.txt
#输出结果:
./flag.txt: line 1: flag{this_is_a_test}: not found
paste ./flag.txt /etc/passwd
paste ./flag.txt /etc/passwd
#输出结果:
flag{this_is_a_test} root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
//省略
diff ./flag.txt /etc/passwd
diff ./flag.txt /etc/passwd
#输出结果:
1c1,45
< flag{this_is_a_test}
\ No newline at end of file
---
> root:x:0:0:root:/root:/bin/bash
> daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
> bin:x:2:2:bin:/bin:/usr/sbin/nologin
> sys:x:3:3:sys:/dev:/usr/sbin/nologin
> sync:x:4:65534:sync:/bin:/bin/sync
od -a ./flag.txt
od -a ./flag.txt
#输出结果:
0000000 f l a g { t h i s _ i s _ a _ t
0000020 e s t }
0000024
bzmore ./flag.txt
bzmore ./flag.txt
#输出结果:
------> ./flag.txt <------
flag{this_is_a_test}
bzless ./flag.txt
echo `bzless ./flag.txt`
#输出结果:
------> ./flag.txt <------ flag{this_is_a_test}