OverTheWire : Bandit Level 3 → Level 4

heuniy·2023년 9월 24일

bandit_write up

목록 보기
5/10

문제

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

Bandit Level 3 → Level 4
Level Goal
The password for the next level is stored in a hidden file in the inhere directory.

inhere 디렉토리의 hidden 파일에 password 가 저장되어 있다.


풀이

현재 작업중인 디렉토리 확인을 위해 pwd 명령어를 사용한다.

bandit3@bandit:~$ pwd
/home/bandit3

home 디렉토리에 있는 것을 확인할 수 있다.



목록 확인을 위해 ls 명령어를 사용한다.

bandit3@bandit:~$ ls
inhere

inhere 디렉토리가 있다.


문제를 풀기 위해 inhere 디렉토리로 이동해야 하므로 cd 명령어를 사용한다.

그리고 목록을 확인하기 위해 ls 명령어도 입력한다.

bandit3@bandit:~$ cd inhere
bandit3@bandit:~/inhere$ ls

하지만 아무것도 나오지 않는다.


숨겨진 파일이나 디렉토리 확인을 위해 -a 옵션을 붙여서 ls -a 명령어를 사용한다.

-a : all 의 줄임말로 모든 파일(숨겨진 파일 혹은 디렉토리)을 출력한다.

bandit3@bandit:~/inhere$ ls -a
. .. .hidden

여기서 hidden 파일을 발견할 수 있는데 파일명 앞의 . 은 숨김처리 되었다는 것을 알려준다.



파일 내용을 출력하기 위해 cat 명령어를 사용한다.

bandit3@bandit:~/inhere$ cat .hidden
2EW7BBsr6aMMoJ2HjW067dm8EgX26xNe

password2EW7BBsr6aMMoJ2HjW067dm8EgX26xNe 이다.


기타

리눅스 명령어 정리 (누적)

pwd : 현재 작업중인 디렉토리 정보(경로) 출력

ls : 디렉토리 목록 확인

  • ls -a : 모든 파일(숨겨진 파일 혹은 디렉토리)을 출력

cat [파일명] : [파일명] 내용 출력

  • cat ./[파일명] : 현재 디렉토리에 있는 [파일명] 내용을 출력
  • cat '[파 일 명]' : space가 있는 [파일명] 내용 출력
  • cat [파\ 일\ 명] : space가 있는 [파일명] 내용 출력
profile
고양이 귀여워

0개의 댓글