
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.
다음 레벨의 패스워드는 data.txt 파일에 저장되어 있으며 몇 개의 = 문자로 시작되고 읽을 수 있는 몇 안 되는 문자 중 하나다.
grep, sort, uniq, strings, base64, tr, tar, gzip, bzip2, xxd
bandit9@bandit:~$ ls -al
total 40
drwxr-xr-x 2 root root 4096 Oct 5 2023 .
drwxr-xr-x 70 root root 4096 Oct 5 2023 ..
-rw-r--r-- 1 root root 220 Jan 6 2022 .bash_logout
-rw-r--r-- 1 root root 3771 Jan 6 2022 .bashrc
-rw-r----- 1 bandit10 bandit9 19379 Oct 5 2023 data.txt
-rw-r--r-- 1 root root 807 Jan 6 2022 .profile
bandit9@bandit:~$ file data.txt
data.txt: data
data.txt 파일은 data 형식의 파일이다. 플래그는 몇 개의 = 문자로 시작된다고 명시되어 있으므로 해당 파일에서 조건을 만족하는 부분을 추출할 수 있다.
만약 다음과 같이 cat 커맨드를 사용하면,
bandit9@bandit:~$ cat data.txt | grep "="
grep: (standard input): binary file matches
data.txt 파일은 data 형식의 파일이기 때문에 stdin으로 받을 수 없으므로 strings 커맨드를 사용해 해당 파일에서 ASCII에 해당하는 부분만 추출해 입력값으로 넘긴다.
bandit9@bandit:~$ strings data.txt | grep "="