在Windows上编译最新版本的Hashcat

最新版本V5.0.0下载地址:

可执行程序:https://hashcat.net/files/hashcat-5.0.0.7z

源代码:https://hashcat.net/files/hashcat-5.0.0.tar.gz

开发版:github.com/hashcat/hashcat

GPU驱动要求:

  • AMD GPUs on Linux require “RadeonOpenCompute (ROCm)” Software Platform (1.6.180 or later)
  • AMD GPUs on Windows require “AMD Radeon Software Crimson Edition” (15.12 or later)
  • Intel CPUs require “OpenCL Runtime for Intel Core and Intel Xeon Processors” (16.1.1 or later)
  • Intel GPUs on Linux require “OpenCL 2.0 GPU Driver Package for Linux” (2.0 or later)
  • Intel GPUs on Windows require “OpenCL Driver for Intel Iris and Intel HD Graphics”
  • NVIDIA GPUs require “NVIDIA Driver” (367.x or later)

新特性(官方加粗显示突出特性)

  • World’s fastest password cracker
  • World’s first and only in-kernel rule engine
  • Free (软件可以免费使用)
  • Open-Source (MIT License)  (程序源代码公开)
  • Multi-OS (Linux, Windows and macOS)
  • Multi-Platform (CPU, GPU, DSP, FPGA, etc., everything that comes with an OpenCL runtime)
  • Multi-Hash (Cracking multiple hashes at the same time)
  • Multi-Devices (Utilizing multiple devices in same system)
  • Multi-Device-Types (Utilizing mixed device types in same system)
  • Supports password candidate brain functionality
  • Supports distributed cracking networks (using overlay) (支持分布式网络离散破解)
  • Supports interactive pause / resume   (交互式的暂停和重启)
  • Supports sessions
  • Supports restore
  • Supports reading password candidates from file and stdin
  • Supports hex-salt and hex-charset
  • Supports automatic performance tuning  (自动化的性能调优)
  • Supports automatic keyspace ordering markov-chains
  • Built-in benchmarking system
  • Integrated thermal watchdog (完整的日志输出流)
  • 200+ Hash-types implemented with performance in mind
  • … and much more

wget https://hashcat.net/files/hashcat-5.0.0.tar.gz

或者git clone github.com/hashcat/hashcat  下载源代码。

一、下载编译软件Msys2

32位版本:http://repo.msys2.org/distrib/i686/msys2-i686-20180531.exe

64位版本:http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20180531.exe

配置软件软件源。

32位软件安装源头:配置文件D:\msys64\etc\pacman.d\mirrorlist.mingw32内容如下:

##
## 32-bit Mingw-w64 repository mirrorlist
##

## Primary
## msys2.org
Server = http://mirrors.ustc.edu.cn/msys2/mingw/i686/
Server = http://repo.msys2.org/mingw/i686/
Server = https://sourceforge.net/projects/msys2/files/REPOS/MINGW/i686/
Server = http://www2.futureware.at/~nickoe/msys2-mirror/mingw/i686/
Server = https://mirror.yandex.ru/mirrors/msys2/mingw/i686/

64位软件安装源头:配置文件D:\msys64\etc\pacman.d\mirrorlist.mingw64内容如下:

##
## 64-bit Mingw-w64 repository mirrorlist
##

## Primary
## msys2.org
Server = http://mirrors.ustc.edu.cn/msys2/mingw/x86_64/
Server = http://repo.msys2.org/mingw/x86_64/
Server = https://sourceforge.net/projects/msys2/files/REPOS/MINGW/x86_64/
Server = http://www2.futureware.at/~nickoe/msys2-mirror/mingw/x86_64/
Server = https://mirror.yandex.ru/mirrors/msys2/mingw/x86_64/

系统软件安装源:配置文件D:\msys64\etc\pacman.d\mirrorlist.mingw内容如下:

##
## MSYS2 repository mirrorlist
##

## Primary
## msys2.org
Server = http://mirrors.ustc.edu.cn/msys2/msys/$arch/
Server = http://repo.msys2.org/msys/$arch/
Server = https://sourceforge.net/projects/msys2/files/REPOS/MSYS2/$arch/
Server = http://www2.futureware.at/~nickoe/msys2-mirror/msys/$arch/
Server = https://mirror.yandex.ru/mirrors/msys2/msys/$arch/

打开 mingw32.exe ,运行以下命令。

pacman -Syu
pacman -S mingw-w64-i686-gcc
pacman -S make git patch
pacman -S mingw-w64-i686-cmake
pacman -S mingw-w64-i686-pkg-config

打开mingw64.exe,运行以下命令。

pacman -Syu
pacman -S mingw-w64-x86_64-gcc
pacman -S mingw-w64-x86_64-cmake
pacman -S mingw-w64-x86_64-pkg-config

二、编译win-iconv

打开mingw32.exe,(编译32位程序)

下载源代码:git clone http://github.com/win-iconv/win-iconv

在hashcat\tools目录下有两个补丁文件win-iconv-32.diff和win-iconv-64.diff,分别对应patch相对应的32位和64位的Makefile。

#cd win-iconv

#patch <../hashcat/tools/win-iconv-32.diff

#make -j4

报错信息如下:

make:i686-w64-mingw32-ar:命令未找到
make: *** [Makefile:40:libiconv.a] 错误 127

这是因为在msys2中i686-w64-mingw32-ar这个命令不存在,正确的命令应该是

i686-w64-mingw32-gcc-ar,

将makefile中的i686-w64-mingw32-ar改成i686-w64-mingw32-gcc-ar。

将i686-w64-mingw32-ranlib改成i686-w64-mingw32-gcc-ranlib。

i686-w64-mingw32-dlltool这个程序也不存在,我们可以通过Pacman的搜索功能来过滤这个程序所在的软件包binutils,查看目前需要的32位版本是否安装。

$ pacman -Ss binutils
mingw32/mingw-w64-i686-binutils 2.30-5 (mingw-w64-i686-toolchain) [已安装: 2.31.1-2]
A set of programs to assemble and manipulate binary and object files (mingw-w64)
mingw64/mingw-w64-x86_64-binutils 2.30-5 (mingw-w64-x86_64-toolchain) [已安装: 2.31.1-2]
A set of programs to assemble and manipulate binary and object files (mingw-w64)
msys/binutils 2.30-1 (msys2-devel)
A set of programs to assemble and manipulate binary and object files
msys/mingw-w64-cross-binutils 2.30-1 (mingw-w64-cross-toolchain mingw-w64-cross)
A set of programs to assemble and manipulate binary and object files

使用pacman -Ql mingw-w64-i686-binutils这个命令来查询软件包文件的路径。

将Makefile中的i686-w64-mingw32-dlltool改成/mingw32/i686-w64-mingw32/bin/dlltool.exe,

将Makefile中prefix ?= /usr/bin改成prefix ?= /opt/win-iconv-32。

重新Make,编译通过,然后使用make install命令安装程序到指定目录。

#cd ../hashcat

#make win32   编译32位版本的Hashcat,编译64位hashcat时请参考32编译流程,本文将不再赘述。

运行Hashcat使用GPU破解需要安装相应的显卡驱动程序。

linux驱动下载地址:https://software.intel.com/en-us/articles/opencl-drivers#latest_linux_driver

Windows驱动下载地址:

A卡:http://support.amd.com/en-us/download/auto-detect-tool

N卡:https://www.nvidia.cn/Download/index.aspx?lang=cn

安装驱动遇到的问题:https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#how_does_one_install_the_correct_driver_for_the_gpu_s

使用方法参考:https://www.freebuf.com/sectool/164507.html

(1)字典攻击

-a 0 password.lst

(2)1到8为数字掩码攻击

-a 3 --increment --increment-min 1--increment-max 8 ?d?d?d?d?d?d?d?d –O
hashcat64 -a 3 --increment --increment-min 1 --increment-max 8 password.txt ?d?d?d?d?d?d?d?d -O --show

hashcat64 -a 3 –increment –increment-min 4 –increment-max 8 -o result.txt 00c66aaf5f2c3f49946f15c1ad2ea0d3 ?d?d?d?d?d?d?d?d -O

hashcat64 -a 3 –increment –increment-min 7 –increment-max 11 password.txt -o result.txt ?d?d?d?d?d?d?d?d?d?d?d?d -O

?d代表数字,可以换成小写字母?l,大写字母?u,特殊字符?s,大小写字母+特殊字符?a,–O表示最优化破解模式,可以加该参数,也可以不加该参数。

(3)8为数字攻击

-a 3 ?d?d?d?d?d?d?d?d

同理可以根据位数设置为字母大写、小写、特殊字符等模式。

(4)自定义字符

现在纯数字或者纯字母的密码是比较少见的,根据密码专家对泄漏密码的分析,90%的个人密码是字母和数字的组合,可以是自定义字符了来进行暴力破解,Hashcat支持4个自定义字符集,分别是 -1 -2 -3 -4。定义时只需要这样-2  ?l?d ,然后就可以在后面指定?2,?2表示小写字母和数字。这时候要破解一个8位混合的小写字母加数字:

Hashcat.exe -a 3 –force -2 ?l?d  hassh值或者hash文件  ?2?2?2?2?2?2?2?2

例如破解dz小写字母+数字混合8位密码破解:

Hashcat -m 2611  -a 3 -2 ?l?d  dz.hash    ?2?2?2?2?2?2?2?2

(5)字典+掩码暴力破解

Hashcat还支持一种字典加暴力的破解方法,就是在字典前后再加上暴力的字符序列,比如在字典后面加上3为数字,这种密码是很常见的。使用第六种攻击模式:

   a-6 (Hybrid dict + mask)

如果是在字典前面加则使用第7中攻击模式也即( a-7 = Hybridmask + dict),下面对字典文件加数字123进行破解:

H.exe -a 6 ffe1cb31eb084cd7a8dd1228c23617c8  password.lst ?d?d?d

假如ffe1cb31eb084cd7a8dd1228c23617c8的密码为password123,则只要password.lst包含123即可。

(6)掩码+字典暴力破解

H.exe -a 7  ffe1cb31eb084cd7a8dd1228c23617c8  password.lst ?d?d?d

假如ffe1cb31eb084cd7a8dd1228c23617c8的密码为123password,则只要password.lst包含password即可。

(7)大小写转换攻击,对password.lst中的单词进行大小写转换攻击

H.exe-a 2  ffe1cb31eb084cd7a8dd1228c23617c8  password.lst
posted @ 2019-01-21 15:10  heycomputer  阅读(5708)  评论(0编辑  收藏  举报