암호(수학) 등.. 공부한 거 잊을거 같아서 만든 블로그

OverTheWire Bandit Level 2 → Level 3 풀이 본문

OverTheWire: Bandit

OverTheWire Bandit Level 2 → Level 3 풀이

h34hg0 2022. 4. 7. 22:06

문제


OverTheWire: Level Goal: Bandit Level 2 → Level 3

다음 수준의 암호는 홈 디렉터리에 있는 이 파일 이름의 공백이라는 파일에 저장됩니다.


풀이


ls

ls를 입력하여 현재 디렉터리의 4개의 파일이 있는 것을 볼 수 있는데

 

cat spaces in this filename

cat spaces in this filname를 입력하면 spaces, in, this, filename 라는 파일이 없다는 메시지가 출력된다.

 

ls -l

ls명령어에 -l 옵션을 사용하여 입력해보면 파일의 이름에 공백이 들어가 4개인것 처럼 보였던 것이지 사실은 파일 한 개의 이름이라는 것을 알 수 있다.

 

cat spaces\ in\ this\ filename
cat "spaces in this filename"

따라서 파일의 이름을 지정하려면 '\ '문자를 사용하여 공백을 표현하거나 ""로 묶어서 하나의 파일을 가리킨다는 것을 알려주어야 한다.

cat spaces\ in\ this\ filename 또는 cat "spaces in this filename" 를 입력하여 암호인 UmHadQclWmgdLOKQ3YNgjWxGoRMb5luK 가 출력되는 것을 볼 수 있다.