Level 8 → Level 9

옥영진·2020년 5월 16일
0

Bandit - OverTheWire

목록 보기
9/33

Level 8 → Level 9

목표

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 파일 내에 중복되지 않은 오직 한 줄에 존재한다고 한다.

해결

cat data.txt | sort | uniq -u

cat 명령어로 data.txt 파일을 출력하고 그 결과를 파이프(\)를 사용하여 sort 명령어의 입력으로 전달한다. 그렇게 되면 파일 내용이 오름차순으로 정렬되고, 그 결과를 다시 uniq 명령어의 입력으로 전달한다. -u 옵션은 텍스트의 내용 중 연속적으로 중복되는 행을 제외하고 유일하게 존재하는 한 행만 출력한다.

  • sort
    텍스트의 내용을 행 단위로 오름차순(기본값)으로 정렬한다.
  • uniq
    텍스트의 내용 중 연속적인 행을 제외하고 출력한다.
profile
안녕하세요 함께 공부합시다

0개의 댓글