반응형

 

https://overthewire.org/wargames/bandit/bandit3.html

 

OverTheWire: Level Goal

We're hackers, and we are good-looking. We are the 1%. <!-- Please read and accept the Rules! --> Level Goal The password for the next level is stored in a file called spaces in this filename located in the home directory Commands you may need to solve thi

overthewire.org


Bandit Level 2 → Level 3


Level Goal
The password for the next level is stored in a file called spaces in this filename located in the home directory

Commands you may need to solve this level
ls , cd , cat , file , du , find

Helpful Reading Material
Google Search for “spaces in filename”

 

문제 해석

home directory 안에 spaces in this filename라는 파일에 패스워드가 있다.

 


일단 pwd, ls 명령어로 home directory의 spaces in this file name이라는 파일 존재를 확인하자.

bandit2@bandit:~$ pwd
/home/bandit2
bandit2@bandit:~$ ls
spaces in this filename

자, 그럼 여태껏 그래왔듯이 cat 명령어를 사용하여 파일을 출력하자

 

 

bandit2@bandit:~$ cat spaces in this filename
cat: spaces: 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

파일에 공백이 있으면, 명령어에 파일명을 입력할 때 파일명이 명령어의 전달 인자로서 인식할 수 있다.

그래서 왠만하면 공백을 피하는 게 좋은데, 공백이 씌여진 파일은 큰 따옴표나 tab으로서 읽을 수 있다.

 

bandit2@bandit:~$ cat spaces\ in\ this\ filename
MNk8KNH3Usiio41PRUEoDFPqfxLPlSmx

tab을 누른 경우
bandit2@bandit:~$ cat "spaces in this filename"
MNk8KNH3Usiio41PRUEoDFPqfxLPlSmx

큰 따옴표를 사용하여 출력한 경우

 


정리

1. 큰 따옴표나 tab을 사용하여 공백이 있는 파일을 출력하자

반응형

'네트워크 공부 > bandit' 카테고리의 다른 글

[Bandit] Level 4 -> Level 5  (0) 2024.07.19
[Bandit] Level 3 -> Level 4  (0) 2024.07.18
[Bandit] Level 1 -> Level 2  (0) 2024.07.18
[Bandit] Level 0 -> Level 1  (0) 2024.07.18
[Bandit] Bandit Level 0 putty로 시작하기  (0) 2024.07.18

+ Recent posts