DEV Community

Krishna
Krishna

Posted on

4

OverTheWire Bandit Level 5 Level 6 walk-through

Challenge page => https://overthewire.org/wargames/bandit/bandit6.html

This time the password is in a file which has a certain set of attributes. What makes this challenge unique is that the number of files you will have to sift through is huge.

Lets take a look at the contents of the inhere dir and one of its subdirs.

Contents of inhere dir

So, clearly we have our work cut out for us. Going through each one of the files will take a huge amount of time.


So how do we find the file which has the three attributes listed?

  • human-readable
  • 1033 bytes in size
  • not executable

Hint 1: Once again, look at the man pages of the commands "you may need"


The hint was in the question itself :D

The find command comes in handy when searching for files with certain attributes. But we have to be careful with how we use it as it can search through the entire file system if needed.

Don't hesitate to fire up a few searches for the find command and see a few examples. Also, do gloss over the man page, as the flags will come in handy in the future as well.

Now that we've zeroed in on the find command, we need to ensure

  • The search completes fast
  • The search doesn't go through the entire filesystem, but just through the inhere dir
  • It only outputs the name of the file that has the aforementioned attributes

Which are the flags of the find command that will help us narrow down the file that contains the password?

Hint 2: You don't need to ask Google or the Duck for this. Searching the man pages will suffice.


The man pages are quite handy aren't they? They are a bit verbose though. Then again that is how good documentation is supposed to be :)

So, we've figured out the flags required

  • -readable for human-readable files
  • -size 1033c for 1033 bytes
  • -executable to ensure the find command filters for executable files

But wait, we need "non-executable" files.


How do we negate the flag?

Hint 3: Usually man pages have a few examples also listed. Maybe our answer is there?


Jackpot! There is one example where the -readable file is negated.

Flag negation example

Now we have everything we need. Assuming you are running the command from your home dir, the final command would be

find ./inhere -readable -size 1033c \! -executable

Let's try it.

Solution

That was a pretty fast search. Onto the next challenge!

Image of AssemblyAI tool

Transforming Interviews into Publishable Stories with AssemblyAI

Insightview is a modern web application that streamlines the interview workflow for journalists. By leveraging AssemblyAI's LeMUR and Universal-2 technology, it transforms raw interview recordings into structured, actionable content, dramatically reducing the time from recording to publication.

Key Features:
🎥 Audio/video file upload with real-time preview
🗣 Advanced transcription with speaker identification
⭐ Automatic highlight extraction of key moments
✍ AI-powered article draft generation
📀 Export interview's subtitles in VTT format

Read full post

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay