상세 컨텐츠

본문 제목

Bandit Level 3 -> Level 4

ENG/Bandit

by jaws99 2024. 8. 10. 16:07

본문

반응형

Level Goal

The password for the next level is stored in a hidden file in the inhere directory.

Commands you may need to solve this level

ls , cd , cat , file , du , find

  • `cd` stands for change directory. It allows users to navigate the filesystem by changing the current working directory

 

Write up

bandit3@bandit:~$ ls
inhere
bandit3@bandit:~$ cat inhere
cat: inhere: Is a directory

 

We already know the commands `ls` and `cat`. However, this time, `inhere` is not a file; it's a directory, so we can't use the `cat` command. Therefore, we are going to move inside the `inhere` directory.. 

 

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

 

Using the `cd` command, we can move to another directory. However, even if we use the `ls` command, we won't find any files because it's a hidden file. Let's check the options of the `ls` command.

 

bandit3@bandit:~/inhere$ man ls


LS(1)                                               User Commands                                               LS(1)

NAME
       ls - list directory contents

SYNOPSIS
       ls [OPTION]... [FILE]...

DESCRIPTION
       List  information  about the FILEs (the current directory by default).  Sort entries alphabetically if none of
       -cftuvSUX nor --sort is specified.

       Mandatory arguments to long options are mandatory for short options too.

       -a, --all
              do not ignore entries starting with .

 

We can check the options using the `man` command. There, if we want to include entries starting with `.`, we can use the `-a` option.

 

bandit3@bandit:~/inhere$ ls -a
.  ..  ...Hiding-From-You
bandit3@bandit:~/inhere$ cat ...Hiding-From-You
2WmrDFRmJIq3IPxneAaMGhap0pFhF3NJ

 

Finally, we can find the hidden file! On Wikipedia, they explain hidden files as follows:

 

In Unix-like operating systems, any file or folder that starts with a dot character, commonly called a dot file or dotfile, is to be treated as hidden – that is, the ls command does not display them unless the -a or -A flags (ls -a or ls -A) are used.

 

Ref) https://en.wikipedia.org/wiki/Hidden_file_and_hidden_directory

 

 

Next Level : Level 4 -> 5

반응형

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

Bandit Level 5 -> Level 6  (0) 2024.08.16
Bandit Level 4 -> Level 5  (0) 2024.08.12
Bandit Level 2 -> Level 3  (0) 2024.08.07
Bandit Level 1 -> Level 2  (0) 2024.08.05
Bandit Level 0 -> Level 1  (0) 2024.08.04

관련글 더보기