bandit闯关解答
Bandit是一个通过使用linux指令来闯关的一个小游戏,使用本关的用户名密码登录服务器后根据提示使用linux命令来找出下一关的登录密码,旨在提高新手对linux指令的熟悉,以下为我闯关的过程及解决思路。
Server: bandit.labs.overthewire.org
Port: 2220
User Name: bandit0
Password: bandit0
Level 1:
bandit0@bandit:~$ ls
readme
bandit0@bandit:~$ vi readme
1 boJ9jbbUNNfktd78OOpsqOltutMc3MY1
Level 2:
bandit1@bandit:~$ ls
-
bandit1@bandit:~$ vi ./-
1 CV1DtqXWVFXTvM2F0k09SHz0YwRINYA9
Level 3:
bandit2@bandit:~$ ls
spaces in this filename
bandit2@bandit:~$ vi spaces\ in\ this\ filename
1 UmHadQclWmgdLOKQ3YNgjWxGoRMb5luK
Level 4:
bandit3@bandit:~$ ls
inhere
bandit3@bandit:~$ cd inhere/
bandit3@bandit:~/inhere$ ls -la
total 12
drwxr-xr-x 2 root root 4096 May 7 2020 .
drwxr-xr-x 3 root root 4096 May 7 2020 ..
-rw-r----- 1 bandit4 bandit3 33 May 7 2020 .hidden
bandit3@bandit:~/inhere$ vi .hidden
1 pIwrPrtPN36QITSp3EQaw936yaFoFgAB
Level 5:
bandit4@bandit:~$ ls
inhere
bandit4@bandit:~$ cd inhere/
bandit4@bandit:~/inhere$ ls
-file00 -file02 -file04 -file06 -file08
-file01 -file03 -file05 -file07 -file09
bandit4@bandit:~/inhere$ file ./*
./-file00: data
./-file01: data
./-file02: data
./-file03: data
./-file04: data
./-file05: data
./-file06: data
./-file07: ASCII text
./-file08: data
./-file09: data
bandit4@bandit:~/inhere$ vi ./-file07
1 koReBOKuIDDepwhWk7jZC0RTdopnAYKh
Level 6:
bandit5@bandit:~$ ls
inhere
bandit5@bandit:~$ cd inhere/
bandit5@bandit:~/inhere$ ls
maybehere00 maybehere04 maybehere08 maybehere12 maybehere16
maybehere01 maybehere05 maybehere09 maybehere13 maybehere17
maybehere02 maybehere06 maybehere10 maybehere14 maybehere18
maybehere03 maybehere07 maybehere11 maybehere15 maybehere19
bandit5@bandit:~/inhere$ find -type f -size 1033c -exec ls -l {} \;
-rw-r----- 1 root bandit5 1033 May 7 2020 ./maybehere07/.file2
bandit5@bandit:~/inhere$ vi ./maybehere07/.file2
1 DXjZPULLxYr17uwoI01bNLQbtFemEgo7
Level 7:
bandit6@bandit:~$ ls
bandit6@bandit:~$ find / -user bandit7 -group bandit6 -exec ls -la {} \;
find: 鈥?root鈥? Permission denied
find: 鈥?home/bandit31-git鈥? Permission denied
find: 鈥?lost+found鈥? Permission denied
...
find: 鈥?var/lib/polkit-1鈥? Permission denied
-rw-r----- 1 bandit7 bandit6 33 May 7 2020 /var/lib/dpkg/info/bandit7.password
find: 鈥?var/cache/ldconfig鈥? Permission denied
bandit6@bandit:~$ vi /var/lib/dpkg/info/bandit7.password
1 HKBPTKQnIay4Fw76bEy8PVxKEDQRKTzs
Level 8:
bandit7@bandit:~$ ls
data.txt
bandit7@bandit:~$ grep -F millionth data.txt
millionth cvX2JJa4CFALtqS87jk27qwqGhBM9plV
bandit7@bandit:~$
Level 9:
bandit8@bandit:~$ ls
data.txt
bandit8@bandit:~$ sort data.txt | uniq -u
UsvVyFSfZZWbi6wgC7dAFyFuR6jQQUhR
Level 10::
bandit9@bandit:~$ ls
data.txt
bandit9@bandit:~$ strings data.txt | grep -F ===
========== the*2i"4
========== password
Z)========== is
&========== truKLdjsbJ5g7yyJ2X2R0o3a5HQJFuLk
bandit9@bandit:~$
Level 11:
bandit10@bandit:~$ ls
data.txt
bandit10@bandit:~$ base64 -d data.txt
The password is IFukwKGsFW8MOq3IRFqrxE1hxTNEbUPR
bandit10@bandit:~$
Level 12:
bandit11@bandit:~$ ls
data.txt
bandit11@bandit:~$ cat data.txt
Gur cnffjbeq vf 5Gr8L4qetPEsPk8htqjhRK8XSP6x2RHh
bandit11@bandit:~$ cat data.txt | tr a-zA-Z n-za-mN-ZA-M
The password is 5Te8Y4drgCRfCx8ugdwuEX8KFC6k2EUu
bandit11@bandit:~$