Recap of Level 8: Used grep to search for our password from a large text file.

 

Bandit Level 9

Objective:

Find the password to the next level

Intel Given:

  • The password is located in data.txt
  • The password is the only line that occurs once

How to:

Reading the file shows us that data.txt is a large list of many passwords. According to our intel we know that all of the passwords except for one repeat and so we need to focus on finding the unique password.

To do this we need to use the command uniq which reports or omits repeated lines dependent on which switch you use. When we looked at the contents of the data.txt file we saw that the passwords were scrambled so we need to figure out a way to reorganize the contents of the file.

To do this we use the sort command. Using sort on our given file will give us the result below.

Screen Shot 2015-01-14 at 9.52.35 AM

Now that we have our file formatted correctly we can inject the result of the sort command into our uniq command. By reading the uniq man page we find that the -u switch will print only unique lines to standard out. Putting it all together we get the result below.

Screen Shot 2015-01-14 at 10.10.41 AM

Conclusion:

We’re now beginning to combine commands. As you can see redirection of Input and Output (I/O) is becoming more important. If you need a quick refresher on I/O please go back to the Bandit 6 tutorial to review. Understanding that you’re not combining the commands per say, but instead the OUTPUTS of the commands is a crucial thought process when using the pipe.

Previous Level
Next Level
You were not leaving your cart just like that, right?

You were not leaving your cart just like that, right?

Enter your details below to save your shopping cart for later. And, who knows, maybe we will even send you a sweet discount code :)