DEV Community

Cover image for Bandit Level 9 Level 10
Christian Paez
Christian Paez

Posted on

2

Bandit Level 9 Level 10

Introduction

Bandit10 is the eleventh level in the OverTheWire Bandit wargame. In this level, we are given a file named "data.txt" and we are required to find a string of text that occurs only once in the file and contains only letters and spaces.

Steps

  1. Open your terminal application.
  2. Enter the following command to ssh into the remote server using the credentials for Bandit9:

    ssh bandit9@bandit.labs.overthewire.org -p 2220
    
  3. Enter the password for Bandit9 EN632PlfYiZbn3PhVK3XOGSlNInNE00t when prompted.

  4. Once you are logged in, enter the following command to read the contents of the "data.txt" file:

    cat data.txt
    
  5. You will see that the file contains a lot of random text.

  6. Next, enter the following command to extract all the printable strings from the file:

    cat data.txt | strings
    
  7. You will see that the output includes some text surrounded by multiple equal signs.

  8. To filter out only the strings that contain letters and spaces and are surrounded by equal signs, enter the following command:

    cat data.txt | strings | grep '^=\\{2,\\}' | awk -F " " '{print $2}' | tr '\\n' ' ' | xargs echo
    

Let's break down this command:

  • cat data.txt: display the contents of the file data.txt.
  • strings: extract human-readable strings from the binary file data.txt.
  • grep '^=\{2,\}': search for lines that start with two or more equal signs (==).
  • awk -F " " '{print $2}': print the second field of each matching line, which is the password.
  • tr '\n' ' ': replace the newline character with a space character.
  • xargs echo: pass the output of the previous command to echo.

After running the command, the password for the next level G7w8LIi6J3kTb8A7j9LgrywtEUlyyp6s will be displayed.

Congratulations! You have successfully completed Bandit10 and found the flag.

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

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

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay