OverTheWire Bandit Level 8->Level 9 - Walkthrough

Cybersecurity - OverTheWire Bandit Solutions
OverTheWire Bandit Solutions

Introduction

In this post, I will be giving you a walkthrough to the Bandit wargame Level 8->Level 9. We will be using the "sort" and "uniq" commands to clear this level and also see the use of pipe(|).

Goal

Get the password for Level 9 from the file data.txt that is the only line of text that occurs only once.

Login Details

Server - bandit.labs.overthewire.org
Port - 2220
Username - bandit8
Password - TESKZC0XvTetK0S9xNwm25STk5iWrBvP

Theory

"sort" command in Linux is used to sort the the file contents in a particular order. There are multiple options that can be used as required. Please go through this article to know more about the sort command.
"uniq" command in linux is used to filter out the repeated lines in a file. It detects the adjacent duplicate lines and deletes them. Therefore, it is important that the input file is sorted. We will be using the below option of the uniq command-:

  • -u -: outputs the lines that are unique in the input.
For more information on the uniq command, please read this article.
To pass the sorted file to uniq command, we will be using pipe(|). Pipe(|) is used in linux to connect the output of one command directly into the input of another. Please go through this article to know more about the pipe(|) command.

Solution

SSH into the user bandit8 using the command "ssh bandit8@bandit.labs.overthewire.org -p 2220" and the above password. Type ls to see the file "data.txt" present in the home directory of the user.


Now type the command "sort data.txt | uniq -u" to get the password.


This completes the Level 8 walkthrough as we have got the password. Please post your doubts and suggestions in the comment section.


Comments

Popular Posts