使用John和hashcat破解压缩包密码
前言
现在网上有不少分享的资源都是一些二道贩子,在互联网孤岛化的趋势下,谋求蝇头小利,把不知道从哪倒腾来的资源打个压缩包,加个密码,就打算卖钱。
通常这个有密码的压缩包会和一个说明文件一同再被压缩一次,生成一个没有密码的压缩包,然后就在网上开始扩散。
当你下载了压缩包解开后,发现说明文件里指向一个链接,要求你付费获得密码,价格不算贵但也不便宜,一般都是9.9元。


如果是作者本人,开启了捐赠通道,我可能还会考虑一下,而对于这些二道贩子,钱是万万不可能付的。
破解流程
- 使用John the Ripper获取文件哈希(hash)
- 使用hashcat计算哈希(hash)获得密码
- 都得到密码了,该干嘛就干嘛去吧


准备工作
- 将John的run目录添加到环境变量path里,方便在其他地方通过命令行调用

将hashcat目录添加到环境变量path里,方便在其他地方通过命令行调用

- 实测hashcat依赖了当前目录的OpenCL目录,得进hashcat.exe的所在目录里运行

- hashcat需要使用GPU计算,假设你和我一样用的是NVIDIA显卡,那就按照要求去安装
"NVIDIA Driver" (440.64 or later) and "CUDA Toolkit" (9.0 or later)


- hashcat的参数在需要使用时再去查表




开始实操
- 自己创建一个带密码的压缩包

- 打开cmd或者powershell,输入
rar2john.exe .\test.rar
,也可以直接将结果保存至文件中rar2john.exe .\test.rar > test.hash

- 将
test.hash
内容中的文件名及冒号删除,保留其余部分

- 进入hashcat.exe所在的目录,使用hashcat对rar5类型的hash进行破解
1 | cd /d "D:\Programs\hashcat-6.2.6\" |
Options Short / Long | Type | Description | Example |
---|---|---|---|
-m, –hash-type | Num | Hash-type, references below (otherwise autodetect) | -m 1000 |
-w, –workload-profile | Num | Enable a specific workload profile, see pool below | -w 3 |
-a, –attack-mode | Num | Attack-mode, see references below | -a 3 |
–session | Str | Define specific session name | –session=mysession |
–restore | Restore session from –session | ||
-o, –outfile | File | Define outfile for recovered hash | -o outfile.txt |




- 耐心等待后,会获得结果,冒号后面的字符就是密码:
12341234

后记
怀念那个论坛盛行的年代,大家都是无私分享,感谢当年那些愿意无偿照顾小白的大神们。