PS C:\Users\USER> ssh bandit9@bandit.labs.overthewire.org -p2220
...
bandit9@bandit.labs.overthewire.org's password:
...
bandit9@bandit:~$
The password for the next level is stored in the file data.txt in one of the few human-readable strings, preceded by several ‘=’ characters.
bandit9@bandit:~$ ls -al
total 40
drwxr-xr-x 2 root root 4096 Aug 15 13:15 .
drwxr-xr-x 150 root root 4096 Aug 15 13:18 ..
-rw-r--r-- 1 root root 220 Mar 31 2024 .bash_logout
-rw-r--r-- 1 root root 3851 Aug 15 13:09 .bashrc
-rw-r----- 1 bandit10 bandit9 19379 Aug 15 13:15 data.txt
-rw-r--r-- 1 root root 807 Mar 31 2024 .profile
bandit9@bandit:~$ cat data.txt
위 cat data.txt의 결과로는 읽을 수 없는 데이터가 화면 가득 출력된다.
문제 조건에 따라 다음의 과정을 거쳐 해결해보자.
1. 사람이 읽을 수 있는(human-readable) 문자 외 소거
strings 명령어는 파일에서 사람이 읽을 수 있는 ASCII 문자열만 출력하는 명령어이다.
2. '=='로 시작하는 문자열만 출력
조건에서 preceded by several '=' characters 라고 했으므로 두 개의 '=' 뒤에 오는 문자열을 찾아본다.
출력결과 중 마지막 줄에 우리가 자주 보던 password의 형식을 갖춘 문자열이 보인다.
bandit9@bandit:~$ strings data.txt | grep '=='
========== the
========== password
Q========== is%
>u`9J========== FGUW5ilLVJrxX9kMYMmlN4MgbpfMiqey'Bandit' 카테고리의 다른 글
| Bandit: Level 11 (0) | 2025.09.03 |
|---|---|
| Bandit: Level 10 (0) | 2025.09.03 |
| Bandit: Level 8 (2) | 2025.08.09 |
| Bandit: Level 7 (1) | 2025.08.09 |
| Bandit: Level 6 (0) | 2025.07.31 |