Bandit Level 31 → Level 32
문제
https://overthewire.org/wargames/bandit/bandit32.html
목표
다음 레벨의 패스워드를 찾는다.
ssh://bandit31-git@localhost/home/bandit31-git/repo
2220번 포트에 git 저장소가 있다.bandit31-git
의 비밀번호는bandit31
의 비밀번호와 동일하다.
풀이
권한이 없으니 새 디렉토리로 이동한다.
1
2
bandit31@bandit:~$ mkdir /tmp/new_dir
bandit31@bandit:~$ cd /tmp/new_dir
git clone
명령어로 git 저장소를 복제한다.
1
bandit31@bandit:/tmp/new_dir$ git clone ssh://bandit31-git@localhost:2220/home/bandit31-git/repo
README.md
파일을 확인해보니 원격 저장소에 파일을 푸쉬하라고 한다.
1
2
3
4
5
6
7
8
9
10
11
12
bandit31@bandit:/tmp/new_dir$ ls
repo
bandit31@bandit:/tmp/new_dir$ cd repo
bandit31@bandit:/tmp/new_dir/repo$ ls
README.md
bandit31@bandit:/tmp/new_dir/repo$ cat README.md
This time your task is to push a file to the remote repository.
Details:
File name: key.txt
Content: 'May I come in?'
Branch: master
조건에 맞는 파일을 만든다.
1
bandit31@bandit:/tmp/new_dir/repo$ echo 'May I come in?' > key.txt
git add
명령어로 파일을 스테이징 영역에 추가하고 git commit
명령어로 커밋을 해준다.
1
2
bandit31@bandit:/tmp/new_dir/repo$ git add key.txt -f
bandit31@bandit:/tmp/new_dir/repo$ git commit -m 'key'
그리고 git push
명령어로 푸쉬해주면 패스워드를 알 수 있다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
bandit31@bandit:/tmp/new_dir/repo$ git push
.
.
.
remote: ### Attempting to validate files... ####
remote:
remote: .oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.
remote:
remote: Well done! Here is the password for the next level:
remote: rmCBvG56y58BXzv98yZGdO7ATVL5dW8y
remote:
remote: .oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.
remote:
To ssh://localhost:2220/home/bandit31-git/repo
Password : rmCBvG56y58BXzv98yZGdO7ATVL5dW8y
배운 것
git add
명령어로 파일을 스테이징 영역에 추가할 수 있다.git commit
명령어로 파일을 커밋할 수 있다.git push
명령어로 파일을 푸쉬할 수 있다.
This post is licensed under CC BY 4.0 by the author.