【笔记】hashcat学习笔记
前言
hashcat is the world’s fastest and most advanced password recovery utility, supporting five unique modes of attack for over 300 highly-optimized hashing algorithms. hashcat currently supports CPUs, GPUs, and other hardware accelerators on Linux, Windows, and macOS, and has facilities to help enable distributed password cracking.(GitHub)
准备工作
直接下载二进制文件
手动编译
1 | git clone https://github.com/hashcat/hashcat.git |
基本命令
<hash>:hash值或包含多个hash值(每个值占一行)的文件<str>:掩码<dict>:(包含多个可能是明文的)字典文件(每个值占一行)
-m <num>:指定哈希类型
0:md5100:sha11000:NTLM,Windows登录密码5500:NetNTLMv1,Windows登录密码5600:NetNTLMv2,Windows登录密码1800:SHA512,Linux登录密码,$6$前缀7400:SHA256,Linux登录密码,$5$前缀500:MD5,Linux登录密码,$1$前缀3200:BlowFish,Linux登录密码,$2$前缀
更多类型参见帮助
-a <num>:指定破解模式
0:Straight,字典爆破1:Combination,将字典中密码进行组合3 <str>:Brute-force,使用指定掩码破解
?l:小写字母?u:大写字母?d:数字?s:特殊字符?a:小写字母、大写字母、数字、特殊字符组合?b:0x00-0xff
6:Hybrid Wordlist + Mask,字典+掩码破解7:Hybrid Mask + Wordlist,掩码+字典破解
-D <num>:指定OpenCL驱动
1:CPU2:GPU3:FPGA, DSP, Co-Processor
-V:显示版本-h:显示帮助-o <file>:输出到文件-b:测试计算机破解速度和相关硬件信息-T <num>:设置线程数
--show:展示成功破解的hash值及对应的明文--force:忽略警告--show:仅显示破解的hash值和明文--remove:从源文件删除破解成功的hash值--username:忽略hash表中的用户名--increment-min <num>:设置密码最小长度--increment-max <num>:设置密码最大长度
1 | hashcat -m 0 -a 3 <hash> <str> --show |
1 | hashcat -m 0 -a 0 <hash> <dict> --show |
1 | hashcat -m 0 -a 7 <hash> <str> <dict> --show |
- 暴力破解的结果会保存在生成的
hashcat.profile文件中
爆破rar5密文
通过rar2john获取密文
<file>:有密码的rar文件
1 | rar2john <file> |
通过hashcat爆破密文
<str>:通过rar2john获取的冒号后面的密文
1 | hashcat -m 13000 -a 3 '<str>' --increment-min 1 --increment-min 8 |
踩坑
- 报错:
No such file or directory
原因
- hashcat在运行时需要一个存放
hashcat.pid文件和hashcat.outfiles文件的目录,找不到所以报错
解决问题
- 手动创建hashcat需要的层级目录
<dir>:报错中提示找不到的目录结构
1 | mkdir -p <dir> |
踩坑
- 报错:
no matches found: ?d?d?d?d?d?d
解决问题
- MacOS上定义掩码时不加
?前缀,Windows上定义掩码时加?前缀