Post

[wargame] overthewire bandit 7 -> 8

Bandit Level 7 -> Level 8

user_id : bandit7
password : morbNTDkSW6jIlUc0ymOdMaLnOlFVAaj

bandit7_8

목표

다음 레벨로 가는 비밀번호는 data.txt라는 파일 안에 millionth라는 단어 옆에 있다.

해결법

일단 어떤 식으로 파일이 이루어져 있나 보기 위해 파일을 읽어봤다.

1
2
3
4
5
6
7
8
9
10
11
bandit7@bandit:~$ cat data.txt

--중략--

summation       u50rQF4SGWx3gtytGjZL9oaF5Pqcf3yi
Israelites      d5RJ2L7p0yKa9RpCr7dU9dhuKq46dFVC
volatility's    wqQvrK0UVKfx2BtyFogXhTyGI0V4BOS5
Albany's        GopEzFC069enA4p224dn1i0Ire3HP9jx
indecisively    tOcTUgSwpbShx5J5x6xmmIQKIlG1GTJz
choosey 3u6Ir3tT1Vq7q17aWIvdT14IxT0f1y5X
velveteen's     46soI2oXIiX1HuXtDXeRLlFrctbGJTYO

어우.. 좀.. 너무 많다 이걸 하나하나 읽어가면서 찾을 수도 있고 혹은 notepad에 옮긴 뒤 ctrl+F로 찾을 수도 있지만 우리는 명령어를 사용하기로 하자.

그 중 우리는 grep이라는 명령어를 사용할 것이다.

grep [옵션] [표현식] [파일명] : 이렇게 파일 속 특정 문자열(혹은 표현식)을 찾습니다.

1
2
bandit7@bandit:~$ grep millionth data.txt
millionth       TESKZC0XvTetK0S9xNwm25STk5iWrBvP

찾았다!


혹은 cat명령어와 grep명령어를 섞어 만들 수도 있다.

cat data.txt | grep millionth 이런식으로!

1
2
bandit7@bandit:~$ cat data.txt | grep millionth
millionth       dfwvzFQi4mU0wfNbFOe9RoWskMLg7eEc

같은 결과가 나온다.


비밀번호는 dfwvzFQi4mU0wfNbFOe9RoWskMLg7eEc이다.

This post is licensed under CC BY 4.0 by the author.