[OverTheWire] Bandit Level 12 -> Level 13

King's meow·2023년 12월 31일

[Linux] 리눅스 공부

목록 보기
13/17
post-thumbnail

🤔 문제

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


✅ 풀이

압축을 풀면 된다!

hexdump : 컴퓨터의 저장장치에 있는 컴퓨터의 데이터를 16진법으로 표시한 것

16진수는 0,1,2,3,4,5,6,7,8,9과 a,b,c,d,e,f 로마문자(영어)로 이루어져 있다.

xxd 명령어는 바이너리 파일을 hexdump로 바꾸거나, 반대로 hexdump를 바이너리 파일로 바꿀때 사용한다.

확장자를 꼭 붙여야 한다. -> mv를 써서 이름을 바꾼다.

zip 파일을 풀는 명령어: gunzip(gzip), bzip2 -d(bzip), tar -xvf(tar)

bandit12@bandit:~$ mkdir /tmp/jmg                                
bandit12@bandit:~$ cp data.txt /tmp/jmg                        
bandit12@bandit:~$ cd /tmp/jmg                                 
bandit12@bandit:/tmp/jmg$ ls                                 
data.txt                                                     
bandit12@bandit:/tmp/jmg$ xxd -r data.txt > zipfile           
bandit12@bandit:/tmp/jmg$ ls                                 
data.txt  zipfile                                                                
bandit12@bandit:/tmp/jmg$ mv zipfile zipfile.gz                                                      
bandit12@bandit:/tmp/jmg$ gunzip zipfile.gz                   
bandit12@bandit:/tmp/jmg$ ls                                 
data.txt  zipfile                                             
bandit12@bandit:/tmp/jmg$ file zipfile                       
zipfile: bzip2 compressed data, block size = 900k                                             
bandit12@bandit:/tmp/jmg$ mv zipfile zipfile.bz                                           
bandit12@bandit:/tmp/jmg$ bzip2 -d zipfile.bz                 
bandit12@bandit:/tmp/jmg$ ls                                 
data.txt  zipfile                                             
bandit12@bandit:/tmp/jmg$ file zipfile                       
zipfile: gzip compressed data, was "data4.bin", last 
modified: Thu Oct  5 06:19:20 2023, max compression, from 
Unix, original size modulo 2^32 20480                         
bandit12@bandit:/tmp/jmg$ mv zipfile zipfile.gz               
bandit12@bandit:/tmp/jmg$ gunzip zipfile.gz                   
bandit12@bandit:/tmp/jmg$ ls                                 
data.txt  zipfile                                             
bandit12@bandit:/tmp/jmg$ file zipfile                       
zipfile: POSIX tar archive (GNU)                             
bandit12@bandit:/tmp/jmg$ mv zipfile zipfile.tar             
bandit12@bandit:/tmp/jmg$ tar -xvf zipfile.tar               
data5.bin                                                          
bandit12@bandit:/tmp/jmg$ file data5.bin                     
data5.bin: POSIX tar archive (GNU)                           
bandit12@bandit:/tmp/jmg$ mv data5.bin data5.tar             
bandit12@bandit:/tmp/jmg$ tar -xvf data5.tar                 
data6.bin                                                     
bandit12@bandit:/tmp/jmg$ ls                                 
data5.tar  data6.bin  data.txt  zipfile.tar                   
bandit12@bandit:/tmp/jmg$ files data6.bin                     
Command 'files' not found, did you mean:                     
command 'file2' from deb file-kanji (1.1-20)                 
command 'file' from deb file (1:5.41-3ubuntu0.1)             
Try: apt install <deb name>                                   
bandit12@bandit:/tmp/jmg$ file data6.bin                     
data6.bin: bzip2 compressed data, block size = 900k           
bandit12@bandit:/tmp/jmg$ mv data6.bin data6.bz               
bandit12@bandit:/tmp/jmg$ bzip2 -d data6.bz                   
bandit12@bandit:/tmp/jmg$ ls                                 
data5.tar  data6  data.txt  zipfile.tar                       
bandit12@bandit:/tmp/jmg$ file data6 
data6: POSIX tar archive (GNU)                               
bandit12@bandit:/tmp/jmg$ mv data6 data6.tar                 
bandit12@bandit:/tmp/jmg$ tar -xvf data6.tar                 
data8.bin                                                     
bandit12@bandit:/tmp/jmg$ file data8.bin                     
data8.bin: gzip compressed data, was "data9.bin", last 
modified: Thu Oct  5 06:19:20 2023, max compression, from 
Unix, original size modulo 2^32 49                           
bandit12@bandit:/tmp/jmg$ mv data8.bin  data8.gz             
bandit12@bandit:/tmp/jmg$ gunzip data8.gz                     
bandit12@bandit:/tmp/jmg$ ls                                 
data5.tar  data6.tar  data8  data.txt  zipfile.tar           
bandit12@bandit:/tmp/jmg$ file data8                         
data8: ASCII text                                             
bandit12@bandit:/tmp/jmg$ cat data8                           
The password is wbWdlBxEir4CaE8LaPhauuOo6pwRmrDw 

bandit13 : wbWdlBxEir4CaE8LaPhauuOo6pwRmrDw

profile
백엔드 개발자가 되고 싶은 응애

0개의 댓글