Bandit Level 7 → Level 8
Hello everyone!
If you want to try it yourself before seeing the solution, here you have the URL:
https://overthewire.org/wargames/bandit/
When we start we are presented with the following statement:
The password for the next level is stored in the file data.txt next to the word millionth
To enter the level, one must do the command:
$ ssh -p 2220 -l bandit7 bandit.labs.overthewire.org
With the password, which is the flag from the previous level.
And we are in!
Once inside lets see the home (~) folder's content with the command:
~$ ls
And the file data.txt appeared.
In order to see the file's content we could do the cat command:
~$ cat data.txt
The output was a massive amount of characters. In order to find the "millionth" word to get the flag we will use the vim text editor, which is a great editor for the terminal. The way we are going to do that is by typing the following:
~$ vim data.txt
Now we are inside the file on the vim editor.
As you can see we have a word followed by what appears to be a flag, now our job is simple, find the millionth word. For doing so lets search for it using the vim search command by typing:
1º ESC -> This is to make sure that you aren't in another menu, like i. If you are, just by clicking ESCAPE you'll go to the vim command line.
2º / -> This command is the search command, anything you write after the / will be searched in the file
Therefore the goal is to type:
/millionth
And click enter, and then we'll see the word followed by the flag, in the image bellow I high light the word and hidde the flag:
~$ ls
And the file data.txt appeared.
In order to see the file's content we could do the cat command:
~$ cat data.txt
The output was a massive amount of characters. In order to find the "millionth" word to get the flag we will use the vim text editor, which is a great editor for the terminal. The way we are going to do that is by typing the following:
~$ vim data.txt
Now we are inside the file on the vim editor.
As you can see we have a word followed by what appears to be a flag, now our job is simple, find the millionth word. For doing so lets search for it using the vim search command by typing:
1º ESC -> This is to make sure that you aren't in another menu, like i. If you are, just by clicking ESCAPE you'll go to the vim command line.
2º / -> This command is the search command, anything you write after the / will be searched in the file
Therefore the goal is to type:
/millionth
And click enter, and then we'll see the word followed by the flag, in the image bellow I high light the word and hidde the flag:
Another way, to find the flag would be to just type:
~$ grep millionth data.txt
What this command does is to find the line with the word millionth on the file data.txt and print it on the command line.
And the output is the line with the flag.
And if you wanna see the flag:
See you soon, thank you!
Cheers
Marcelo Silva

Comments
Post a Comment