꿀 떨어지는 코딩 양봉장

Bandit Level12 ->Levle13 본문

Language/linux

Bandit Level12 ->Levle13

nayoon030303 2021. 9. 22. 23:51

Level Goal

The password for the next level is stored in the file data.txt, which is a hexdump of a file that has been repeatedly compressed. For this level it may be useful to create a directory under /tmp in which you can work using mkdir. For example: mkdir /tmp/myname123. Then copy the datafile using cp, and rename it using mv (read the manpages!)

패스워드는 반복적으로 압축되어서 16진수로  data.txt 파일 안에 있습니다. mkdir을 사용해서 작업할 수 있는 /temp폴더 아래에 디렉터리를 만들어 작업하는 것이 유용합니다. 

 

 

풀이 

리눅스에 파일구조는 아래 사진처럼 되어있습니다. 

리눅스 디렉토리 구조 (그림 출처 http://www.doc.ic.ac.uk/~wjk/UnixIntro/Lecture2.html) 출처:  https://webdir.tistory.com/101  [WEBDIR]

우리는 지금 home 디렉터리에 있고 home디렉터리에서 퍼미션 권한이 read밖에 없습니다. 그러므로 tmp 디렉터리로 data.txt를 복사하고 거기서 파일을 생성하면서 문제를 풀어봅시다. 

mkdir /tmp/abc
//tmp 및에 abc라는 폴더를 만듭니다 

cp data.txt /tmp/abc
//data.txt 파일을 /tmp/abc 아래 폴더로 복사합니다. 
 
 cd /tmp/abc
 // /tmp/abc 폴더 아래로 이동합니다.

 

cat data.txt를 하면 hex dump(컴퓨터 데이터의 16진법인 보임새) 파일이 표현되어있는 것을 알 수 있습니다. xxd 명령어를 사용해서 hexdup를 binary로 바꿔줍니다.

xxd -r data.txt question

binary로 변경된 내용이 question에 저장되었습니다. 

file명령어로 question의 타입을 확안해줍니다.

file question
question: gzip compressed data, was "data2.bin",
last modified: Thu May  7 18:14:30 2020, max compression, from Unix

question은 gzip타입인 것을 확인할 수 있습니다. 

 

cp로 question의 내용을 question.gz로 복사합니다.  압축을 풀려면 파일의 타입을 명시해줘야 합니다. 

gzip -d로 압축을 해제합니다.

 cp question question.gz
 gzip -d question.gz

 

이제 계속 file타입을 확인하고 풀고를 반복하면 됩니다.

그럼 정답은 8ZjyCRiBWFYkneahHwxCv3wb2a1ORpYL 입니다

'Language > linux' 카테고리의 다른 글

Bandit Level14 ->Levle15  (0) 2021.09.23
Bandit Level13 ->Levle14  (0) 2021.09.23
Bandit Level11 ->Levle12  (0) 2021.09.21
Bandit Level10 ->Levle11  (0) 2021.09.21
Bandit Level9 ->Levle10  (0) 2021.09.21