Level Goal
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.
다음 레벨의 비밀번호는 몇 개의 '=' 문자가 앞에 오는 사람이 읽을 수 있는 몇 가지 문자열 중 하나로 data.txt 파일에 저장됩니다.
Hint
1. grep 명령어의 -a 옵션
2. string 명령어
Write Up
![](https://blog.kakaocdn.net/dn/dKsheU/btri3U9Sk5K/kYLHot0BE776LmGzoV3Z21/img.png)
data.txt 파일을 읽어보니, 아스키 코드로 이루어진 데이터는 아닌 듯하였다.
![](https://blog.kakaocdn.net/dn/b5Gysy/btri5IHCsAu/M6bKTDjsZRCAzKtPVh4wLK/img.png)
확인한 결과, 역시 아스키 코드가 아닌 data 타입이라고 나온다.
![](https://blog.kakaocdn.net/dn/ceaWWh/btriYXzkU2E/v3zoHncaJyMDaXZDxP6mo0/img.png)
일단 데이터 속에 사람이 읽을 수 있는 문자열이 있는 것 같으니, 확인을 위해 grep 명령어을 이용하여 =이 있는 부분만 출력하려고 했다. 하지만 Binary 파일이라서 grep 명령어가 먹히지가 않았다.
google에 grep binary file이라고 검색하니, grep 명령어의 -a 옵션을 사용하면 binary 파일도 원하는 부분을 추출할 수 있다고 한다.
![](https://blog.kakaocdn.net/dn/0LnOn/btri5leSbz0/ziuI0N36UMurxqSBrZ93fk/img.png)
여러 개의 = 문자 앞에 bandit10의 pw가 있다고 했지만, 일단 = 하나만 넣어서 추출하였다.
그 결과 너무나 많은 값들이 출력되었다.
![](https://blog.kakaocdn.net/dn/rUsUg/btri6ErbScg/qSKJDbeEKB02eZDys95b31/img.png)
2개의 = 문자을 grep 명령어에 넣고 추출하였더니, 이전 보다 적은 문자열들이 출력되었다.
하지만 너무나 보기 힘들어서 strings 명령어를 이용하여 보기 좋게 출력하겠끔 하겠다.
![](https://blog.kakaocdn.net/dn/Ax1Pm/btriZGjRXpg/7dwxenrhcEWQTmZ4FbjfFK/img.png)
stirngs 명령어는 모든 인쇄 가능한 문자열을 추출하여 출력하는 명령어이다.
stirngs 명령어을 사용하면 위와 같이 보기 좋게 정리하여 출력되기 때문에 분석하기가 훨씬 쉬웠다.
확인한 결과 password is truKLdjsbJ5g7yyJ2X2R0o3a5HQJFuLk이라는 문구를 볼 수 있었다.
bandit10 :: truKLdjsbJ5g7yyJ2X2R0o3a5HQJFuLk
'Wargame > OverTheWire' 카테고리의 다른 글
[OverTheWire System - Bandit] Level 12 >> Level 13 (0) | 2021.10.31 |
---|---|
[OverTheWire System - Bandit] Level 10 >> Level 11 (0) | 2021.10.28 |
[OverTheWire System - Bandit] Level 8 >> Level 9 (0) | 2021.10.27 |
[OverTheWire System - Bandit] Level 7 >> Level 8 (0) | 2021.10.27 |
[OverTheWire System - Bandit] Level 6 >> Level 7 (0) | 2021.10.27 |
Comment