1. Bandit9 목표
The password for the next level is stored in the file data.txt in one of the few human-readable strings, preceded by several ‘=’ characters.
Commands you may need to solve this level
grep, sort, uniq, strings, base64, tr, tar, gzip, bzip2, xxd
2. Bandit9 구현
# 문제의 파일이 크기 때문에 해당 파일을 첨부하였다.
# Bandit의 경우 관리자가 주기적으로 비밀번호를 변경하고 있다.
# 하여 해당 파일을 다운로드 하는 방법만 설명하고 첨부된 파일 링크를 통해 구현을 진행하면 된다.
# 비밀번호 4CKMh1JI91bUIZZPXDqGanal4xvAg0JM 입력 접속(비밀번호 변경 될 수 있음)
# ssh -oStrictHostKeyChecking=no bandit9@bandit.labs.overthewire.org -p 2220
# pwd
# ls -la data.txt
# exit
# scp -P 2220 bandit9@bandit.labs.overthewire.org:/home/bandit9/data.txt ./data.txt
# 위 명령을 통해 다운로드 받은 파일을 첨부 하였다.
# 비밀번호 root 입력 접속
ssh -oStrictHostKeyChecking=no root@localhost -p 2220
chown -R root:root /home/bandit9/.[!.]*
curl -L "https://blog.kakaocdn.net/dn/bu9qcE/btsHVKgjSRK/Pw2ARpEahWbQ7nLTH9po9k/data.txt?attach=1&knm=tfile.txt" -o /home/bandit9/data.txt
chmod 640 /home/bandit9/data.txt
useradd bandit10 && echo -e "FGUW5ilLVJrxX9kMYMmlN4MgbpfMiqey\nFGUW5ilLVJrxX9kMYMmlN4MgbpfMiqey" | passwd bandit10
chown bandit10:bandit9 /home/bandit9/data.txt
chmod 755 /home/bandit10
chown root:root /home/bandit10
3. Bandit9 문제풀의
# bandit9 로 설정한 패스워드를 입력하여 접속한다.
# UsvVyFSfZZWbi6wgC7dAFyFuR6jQQUhR
ssh bandit9@localhost -p 2220
ls -la
# sort로 정렬 후 uniq c옵션으로 같은 라인이 몇개 연속해서 나오는지 표시 한 뒤
# grep으로 1번 사용된 값을 취득 후 값 표시
strings /home/bandit9/data.txt | grep = | awk 'length($2) > 10 { print $2 }'
'Wargame > Bandit' 카테고리의 다른 글
[ Docker ] Bandit Wargame 만들기 - 11번 문제 ( 13 / 33 ) (1) | 2024.06.12 |
---|---|
[ Docker ] Bandit Wargame 만들기 - 10번 문제 ( 12 / 33 ) (0) | 2024.06.12 |
[ Docker ] Bandit Wargame 만들기 - 8번 문제 ( 10 / 33 ) (0) | 2024.06.11 |
[ Docker ] Bandit Wargame 만들기 - 7번 문제 ( 9 / 33 ) (1) | 2024.06.11 |
[ Docker ] Bandit Wargame 만들기 - 6번 문제 ( 8 / 33 ) (1) | 2024.06.11 |