상세 컨텐츠

본문 제목

Bandit Level 4 -> Level 5

ENG/Bandit

by jaws99 2024. 8. 12. 08:04

본문

반응형

Level Goal

The password for the next level is stored in the only human-readable file in the inhere directory. Tip: if your terminal is messed up, try the “reset” command.

Commands you may need to solve this level

ls , cd , cat , file , du , find

  • `file` is used to determine the type of a file. It does this by checking the file's content and metadata.

 

Write up

bandit4@bandit:~$ ls
inhere
bandit4@bandit:~$ cd inhere/
bandit4@bandit:~/inhere$ ls
-file00  -file01  -file02  -file03  -file04  -file05  -file06  -file07  -file08  -file09

 

The start is the almost same as the previous one. In the `inhere` directory, we need to find the only human-readable file. 

 

bandit4@bandit:~/inhere$ cat -file00
cat: invalid option -- 'f'
Try 'cat --help' for more information.

 

Using the `cat` command, we can display the content of the file. However, it's not working correctly this time because it interpreted `-` as an option command instead of a file name.

 

bandit4@bandit:~/inhere$ cat -- -file00
,YqfLj0x4Fbandit4@bandit:~/inhere$ cat -- -file01
N.bandit4@bandit:~/inhere$ cat -- -file02
9Fptk%bandit4@bandit:~/inhere$

 

 

In Unix-like systems, the `--` is used as a special argument that signifies the end of command options.

By using `--` we can read the file, but we have to check it 10 times. It's time consuming :(

 

bandit4@bandit:~/inhere$ file -- -file0*
-file00: data
-file01: data
-file02: data
-file03: data
-file04: data
-file05: data
-file06: data
-file07: ASCII text
-file08: data
-file09: data

 

Using `file` command, we can check the type of files.

"ASCII text' means the file contains plain text using the ASCII character set.

"data" means that the file's content doesn't match any recognizable pattern or structure that file can classify into a more specific type, such as text, image, or executable.

 

bandit4@bandit:~/inhere$ cat -- -file07
4oQYVPkxZOOEOO5pTW81FB8j8lxXGUQw

 

Finally, we can find the password!

 

 

Next Level : Level 5 -> 6

반응형

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

Bandit Level 6 -> Level 7  (0) 2024.09.06
Bandit Level 5 -> Level 6  (0) 2024.08.16
Bandit Level 3 -> Level 4  (0) 2024.08.10
Bandit Level 2 -> Level 3  (0) 2024.08.07
Bandit Level 1 -> Level 2  (0) 2024.08.05

관련글 더보기