OverTheWire.org Walkthrough: Bandit

~ Level 29→30 ~

Level Description

There is a git repository at ssh://bandit29-git@localhost/home/bandit29-git/repo. The password for the user bandit29-git is the same as for the user bandit29.

Clone the repository and find the password for the next level.

git is the only recommended command again.


Research Before Solving

We will research during the walkthrough depending upon what we need to do.


Solution Walkthrough

Upon logging in as user bandit29, create a directory named /tmp/user and navigate into it using cd. Next, we need to clone the repository with the following command: git clone ssh://bandit29-git@localhost/home/bandit29-git/repo Type yes to confirm and enter the password when prompted.

We will now move into the cloned repository and then list any files within it.

README.md file in repo directory

We're shown a file named README.md again. Using cat on it reveals the following:

contents of readme.md

Being shown is a commit of a file. We can use git log to show recent commit activity. Next, we may use git diff on the two commits to see what differences we may see. The output shows nothing of consequence, the username was simply swapped from bandit29 to bandit30.

Parsing through the man pages we learn that there may be branches besides the current one we are in. Typing in git branch --help pulls up the relevant documentation. We are able to list all branches with the command git branch -a.

branches besides the master branch we are in

We've found there are multiple sub-branches available. We now need to find a command that allows us to switch branches. It is found that git checkout branchname is the command needed to accomplish this.

The first branch of remotes/origin/HEAD is the current branch we are in. Let's swap to the second branch, to do so use git checkout remotes/origin/dev

Upon pressing enter, the following output appears:

confirmation of changes branch

It is shown that we have now changed branches, our HEAD or current branch, is now the /dev branch. Issue an ls to see the contents of this branch. README.md should be found again, cat the file to see its contents:

password to bandit30

We've located the password for bandit30! Make sure to delete the /tmp/user directory and all of its contents before moving on to the next level.

5b90576bedb2cc04c86a9e924ce42faf