Find the password to the next level
- The password is located in data.txt
- The password is the only line that occurs once
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.
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.
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.