パスワードを忘れてしまった zip ファイルを John the Ripper で解析しようとしましたが、 John the Ripper では PKZIP に対し、GPUを活用できないらしく、 諦めました。
没ネタですが、メモとして記載しておきます。
参考url
利用環境
項目 | 内容 |
---|---|
PC | thinkpad x1 carbon gen 8 |
OS | Windows 11 Pro |
CPU | Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz 2.11GHz |
MEM | 16GB |
GPU | NVIDIA GeForce RTX 3060 |
install John the Ripper
今回は、以下のurlを参考に 外付GPUのある windows 11 に John the Ripper を install しています。
How to install John the Ripper and Johnny on Windows with GPU support - Life of a webmaster
install cygwin
https://www.cygwin.com/ から、インストーラである setup-x86_64.exe を ダウンロードし、実行するだけです。
install John the Ripper
https://github.com/openwall/john-packages/releases/tag/jumbo-dev から winX64_1_JtR.7z をダウンロードし、C:\cygwin64\home\end0t に解凍します。
convert cygOpenCL-1.dll by OpenCL.dll
先程、解凍した JtR 以下に cygOpenCL-1.dll がありますが、 GPUを認識させる為、c:\Windows\System32\OpenCL.dll で置き換えます
PS> cd c:\cygwin64\home\end0t\JtR\run PS> cp c:\Windows\System32\OpenCL.dll .
check JtR with GPU
以下のコマンドで、GPUが認識されていることを確認できます。
PS C:\cygwin64\home\end0t> .\JtR\run\john.exe --help John the Ripper 1.9.0-jumbo-1+bleeding-e4373c9 2022-01-29 19:47:54 +0100 OMP [cygwin 64-bit x86_64 AVX2 AC] Copyright (c) 1996-2022 by Solar Designer and others Homepage: https://www.openwall.com/john/ Usage: john [OPTIONS] [PASSWORD-FILES] <略> PS C:\cygwin64\home\end0t> .\JtR\run\john.exe --list=opencl-devices Platform #0 name: Intel(R) OpenCL HD Graphics, version: OpenCL 3.0 Device #0 (1) name: Intel(R) UHD Graphics Device vendor: Intel(R) Corporation Device type: GPU (LE) Device version: OpenCL 3.0 NEO Driver version: 30.0.101.1122 Native vector widths: char 16, short 8, int 4, long 1 Preferred vector width: char 16, short 8, int 4, long 1 Global Memory: 6453 MiB Global Memory Cache: 512 KiB Local Memory: 64 KiB (Local) Constant Buffer size: 3226 MiB Max memory alloc. size: 3226 MiB Max clock (MHz): 1100 Profiling timer res.: 83 ns Max Work Group Size: 256 Parallel compute cores: 24 Stream processors: 192 (24 x 8) Speed index: 211200 Platform #1 name: NVIDIA CUDA, version: OpenCL 3.0 CUDA 11.6.58 Device #0 (2) name: NVIDIA GeForce RTX 3060 Device vendor: NVIDIA Corporation Device type: GPU (LE) Device version: OpenCL 3.0 CUDA Driver version: 511.23 [recommended] Native vector widths: char 1, short 1, int 1, long 1 Preferred vector width: char 1, short 1, int 1, long 1 Global Memory: 12287 MiB Global Memory Cache: 784 KiB Local Memory: 48 KiB (Local) Constant Buffer size: 64 KiB Max memory alloc. size: 3071 MiB Max clock (MHz): 1807 Profiling timer res.: 1000 ns Max Work Group Size: 1024 Parallel compute cores: 28 CUDA INT32 cores: 1792 (28 x 64) Speed index: 3238144 Warp size: 32 Max. GPRs/work-group: 65536 Compute capability: 8.6 (sm_86) Kernel exec. timeout: yes PCI device topology: 30:00.0 Platform #2 name: Intel(R) OpenCL, version: OpenCL 3.0 WINDOWS Device #0 (3) name: Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz Device vendor: Intel(R) Corporation Device type: CPU (LE) Device version: OpenCL 3.0 (Build 0) Driver version: 2021.13.11.0.23_160000 Native vector widths: char 32, short 16, int 8, long 4 Preferred vector width: char 1, short 1, int 1, long 1 Global Memory: 16134 MiB Global Memory Cache: 256 KiB Local Memory: 32 KiB (Global) Constant Buffer size: 128 KiB Max memory alloc. size: 4033 MiB Max clock (MHz): 1600 Profiling timer res.: 100 ns Max Work Group Size: 8192 Parallel compute cores: 8 Speed index: 51200
ZIP ファイルのパスワード解析
zipファイルからhashの取り出し
PS> .\JtR\run\zip2john.exe .\EXCEL_MIN.zip > .\EXCEL_MIN.hash ver 2.0 EXCEL_MIN.zip/EXCEL_MIN.xlsx PKZIP Encr: cmplen=76365, decmplen=106981, crc=FFC62F25 ts=A657 cs=ffc6 type=8
*.hash ファイルのDOS -> UNIX改行化
windows環境で zip2john を使用した場合、DOS改行コードとなる為 john.exe 実行時に以下のようなエラーとなります。
これを避ける為、*.hash ファイルのDOS -> UNIX改行化して下さい。
> .\JtR\run\john.exe .\EXCEL_MIN.hash Warning: UTF-16 BOM seen in password hash file. File may not be read properly unless you re-encode it Warning: invalid UTF-8 seen reading .\EXCEL_MIN.hash Using default input encoding: UTF-8 No password hashes loaded (see FAQ)
ZIP ファイルのパスワード解析 (単純実行)
4文字英大小数字+記号のパスワードを解析しようとしました。
以下から「8 OpenMP threads」実行されているようですが、 windowsのタスクマネージャーでは、GPUが利用されておらず、 30分経過しても解析は完了しませんでした。
PS C:\cygwin64\home\end0t> .\JtR\run\john.exe .\EXCEL_MIN.hash Using default input encoding: UTF-8 Loaded 1 password hash (PKZIP [32/64]) Will run 8 OpenMP threads Proceeding with single, rules:Single Press 'q' or Ctrl-C to abort, almost any other key for status Almost done: Processing the remaining buffered candidate passwords, if any. Proceeding with wordlist:/run/password.lst Proceeding with incremental:ASCII :
ZIP ファイルのパスワード解析 (--devices=0,1,2)
johnコマンドには、「--devices」オプションがありますので、 これを指定し、実行しましたが、やはりエラー。
PS C:\cygwin64\home\end0t> .\JtR\run\john.exe --devices=0,1,2 .\EXCEL_MIN.hash Using default input encoding: UTF-8 The "--devices" option is valid only for OpenCL or ZTEX formats
更に「.\JtR\run\john.exe --list=formats」で対応する format を確認しましたが、PKZIP-opencl がない為、 GPUを使用したzipパスワードの解析は、諦めました。