The password for the next level is stored in the file data.txt, which contains base64 encoded data
echo 명령어 옵션
- n : 마지막에 따라오는 개행 문자(newline) 문자를 출력하지 않는다
- e : 문자열에서 백슬래시와 이스케이프 문자를 (")로 묶어 인식하도록 한다
- E : 문자열에서 백슬래시와 이스케이프문자를 비활성화 한다
*아 printf 명령어를 사용했으면 개행 생각을 안해도 되네요
bandit10@bandit:~$ ls
data.txt
bandit10@bandit:~$ cat data.txt
VGhlIHBhc3N3b3JkIGlzIGR0UjE3M2ZaS2IwUlJzREZTR3NnMlJXbnBOVmozcVJyCg==
bandit10@bandit:~$ echo -n 'VGhlIHBhc3N3b3JkIGlzIGR0UjE3M2ZaS2IwUlJzREZTR3NnMlJXbnBOVmozcVJyCg==' | base64 --decode
The password is dtR173fZKb0RRsDFSGsg2RWnpNVj3qRr
bandit10@bandit:~$ echo 'VGhlIHBhc3N3b3JkIGlzIGR0UjE3M2ZaS2IwUlJzREZTR3NnMlJXbnBOVmozcVJyCg==' | base64 --decode
The password is dtR173fZKb0RRsDFSGsg2RWnpNVj3qRr
---------------------------------------------------------------------printf---------------------------------------------------------------------------
bandit10@bandit:~$ printf 'VGhlIHBhc3N3b3JkIGlzIGR0UjE3M2ZaS2IwUlJzREZTR3NnMlJXbnBOVmozcVJyCg==' | base64 --decode
The password is dtR173fZKb0RRsDFSGsg2RWnpNVj3qRr
-n 옵션을 쓰고 안쓰고 차이가 궁금해서 해봤는데 디코더가 개행문자 \n 정도는 문제로 생각하지 않고 디코딩을 해줘서 그런 것으로 확인됐음 근데 나중에 데이터 출력물이 정확히 한 줄로 끝나야하는 상황이 온다면 -n 옵션이 필요한 것으로 보인답니다 ~
'bandit' 카테고리의 다른 글
| [OverTheWire] bandit 12 -> 13 (0) | 2025.11.22 |
|---|---|
| [OverTheWire] bandit 11 -> 12 (0) | 2025.11.22 |
| [OverTheWire] bandit 9 -> 10 (0) | 2025.11.22 |
| [OverTheWire] bandit 8 -> 9 (0) | 2025.11.22 |
| [OverTheWire] bandit 7 -> 8 (0) | 2025.11.22 |