상세 컨텐츠

본문 제목

Bandit Level 2 -> Level 3

ENG/Bandit

by jaws99 2024. 8. 7. 16:56

본문

반응형

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

  • `find` is a program that searches for files and directories within a specified directory hierarchy based on various criteria such as name, type, size, etc.

 

Write up

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

 

It doesn't work like a before challenge. It treats 'spaces', 'in', 'this', 'filename' as different filenames.

There are a few ways to deal with this problem. 

 

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

 

First, we can enclose a file name with a single or double quotes to indicate that all names belong to one file name.

 

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

 

Second, we can also represent the spaces with a backslash (\).

 

bandit2@bandit:~$ find . -name "spaces in this filename" -exec cat {} \;
MNk8KNH3Usiio41PRUEoDFPqfxLPlSmx

 

Finally, we can utilize the 'find' command and the exec option to display the file.

 

 

Next Level : Level 3 -> 4

반응형

'ENG > Bandit' 카테고리의 다른 글

Bandit Level 4 -> Level 5  (0) 2024.08.12
Bandit Level 3 -> Level 4  (0) 2024.08.10
Bandit Level 1 -> Level 2  (0) 2024.08.05
Bandit Level 0 -> Level 1  (0) 2024.08.04
Bandit Level 0  (0) 2024.08.02

관련글 더보기