Level 2 -> Level 3
<Level Goal>
The password for the next level is stored in a file called spaces i this filename located in the home directory
Solve
ํ ๋๋ ํ ๋ฆฌ์ ์์นํ 'space in this filename'์ password๊ฐ ์๋ค๊ณ ํ๋ค. pwd๋ก ํ์ฌ ๋๋ ํ ๋ฆฌ๊ฐ home ๋๋ ํ ๋ฆฌ์ธ ๊ฒ์ ํ์ธํ๊ณ ls ๋ช ๋ น์ด๋ก ์ด๋ค ํ์ผ์ด ์๋์ง ์ดํด๋ดค๋ค.
์ผ๋จ space in this filename์ด๋ผ๋ ํ์ผ์ด ์กด์ฌํ๋ ๊ฒ์ ํ์ธํ๋ค. ํ์ง๋ง cat ๋ช ๋ น์ด์์ error๊ฐ ๋๋ค. ์คํ์ด์ค๋ก ์ธํด ํ๋์ ํ์ผ ์ด๋ฆ์ด 4๊ฐ์ ํ์ผ๋ก ๋ถ๋ฆฌ๋์ ํด์๋๊ณ ์๋ ๊ฒ ๊ฐ๋ค.
bandit2@bandit:~$ pwd
/home/bandit2
bandit2@bandit:~$ ls
spaces in this filename
bandit2@bandit:~$ cat space in this filename
cat: space: No such file or directory
cat: in: No such file or directory
cat: this: No such file or directory
cat: filename: No such file or directory
๊ทธ๋ ๋ค๋ฉด ์คํ์ด์ค๊ฐ ํฌํจ๋ ํ์ผ ๋ช ์ด ํ๋์ ํ์ผ๋ช ์ผ๋ก ์ธ์๋๊ฒ ํ๋ฉด ๋๋ค.
์์ ๋ฐ์ดํ๋ ๋ชจ๋ ํน์ ๋ฌธ์๋ฅผ ๋ฌด์ํ๊ณ , ํฐ ๋ฐ์ดํ๋ $์ `(๋ฐฑ ๋ฐ์ดํ)์ \(๋ฐฑ์ฌ๋์)๋ฅผ ์ ์ธํ ๋ชจ๋ ๋ฌธ์๋ฅผ ๋ฌด์ํ๋ค.
# ํฐ ๋ฐ์ดํ๋ก ๋ฌถ๊ธฐ
bandit2@bandit:~$ cat "spaces in this filename"
MNk8KNH3Usiio41PRUEoDFPqfxLPlSmx
# ์์ ๋ฐ์ดํ๋ก ๋ฌถ๊ธฐ
bandit2@bandit:~$ cat 'spaces in this filename'
MNk8KNH3Usiio41PRUEoDFPqfxLPlSmx
์๋๋ฉด \(๋ฐฑ์ฌ๋์)๋ฅผ ์ด์ฉํด ๊ณต๋ฐฑ์ ์ด์ค์ผ์ดํ ํ ์๋ ์๋ค.
bandit2@bandit:~$ cat spaces\ in\ this\ filename
MNk8KNH3Usiio41PRUEoDFPqfxLPlSmx
More
๊ณต๋ฐฑ์ด ์๋ ํ์ผ์ ๋ง๋ค ๋๋ ์์ ๋ฐฉ์์ ์ฌ์ฉํ๋ฉด ๋๋ค. ์๋์ 3๊ฐ์ง ๋ฐฉ์์ผ๋ก ๊ณต๋ฐฑ์ ํฌํจํ ํ์ผ ์ด๋ฆ์ ๋ง๋ค ์ ์๋ค.
โโโ(kaliใฟkali)-[~/bandit]
โโ$ touch 'file name with space'
โโโ(kaliใฟkali)-[~/bandit]
โโ$ touch file\ name\ with\ spaces
โโโ(kaliใฟkali)-[~/bandit]
โโ$ vi 'file name with enter'
Level 3 -> Level 4
<Level Goal>
The password for the next level is stored in a hidden file in the inhere directory
Solve
inhere ๋๋ ํ ๋ฆฌ์ hidden file(์จ๊ฒจ์ง ํ์ผ)์ password๊ฐ ์กด์ฌํ๋ค๊ณ ํ๋ค.
ls ๋ช ๋ น์ด ๊ฒฐ๊ณผ home ๋๋ ํ ๋ฆฌ ํ์์ inhere ๋๋ ํ ๋ฆฌ๊ฐ ์กด์ฌํ๋ค. inhere ๋๋ ํ ๋ฆฌ๋ก ์ด๋ํ ์ ls ๋ช ๋ น์ด๋ฅผ ์จ๋ดค์ ๋๋ ์๋ฌด ๊ฒ๋ ์๋ค๊ณ ๋ฌ๋ค.
bandit3@bandit:~$ ls
inhere
bandit3@bandit:~$ cd inhere
bandit3@bandit:~/inhere$ ls
bandit3@bandit:~/inhere$
ls -l ๋ช ๋ น์ด ๊ฒฐ๊ณผ๊ฐ total 0์ด๋ผ '์ ๋ง ์๋ฌด๊ฒ๋ ์๋?'๋ผ๊ณ ์๊ฐํ์ง๋ง, hidden file์ด๋ผ๋ ์ด๋ฆ์ด ๊ฑธ๋ ค์ ls -a ๋ช ๋ น์ด๋ฅผ ์จ๋ดค๋ค. ๊ทธ๋ฌ๋๋ ๋ญ๊ฐ ์ถ๋ ฅ๋์๋ค.
bandit3@bandit:~/inhere$ ls -l
total 0
bandit3@bandit:~/inhere$ ls -a
. .. ...Hiding-From-You
์ถ๋ ฅ๋ ...Hiding-From-Yor ํ์ผ์ cat ๋ช ๋ น์ด๋ก ์ฝ์ด๋ดค๋ค. ๊ทธ๋ฌ๋๋ password๊ฐ ๋์๋ค. 4๋จ๊ณ๋ ํด๋ฆฌ์ด๋ค!
-> cat ๋ช ๋ น์ด๋ก๋ ์จ๊ฒจ์ง ํ์ผ๋ ์ฝ์ ์ ์๊ตฌ๋.
bandit3@bandit:~/inhere$ cat ...Hiding-From-You
2WmrDFRmJIq3IPxneAaMGhap0pFhF3NJ
Question
ls -a ๊ฒฐ๊ณผ์ ๋ํ๋๋ .๊ณผ ..๋ ๋ญ๊น?
ls -a๋ ์จ๊ฒจ์ง ํ์ผ์ ํฌํจํด ๋๋ ํ ๋ฆฌ ๋ด์ ๋ชจ๋ ํญ๋ชฉ์ ํ์ํ๋ค. ๋ฆฌ๋ ์ค ํ์ผ ์์คํ ์์ .์ ..๋ ๋ชจ๋ ๋๋ ํ ๋ฆฌ์ ๊ธฐ๋ณธ์ ์ผ๋ก ์กด์ฌํ๋ ํน์ ์ํธ๋ฆฌ์ด๋ค. ์ด๋ ํ์ผ์ด๋ ๋๋ ํ ๋ฆฌ๋ ์๋๋ฉฐ, ํ์ผ ์์คํ ์ ๊ตฌ์กฐ๋ฅผ ๋ํ๋ด๊ธฐ ์ํ ๋ฉํ ๋ฐ์ดํฐ์ด๋ค.
-> ์ฐ๋ฆฌ๊ฐ cd. ๋๋ cp ../file.txt ๋ฑ๊ณผ ๊ฐ์ ๋ช ๋ น์ด๋ฅผ ์ฌ์ฉํ ๋ ์ฌ์ฉ๋๋ค.
More
01. ์์ฃผ ์ฌ์ฉํ๋ ls ์ต์
-l | ํ์ผ๋ค์ ๋์ดํ ๊ฒฝ์ฐ ์์ธํ ์ถ๋ ฅํ๋ค |
-a | ๊ฒฝ๋ก ์์ ๋ชจ๋ ํ์ผ์ ๋์ดํ๋ค(์จ๊ธด ํ์ผ๋ ํฌํจ) |
-R | ์์นํ ๋๋ ํ ๋ฆฌ ํ๋ถ ๋๋ ํ ๋ฆฌ์ ํ์ผ๊น์ง ๋ชจ๋ ์ถ๋ ฅํ๋ค |
-h | ํ์ผ์ ํฌ๊ธฐ๋ฅผ ํด์ํ๊ธฐ ํธํ๊ฒ ์ถ๋ ฅํ๋ค |
-r | ์ถ๋ ฅ ๊ฒฐ๊ณผ๋ฅผ ๋ด๋ฆผ์ฐจ์์ผ๋ก ์ ๋ ฌํ๋ค |
-t | ์ถ๋ ฅ ๊ฒฐ๊ณผ๋ฅผ ํ์ผ์ด ์์ ๋ ์๊ฐ์ ๊ธฐ์ค์ผ๋ก ์ ๋ ฌํ๋ค. |
02. Linux ์จ๊ธด ํ์ผ
๋ฆฌ๋ ์ค์์ ์จ๊ฒจ์ง ํ์ผ์ ๋ง๋๋ ๋ฐฉ๋ฒ์, ํ์ผ ์ด๋ฆ ์์ .์ ๋ถ์ด๋ ๊ฒ์ด๋ค.
โโโ(kaliใฟkali)-[~/bandit]
โโ$ touch .hidden_file
โโโ(kaliใฟkali)-[~/bandit]
โโ$ ls
โโโ(kaliใฟkali)-[~/bandit]
โโ$ ls -a
. .. .hidden_file
๋ฐ๋๋ก ์จ๊ฒจ์ง ํ์ผ์ ์จ๊น ํด์ ํ๊ณ ์ถ์ผ๋ฉด ํ์ผ๋ช ์์ .๋ฅผ ์ ๊ฑฐํ๋ฉด ๋๋ค.
โโโ(kaliใฟkali)-[~/bandit]
โโ$ mv .hidden_file hidden_file
โโโ(kaliใฟkali)-[~/bandit]
โโ$ ls
hidden_file
์จ๊ฒจ์ง ํ์ผ์ ์ฝ์ผ๋ ค๋ฉด ์จ๊ฒจ์ง ํ์ผ์ ์ด๋ฆ์ ๊ทธ๋๋ก ์ ๋ ฅํด์ผํ๋ค(.์ ํฌํจํด์ผ ํ๋ค๋ ์๋ฏธ์ด๋ค).
โโโ(kaliใฟkali)-[~/bandit]
โโ$ ls
โโโ(kaliใฟkali)-[~/bandit]
โโ$ ls -a
. .. .hidden_file
โโโ(kaliใฟkali)-[~/bandit]
โโ$ cat hidden_file
cat: hidden_file: No such file or directory
# ์ด๋ ๊ฒ ํ๋ฉด .hidden_file์ ๋ด์ฉ์ ์ฝ์ ์ ์๋ค
โโโ(kaliใฟkali)-[~/bandit]
โโ$ cat .hidden_file
'๐ฆ Private > bandit' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Level 4 -> Level 6 (1) | 2024.12.27 |
---|---|
Level 0 -> Level 2 (0) | 2024.12.26 |
Level 0-SSH (0) | 2024.12.25 |