Post

Bandit4 -> Bandit5 - Over The Wire

Bandit4 -> Bandit5 - Over The Wire

Overview

Level Goal

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

Commands you may need to solve this level

ls , cd , cat , file , du , find

Step by Step Solution

SSH into Bandit4

assets/img/OTW/bandit4-bandit5-otw

1
ssh bandit4@bandit.labs.overthewire.org -p 2220 # 2WmrDFRmJIq3IPxneAaMGhap0pFhF3NJ

Find Flag

1
2
3
ls 
cd inhere
file ./-file*

  • using file command display the type of file
  • using a wildcard * uses that pattern, display all files the filename starts with -file
  • -file07 is show it is a ASCII plain text file
1
cat ./-file07

Contents of a data file

One-liner

  • using the find command
1
find . -type f -exec file {} + | grep ASCII | cut -d: -f1 | xargs cat

What it does (quickly):

  • find . -type f → list all files

  • file → detect file types

  • grep ASCII → keep only ASCII text files

  • cut -d: -f1 → extract the filename

  • xargs cat → print the contents (the flag)

Answer

4oQYVPkxZOOEOO5pTW81FB8j8lxXGUQw

Next Level

This post is licensed under CC BY 4.0 by the author.