[Bandit-OverTheWire] Level 12 -> Level 13
두비니
·2020. 9. 21. 10:13
Bandit Level 12 → Level 13Level GoalThe 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!) Commands you may need to solve this levelgrep, sort, uniq, strings, base64, tr, tar, gzip, bzip2, xxd, mkdir, cp, mv, file Helpful Reading Material |
접속
접속 : ssh bandit12@bandit.labs.overthewire.org -p2220
pw : 5Te8Y4drgCRfCx8ugdwuEX8KFC6k2EUu
계속해서 압축된 파일의 hexdump라고합니다. 그러면 xxd로 hexdump를 다시 되돌려놓고, 압축했다니깐 압축을 풀어주도록 하겠습니다.
+) hexdump란? 쉽게 말해서 파일을 싹다 16진수들로 표현하여 모아놓은 것입니다. 쉽게말해 hxD 에서 파일 집어넣으면 보이는 형식을 hexdump라고 합니다.
++) xxd란? 이런 hexdump를 만들거나 되돌리는 기능을 가진 명령어입니다.
참고 : twpower.github.io/122-xxd-command-usage
bandit12@bandit:~$ xxd -r data.txt data
xxd: data: Permission denied
bandit12@bandit:~$ mkdir /tmp/dubini0
bandit12@bandit:~$ cp data.txt /tmp/dubini0
bandit12@bandit:~$ cd /tmp/dub
-bash: cd: /tmp/dub: No such file or directory
bandit12@bandit:~$ cd /tmp/dubini0
bandit12@bandit:/tmp/dubini0$ ls
data.txt
bandit12@bandit:/tmp/dubini0$ xxd -r data.txt data
bandit12@bandit:/tmp/dubini0$ ls
data data.txt
data를 확인해봅시다.
bandit12@bandit:/tmp/dubini0$ file data
data: gzip compressed data, was "data2.bin", last modified: Thu May 7 18:14:30 2020, max compression, from Unix
gzip 압축 데이터네요.
.gz파일은 gzip명령어로 압축해제합니다. 참고 : ifuwanna.tistory.com/31
bandit12@bandit:/tmp/dubini0$ mv data data.gz
bandit12@bandit:/tmp/dubini0$ gzip -d data.gz
bandit12@bandit:/tmp/dubini0$ ls
data data.txt
bandit12@bandit:/tmp/dubini0$ file data
data: bzip2 compressed data, block size = 900k
풀었더니 bzip2 파일이 있네요.
또 풀어줍시다.
bandit12@bandit:/tmp/dubini0$ bzip2 -d data.bz2
bandit12@bandit:/tmp/dubini0$ ls
data data.txt
bandit12@bandit:/tmp/dubini0$ file data
data: gzip compressed data, was "data4.bin", last modified: Thu May 7 18:14:30 2020, max compression, from Unix
이런식으로 쭉 반복되서 코드만 올립니다.
bandit12@bandit:/tmp/dubini0$ tar -xjvf data.bz2
bandit12@bandit:/tmp/dubini0$ ls
data.bz2 data.txt
bandit12@bandit:/tmp/dubini0$ file data.bz2
data.bz2: bzip2 compressed data, block size = 900k
bandit12@bandit:/tmp/dubini0$ bzip2 -d data.bz2
bandit12@bandit:/tmp/dubini0$ ls
data data.txt
bandit12@bandit:/tmp/dubini0$ file data
data: gzip compressed data, was "data4.bin", last modified: Thu May 7 18:14:30 2020, max compression, from Unix
bandit12@bandit:/tmp/dubini0$ mv data data.gz
bandit12@bandit:/tmp/dubini0$ gzip -d data.gz
bandit12@bandit:/tmp/dubini0$ file data
data: POSIX tar archive (GNU)
bandit12@bandit:/tmp/dubini0$ tar -xvf data.tar
tar: data.tar: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
bandit12@bandit:/tmp/dubini0$ mv data data.tar
bandit12@bandit:/tmp/dubini0$ tar -xvf data.tar
data5.bin
bandit12@bandit:/tmp/dubini0$ file data5.bin
data5.bin: POSIX tar archive (GNU)
bandit12@bandit:/tmp/dubini0$ mv data5.bin data5.tar
bandit12@bandit:/tmp/dubini0$ tar -xvf data5.tar
data6.bin
bandit12@bandit:/tmp/dubini0$ file data6.bin
data6.bin: bzip2 compressed data, block size = 900k
bandit12@bandit:/tmp/dubini0$ mv data6.bin data6.bz2
bandit12@bandit:/tmp/dubini0$ bzip2 -d data6.bz2
bandit12@bandit:/tmp/dubini0$ file data
data: cannot open `data' (No such file or directory)
bandit12@bandit:/tmp/dubini0$ ls
data5.tar data6 data.tar data.txt
bandit12@bandit:/tmp/dubini0$ file data6
data6: POSIX tar archive (GNU)
bandit12@bandit:/tmp/dubini0$ mv data6 data6.tar
bandit12@bandit:/tmp/dubini0$ tar -xvf data6.tar
data8.bin
bandit12@bandit:/tmp/dubini0$ file data8.bin
data8.bin: gzip compressed data, was "data9.bin", last modified: Thu May 7 18:14:30 2020, max compression, from Unix
bandit12@bandit:/tmp/dubini0$ mv data8.bin data8.gz
bandit12@bandit:/tmp/dubini0$ gzip -d data8.gz
bandit12@bandit:/tmp/dubini0$ ls
data5.tar data6.tar data8 data.tar data.txt
bandit12@bandit:/tmp/dubini0$ file data8
data8: ASCII text
bandit12@bandit:/tmp/dubini0$ cat data8
The password is 8ZjyCRiBWFYkneahHwxCv3wb2a1ORpYL
귀찮아....
'War Games > Bandit - OverTheWire' 카테고리의 다른 글
[Bandit-OverTheWire] Level 14 -> Level 15 (0) | 2020.09.22 |
---|---|
[Bandit-OverTheWire] Level 13 -> Level 14 (6) | 2020.09.21 |
[Bandit-OverTheWire] Level 11 -> Level 12 (0) | 2020.09.21 |
[Bandit-OverTheWire] Level 10 -> Level 11 (0) | 2020.09.20 |
[Bandit-OverTheWire] Level 9 -> Level 10 (0) | 2020.09.20 |