304 字
2 分鐘
[OverTheWire] Bandit Level 29 → Level 30

Level Goal#

There is a git repository at ssh://bandit29-git@localhost/home/bandit29-git/repo via the port 2220. 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.

Commands you may need to solve this level#

  • git

My Answer (Step by step)#

  1. 連線到伺服器並登入
Terminal window
ssh bandit29@bandit.labs.overthewire.org -p 2220
  1. 透過 mktemp 指令產生暫存資料夾,並透過 cd 指令進入它,以便稍後 clone git repo
Terminal window
mktemp -d
cd /tmp/tmp.donk1bH1gq
  1. 透過 git 指令將 repo clone 下來
Terminal window
git clone ssh://bandit29-git@localhost:2220/home/bandit29-git/repo
  1. 透過 cd 指令進入 repo 資料夾,並透過 ls 指令查看資料夾內容
Terminal window
cd repo
ls
# README.md
  1. 透過 cat 指令讀取 README.md 檔案,發現沒有密碼 :(
Terminal window
cat README.md
# # Bandit Notes
# Some notes for bandit30 of bandit.
# ## credentials
# - username: bandit30
# - password: <no passwords in production!>

{{< alert info >}} 根據指令結果說明,當前分支可能為生產分支(production branch),密碼可能藏在開發分支(development branch)中 {{< /alert >}}

  1. 透過 git branch 指令查看該 repo 有哪些分支
remotes/origin/dev
git branch -a
# * master
# remotes/origin/HEAD -> origin/master
# remotes/origin/master
# remotes/origin/sploits-dev
  1. 透過 git checkout 指令切換分支至 remotes/origin/dev,並重新透過 cat 指令讀取 README.md 檔案,發現 Level 30 密碼!
Terminal window
git checkout remotes/origin/dev
cat README.md
# # Bandit Notes
# Some notes for bandit30 of bandit.
# ## credentials
# - username: bandit30
# - password: qp30ex3VLz5MDG1n91YowTv4Q8l7CDZL

第 30 篇,共 34 篇本文屬於系列

[OverTheWire] Bandit Level 29 → Level 30
https://m21248074.github.io/blog/posts/2025-01-24-post162929/
作者
Cavey (凱維)
發佈於
2025-01-24
許可協議
CC BY-NC-SA 4.0

分享文章

生成精美分享圖或複製連結,與更多人分享本文。

繼續閱讀

沿著主題讀

基於共同的標籤與分類

換條路線

從其他文章中穩定抽取

最後更新於 ,距今已過 631 天

部分內容可能已過時