서버 등 운영체제(OS)/Linux

[Ubuntu] zip 비밀번호 풀기 (해제하기, 암호풀기)

jihun202 2026. 8. 10. 12:31
반응형

오늘은 암호를 잊어버린 zip 파일 암호를 찾은 방법을 공유해본다.

gpt의 도움을 받아 password recovery 같은 프로그램을 깔기보다 리눅스 환경에서 해제를 시도해보는게 더 좋을거 같아 방법을 찾아보았다.

 

john 패키지를 사용하면 되는데, 

apt-get update
apt-get install john

 

이렇게 설치를 한 다음,

zip2john target.zip zip.hash

 

zip 을 john이 읽을수 있는 hash를 추출해내야 한다.

그런데 john 패키지에는 zip2john 이 포함되있지 않아 직접 git clone 후 컴파일을 해줘야 했다.

 

apt install -y git build-essential libssl-dev zlib1g-dev
git clone https://github.com/openwall/john.git
cd john/src
./configure
make -s clean && make -sj$(nproc)

 

이렇게 하고 나니 설치가 완료 되었고,

john 폴더에 보면 run 폴더가 있는데, 거기서 zip2john을 실행해주면 된다.

 

root@huzy:~/john/run# ./zip2john ~/unlock.zip > ~/zip.hash
ver 2.0 efh 7075 unlock.zip/?Ǻ? ???κδ?_KDW_20251208.pdf PKZIP Encr: TS_chk, cmplen=334251, decmplen=339478, crc=BB33C0B3 ts=6F0D cs=6f0d type=8
Note: It is normal for some outputs to be very large

 

그리고 생성된 zip.hash 를 john 으로 다시 실행해주면 비밀번호를 뽑아준다.

 

root@huzy:~/john/run# ./john ~/zip.hash
Warning: invalid UTF-8 seen reading /root/zip.hash
Using default input encoding: UTF-8
Loaded 1 password hash (PKZIP [32/64])
Will run 16 OpenMP threads
Note: Passwords longer than 21 [worst case UTF-8] to 63 [ASCII] rejected
Proceeding with single, rules:Single
Press 'q' or Ctrl-C to abort, 'h' for help, almost any other key for status
Almost done: Processing the remaining buffered candidate passwords, if any.
0g 0:00:00:00 DONE 1/3 (2026-08-10 12:10) 0g/s 962833p/s 962833c/s 962833C/s Zipunlock1900..Pdf1900
Proceeding with wordlist:./password.lst
Enabling duplicate candidate password suppressor using 256 MiB
Failed to use huge pages (not pre-allocated via sysctl? that's fine)
Disabling duplicate candidate password suppressor
비밀번호        (unlock.zip/?Ǻ? ???κδ?_KDW_20251208.pdf)     
1g 0:00:00:31 DONE 2/3 (2026-08-10 12:10) 0.03211g/s 12424Kp/s 12424Kc/s 12424KC/s 001330001..metallica1984001
Use the "--show" option to display all of the cracked passwords reliably
Session completed
root@huzy:~/john/run# ./john --show ~/zip.hash
Warning: invalid UTF-8 seen reading /root/zip.hash
unlock.zip/?Ǻ? ???κδ?_KDW_20251208.pdf:비밀번호:?Ǻ? ???κδ?_KDW_20251208.pdf:unlock.zip::/root/unlock.zip

 

'비밀번호' 라고 바꿔적은 부분에 zip 파일의 비밀번호가 뜬다. 

반응형