[WarGame] Bandit, Level 12 → Level 13
반복 압축된 파일이, hexdump로 존재한다.
xxd로 까면 되는데, 여러번 압축이 되어 있다고 한다.
압축 횟수가 10번이 넘어갈까..? for문으로 sh 짜야하는게 아닐지..?
Solving
hexdump 풀고, 파일 형식 조회하고 이름 바꾸고 압축 풀고 무한 반복을 했다.
아래 스크립트가 있으니, 참고하세요.
(왜 이런 문제를 낸거야)
bandit12@bandit:~$ cp data.txt /tmp/rojae
bandit12@bandit:~$ cd /tmp/rojae
bandit12@bandit:/tmp/rojae$ ls -rtl
total 4
-rw-r----- 1 bandit12 bandit12 2573 Mar 18 19:28 data.txt
bandit12@bandit:/tmp/rojae$ file data.txt
data.txt: ASCII text
bandit12@bandit:/tmp/rojae$ xxd -r data.txt data
bandit12@bandit:/tmp/rojae$ file data
data: gzip compressed data, was "data2.bin", last modified: Tue Feb 21 22:02:52 2023, max compression, from Unix, original size modulo 2^32 564
bandit12@bandit:/tmp/rojae$ mv data data.gz
bandit12@bandit:/tmp/rojae$ gzip -d data.gz
bandit12@bandit:/tmp/rojae$ file data
data: bzip2 compressed data, block size = 900k
bandit12@bandit:/tmp/rojae$ cp data data.bz2
bandit12@bandit:/tmp/rojae$ file data.bz2
data.bz2: bzip2 compressed data, block size = 900k
bandit12@bandit:/tmp/rojae$ rm data.txt
bandit12@bandit:/tmp/rojae$ bzip2 -d data.bz2
bandit12@bandit:/tmp/rojae$ file data.out
data.out: gzip compressed data, was "data4.bin", last modified: Tue Feb 21 22:02:52 2023, max compression, from Unix, original size modulo 2^32 20480
bandit12@bandit:/tmp/rojae$ mv data.out data.gz
bandit12@bandit:/tmp/rojae$ gzip -d data.gz
gzip: data already exists; do you wish to overwrite (y or n)? y
bandit12@bandit:/tmp/rojae$ ls
data
bandit12@bandit:/tmp/rojae$ file data
data: POSIX tar archive (GNU)
bandit12@bandit:/tmp/rojae$ mv data data.tar
bandit12@bandit:/tmp/rojae$ tar -xvf data.tar
data5.bin
bandit12@bandit:/tmp/rojae$ file data5.bin
data5.bin: POSIX tar archive (GNU)
bandit12@bandit:/tmp/rojae$ tar -xvf data5.bin
data6.bin
bandit12@bandit:/tmp/rojae$ tar -xvf data6.bin
data8.bin
bandit12@bandit:/tmp/rojae$ file data8.bin
data8.bin: gzip compressed data, was "data9.bin", last modified: Tue Feb 21 22:02:52 2023, max compression, from Unix, original size modulo 2^32 49
bandit12@bandit:/tmp/rojae$ mv data8.bin data8.gz
bandit12@bandit:/tmp/rojae$ gzip -d data8.gz
bandit12@bandit:/tmp/rojae$ file data8
data8: ASCII text
bandit12@bandit:/tmp/rojae$ cat data8
The password is wbWdlBxEir4CaE8LaPhauuOo6pwRmrDw
bandit12@bandit:/tmp/rojae$
복붙하면 사용 가능하도록 만들었다.
cd ~
mkdir /tmp/rojae
cp data.txt /tmp/rojae
cd /tmp/rojae
xxd -r data.txt data
mv data data.gz
gzip -d data.gz
cp data data.bz2
rm data.txt
bzip2 -d data.bz2
mv data data.bz2
bzip2 -d data.bz2
mv data data.gz
gzip -d data.gz
mv data data.tar
tar -xvf data.tar
tar -xvf data5.bin
tar -xvf data6.bin
file data8.bin
mv data8.bin data8.gz
gzip -d data8.gz
file data8
cat data8
이렇게 푸는게 맞나 싶었지만, 맞았으니
패스했다.
Refer