TryHackMe-Ninja-Skills

靶机链接:Ninja Skills

难度:中等(如果对linux不够熟悉那就是很难)

目地是高效的完成任务.

Answer the questions about the following files:
8V2L
bny0
c4ZX
D8B3
FHl1
oiMO
PFbD
rmfX
SRSq
uqyw
v2Vb
X1Uy
The aim is to answer the questions as efficiently as possible.

先写一个脚本文件

1
2
3
4
5
6
7
8
9
10
#!/bin/bash

a=('8V2L' 'bny0' 'c4ZX' 'D8B3' 'FHl1' 'oiMO' 'PFbD' 'rmfX' 'SRSq' 'uqyw' 'v2Vb' 'X1Uy')

#echo ${a[@]}

for i in ${a[@]}
do
find / -name "$i" 2>/dev/null
done

1

Q:Which of the above files are owned by the best-group group(enter the answer separated by spaces in alphabetical order)

bash 1.sh|xargs ls -l

2

1
2
bash 1.sh|xargs grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}"
/opt/oiMO:1.1.1.1

3

1
bash 1.sh|xargs md5sum

4

找不到一个文件,推断出只有那个文件是230行
bash 1.sh|xargs wc -l

5

1
find / -type f -user 502 2>/dev/null

6

查看 ## 1的结果

总结

xargs有些命令无法接受管道符的输入,所以就要使用到这个命令

md5sum 计算md5哈希值
([0-9]{1,3}[\.]){3}[0-9]{1,3}正则表达式筛选ip