Over the Wire/Bandit

[Bandit] OverTheWire : bandit level 5 → 10

ruming 2021. 2. 5. 17:50

 

Level 5 → Level 6

The password for the next level is stored in a file somewhere under the inhere directory and has all of the following properties:

  • human-readable

  • 1033 bytes in size

  • not executable

ls, cd, cat, file, du, find

저번처럼 디렉토리를 하나하나 다 열어볼 순 없을 것 같아서 검색 기능을 사용하기로 했다. find 명령어에 -size옵션으로 1033바이트인 파일을 찾을 것이다. 

c가 바이트단위다.

DXjZPULLxYr17uwoI01bNLQbtFemEgo7


Level 6 → Level 7

The password for the next level is stored somewhere on the server and has all of the following properties:

  • owned by user bandit7

  • owned by group bandit6

  • 33 bytes in size

ls, cd, cat, file, du, find, grep

검색으로만 찾도록 복잡하게 숨겨 놓은 것 같다. 33바이트만을 이용해서 찾아보려 했는데 파일이 너무 많아 조건 세 가지를 다 이용해야 할 것 같다.

$ find / -group bandit6 -user bandit7 -size 33c

파일이 너무 많아서 못찾을뻔 했다. 

HKBPTKQnIay4Fw76bEy8PVxKEDQRKTzs


Level 7 → Level 8

The password for the next level is stored in the file data.txt next to the word millionth

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

이번엔 파일 내에서 문자열을 검색해야 한다. grep을 이용해봤다.

 

millionth 줄에 있던 비밀번호가 함께 출력됐다.

cvX2JJa4CFALtqS87jk27qwqGhBM9plV


Level 8 → Level 9

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

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

출력해보니 문자열이 많이 저장되어 있다. 힌트에 나와있는 sort 명령어를 사용해봤다.

반복되는 문자열이 계속 출력된다. one line이라는 건 반복되지 않는 문자열을 말하는 것 같다. uniq명령어는 중복되는 행을 제거해준다고 한다. 근데 이미 눈으로 찾아버리긴 했다. 

그래도 uniq 명령어를 사용해보자. uniq를 그냥 사용하면 중복행을 제거하고 하나만 출력해주기 때문에, 중복되지 않는 행만 출력할 필요가 있다. -u옵션을 사용하면 된다. 참고

UsvVyFSfZZWbi6wgC7dAFyFuR6jQQUhR


Level 9 → Level 10

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.

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

data.txt파일이 이상한 문자로 가득 차있다. =뒤에 패스워드가 있다는 것 같다. grep을 쓰려고 했더니 바이너리 파일이라 안써진다. -a 옵션을 써도 깔끔하게 안나오길래 strings를 썼다. strings는 바이너리 파일에서 문자열만 출력해준다고 한다. 참고

strings와 grep을 함께 쓰니 바이너리 파일에서도 문자열을 뽑아 검색할 수 있다.

truKLdjsbJ5g7yyJ2X2R0o3a5HQJFuLk

 

 

 

 

'Over the Wire > Bandit' 카테고리의 다른 글

[Bandit] OverTheWire : bandit level 0 → 5  (0) 2021.01.31