Learn Linux Command by Playing Bandit Wargame [Level 12 → Level 13]

1,092 reads

reactions

Learn linux command by playing Bandit wargame. The Bandit wargame is aimed at absolute beginners. It will teach the basics needed to be able to play other wargames. Below is the solution of Level 12 → Level 13.

reactions

In this post we will learn about various compression techniques and

how to decompress file. We will learn how to convert binary to hex file

and vice-versa.

reactions

Previous Post

Bandit Level 0 to Level 3

Bandit Level 4 to Level 8

Bandit Level 9 to Level 11



reactions

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

reactions

Commands you may need to solve this level



grep, sort, uniq, strings, base64, tr, tar, gzip, bzip2, xxd, mkdir, cp, mv, file

reactions

Solution :





Command to connect remote host :

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

5Te8Y4drgCRfCx8ugdwuEX8KFC6k2EUu

reactions

password is

As mentioned in question make a new directory in /tmp and rename the file.

reactions

xxd

-r

myfile.txt

myfile1.bin

reactions

xxd -r myfile.txt > myfile1.bin

program is used to make a hexdump or to do the reverse. Optionconvert hexdump into the binary. Fileis a hexdump and convert it into a binary fileusing command

Using command

file myfile1.bin

myfile1.bin

reactions

, we found thatis a gzip compressed data.

zcat

gzip

reactions

zcat myfile1.bin > myfile2

is a program supplied withand is used to decompress gzip compressed files.

Again using

file

myfile2

reactions

command on, we found that it is bzip2 compressed data.

bzcat

bzip2

reactions

bzcat myfile2 > myfile3

program is supplied withand is used to decompress bzip2 compressed files.

myfile3

zcat

myfile4

myfile4

reactions

is gzip compressed file so useprogram to decompress it inis a POSIX tar archive.

tar

x

f

v

reactions

tar -xvf myfile4

program is used for archiving file and optionsis used to extract an archive,is used to specify name of the tar archive andis used for more detailed listing.

This command outputs file

data5.bin

tar

data5.bin

data6.bin

data6.bin

bzcat

myfile7

reactions

which is again a tar archive. Again useprogram onwhich outputsis a bzip2 compressed file and useprogram to decompress it to

myfile7

tar

data8.bin

data8.bin

zcat

myfile9

reactions

is a tar archive and useprogram which outputsis a gzip compressed file and useto decompress it to file

myfile9

cat myfile9

reactions

contains ASCII text andtells the password for the next level.

The password for the next level is

8ZjyCRiBWFYkneahHwxCv3wb2a1ORpYL

reactions

Reference : The Linux Command Line – A Complete Introduction

https://linux.die.net/man/1/xxd

reactions



Next Post



Bandit Level 13 to Level 15

Bandit Level 16 to Level 18

Bandit Level 19 to Level 20

Bandit Level 21 to Level 22

Bandit Level 23 → Level 24

Bandit Level 24 → Level 25

Bandit Level 25 to Level 26

Bandit Level 27 to Level 31

Bandit Level 32 → Level 33

reactions

Originally posted at Programmercave





.

reactions







reactions

reactions

reactions

Tags