메-모해봅시다.

Bandit Level 8 → Level 9 본문

리눅스/Over The Wire

Bandit Level 8 → Level 9

RollingPumpkin 2020. 5. 20. 04:48

Level Goal

The password for the next level is stored in the file data.txt and is the only line of text that occurs only once

Commands you may need to solve this level

grep, sort, uniq, strings, base64, tr, tar, gzip, bzip2, xxd


목표

다음 단계로 가는 비밀번호는 data.txt 파일에서 중복되지 않는 한 줄입니다.

 

이 단계를 해결할 때 유용한 명령어

grep, sort, uniq, strings, base64, tr, tar, gzip, bzip2, xxd



-어떻게 풀까?


우선 data.txt파일을 확인하고 cat 명령어로 내용을 확인해 보자

전 단계에서 풀었던 문제처럼 매우 긴 스크롤의 텍스트가 나타났다...

이제 해야할 일은 겹치는 문장을 정렬하고 없애는 것이다.

문제에 제시된 이 단계를 해결할 때 유용한 명령어 를 살펴보면 정답이 나와있다.

 

바로 sortuniq 명령어이다.

우선, sort 명령어를 사용해보자.

같은 문장끼리 나열해 보기 깔끔해졌다.

보다시피, sort 명령어는 파일 내용을 정렬시켜주는 명령어이다.

이제, 중복되는 내용을 지워주는 uniq 명령어를 같이 사용해보자.

(단, uniq --help 명령어로 찾아본 결과, 원하는 결과물을 위해선 uniq -u 를 사용할 것)

그냥 uniq 만 붙이면 이렇게 중복되는 것만 하나로 겹쳐준다.
uniq -u 명령어를 사용하면 겹치지 않는 하나의 문장만을 출력해준다.

이제 비밀번호인 UsvVyFSfZZWbi6wgC7dAFyFuR6jQQUhR 를 알아내었으니 다음 단계로 넘어가자.

ssh bandit9@bandit.labs.overthewire.org -p 2220

 

'리눅스 > Over The Wire' 카테고리의 다른 글

Bandit Level 10 → Level 11  (0) 2020.05.20
Bandit Level 9 → Level 10  (0) 2020.05.20
Bandit Level 7 → Level 8  (0) 2020.05.19
Bandit Level 6 → Level 7  (0) 2020.05.19
Bandit Level 5 → Level 6  (0) 2020.05.09