bandit12

KJH·2022년 11월 23일

bandit

목록 보기
8/29

lv 12

링크

ssh bandit12@bandit.labs.overthewire.org -p 2220
#JVNBBFSmZwKKOP0XbFXOoW8chDz5yVRv

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!)

여러번 압축된 data.txt를 풀어라 (권한문제로 /tmp 에 폴더를 만들어서 작업할것)


풀이

하나도 모르겠어서 인터넷을 참고했다.

1. 작업할 폴더에 data.txt를 복사한다.

bandit12@bandit:~$ cp data.txt /tmp/jiheon ; cd /tmp/jiheon

2. xxd(16진수와 2진수간의 변환) 을 통해 이진파일로 바꿔준다

  • file 명령어를 통해서, gzip으로 압축된 파일임을 알 수 있다.
    -r 옵션은 16=>2 일때 사용
 cat data.txt | xxd -r >data
 file data
# data: gzip compressed data, was "data2.bin", last modified: Thu Sep  1 06:30:09 2022, max compression, from Unix, original size modulo 2^32 575

3. gzip 압축풀기

  • 압축을 푸는 -d 옵션을 쓴다
  • 확장자가 gz인 경우에만 gzip을 쓸 수 있으므로 이름을 변경한다
gzip -d data
file data
#data: bzip2 compressed data, block size = 900k

이번엔 bzip2로 압축되었다고 한다.

4.bzip2 압축풀기 +@

  • -d
  • 확장자 bz로 변경하고 진행
mv data data.bz
bzip2 -d data.bz
file data
#data: gzip compressed data, was "data4.bin", last modified: Thu Sep  1 06:30:09 2022, max compression, from Unix, original size modulo 2^32 20480

또 gzip이다

mv data data.gz
gzip -d data.gz
file data
#data: POSIX tar archive (GNU)

tar

5. tar 압축풀기

-x옵션 => 압축풀기
-f옵션 =>dlfmawlwjd

mv data data.tar
tar -xf data.tar
file data6.bin

이 과정을 계속 반복한다
# The password is wbWdlBxEir4CaE8LaPhauuOo6pwRmrDw

0개의 댓글