Level 4 → 5

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.

Write-Up

  1. Navigate to the inhere directory:

ls
cd inhere
ls & cd inhere
  1. Identify the human-readable file:

for i in $(ls); do file -i "./$i"; done;
for i in $(ls); do file -i "./$i"; done;

This reveals ./-file07 as the only text/plain file.

  • for i in $(ls): Loops through each file in the current directory

  • do: Starts the loop body

  • file -i: Runs the file command to each file, using ./ to handle filenames starting with -

  • done: Ends the loop

  • Overall: Identifies the file type of every file in the directory.

  1. Display the content of the identified file:

cat ./-file07
cat ./-file07

The retrieved password: 4oQYVPkxZOOEOO5pTW81FB8j8lxXGUQw

  1. Access the next level:

ssh [email protected] -p 2220

Enter the password when prompted.

Lessons Learned

  • Scripting with loops can efficiently process multiple files

  • The file command helps identify file types regardless of extension

  • Using ./ is crucial when dealing with files that start with -

-- Othmane

Last updated

Was this helpful?