Bandit is a game for beginners in Linux and Bash. As it is a great guide for learning the command line and Linux. So we will continue with the game here is the link for the next level.
- Host: bandit.labs.overthewire.org
- port: 2220
bandit level 30 → 31
As we are instructed we have to get a git repository and find the password in it. First, we will make a temporary directory in /tmp folder then we will use “git clone” to download the repository in our temporary folder. Then we will enter the password of the git repository the same as the password of the bandit 30 user.
- mkdir /tmp/git-30
- cd /tmp/git-30
- git clone ssh://[email protected]/home/bandit30-git/repo
After that, we use different commands to get more information about the repository. Firstly, we use git log to see the logs for all the commits that have been made. Secondly, we use the git branch to see all the branches of the git repository. Lastly, we use git tag, Git has the ability to tag specific points in a repository’s history as being important. After that, we use the git show command to get the secret tag.
- git tag
- git show secret
bandit level 31 → 32
As we are instructed we have to get a git repository and find the password in it. First, we will make a temporary directory in /tmp folder then we will use “git clone” to download the repository in our temporary folder. Then we will enter the password of the git repository the same as the password of the bandit 31 user.
- mkdir /tmp/git-31
- cd /tmp/git-31
- git clone ssh://[email protected]/home/bandit31-git/repo
After downloading the git repository we get the contents of README.md. As we see it tells us to create a file, then add some content to it and push it to the master branch. Therefore we use echo command for the contents of the file and use the stdout “>” operator to store it to the file. After that we use git add command to add the file to the staging area. But we see a warning that this file is ignored by git repository. All the information related to ignored files is stored in the .gitignore file.
- cd repo
- cat README.md
- echo “May I come in?” > key.txt
- git add key.txt
So to add the ignored file first we remove .gitignore file. Then add key.txt using git add command. After that we use git commit command to commit the change. In the end we use git push origin master to push the changes of local master branch to remote master branch.
- rm .gitignore
- git add key.txt
- git commit -m”Adding key.txt”
- git push origin master
After following all the step we get password in the end.
bandit level 32 → 33
As we login to bandit32 we see a message welcome to the uppercase shell. The message on the site was one last escape so we use $0 to get the shell. Then we verify it by using command pwd. After that we ls -l command to see the information of files along with its ownership and permission. After that we see file uppershell has ownership by bandit33. In other words we can access password of /etc/bandit_pass/bandit33. So we use cat command to get the password.
- ls -l
- cat /etc/bandit_pass/bandit33
bandit level 33
This is the final level of bandit overthewire wargames. As we use cat command to read the content of README.txt. In conclusion its a fun game and in the end message from team of bandit wargames. The game finished here. Hope to see you all for other articles and walkthroughs.
- cat README.md