-
-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathhashcat-haiti
executable file
·53 lines (45 loc) · 1.88 KB
/
hashcat-haiti
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env ruby
# frozen_string_literal: true
# Ruby internal
# Project internal
require 'haiti'
# External
require 'docopt'
require 'paint'
doc = <<~DOCOPT
#{Paint['HAITI (HAsh IdenTifIer)', '#FF69B4']} v#{Paint[HashIdentifier::VERSION, :bold]}
#{Paint['Usage:', '#00FFFF']}
hashcat-haiti [options] <hash> -- <hashcat_options>...
hashcat-haiti -h | --help
hashcat-haiti --version
#{Paint['Parameters:', '#00FFFF']}
<hash> Hash string to identify, read from STDIN if equal to "-"
#{Paint['Options:', '#00FFFF']}
-e, --extended List all possible hash algorithms including ones using salt
--debug Display arguments
-h, --help Show this screen
--version Show version
#{Paint['Examples:', '#00FFFF']}
hashcat-haiti -e d41d8cd98f00b204e9800998ecf8427e -- hashes.txt /usr/share/wordlists/passwords/rockyou.txt -r /usr/share/doc/hashcat/rules/best64.rule
hashcat-haiti d41d8cd98f00b204e9800998ecf8427e -- hashes.txt -a 3
head -1 /tmp/hash.txt | hashcat-haiti - -- /tmp/hash.txt
hashcat-haiti -e d41d8cd98f00b204e9800998ecf8427e -- hashes.txt --show
#{Paint['Project:', '#00FFFF']}
#{Paint['author', :underline]} (https://pwn.by/noraj / https://twitter.com/noraj_rawsec)
#{Paint['source', :underline]} (https://github.com/noraj/haiti)
#{Paint['documentation', :underline]} (https://noraj.github.io/haiti)
DOCOPT
begin
args = Docopt.docopt(doc, version: HashIdentifier::VERSION)
puts args if args['--debug']
# use case 1, using the tool
if args['<hash>']
args['<hash>'] = $stdin.read.chomp if args['<hash>'] == '-'
ext = args['--extended'] ? '-e' : ''
system("hashcat -m $(haiti-fzf hc #{ext} #{args['<hash>']}) #{args['<hashcat_options>'].join(' ')}")
end
# use case 2, help: already handled by docopt
# use case 3, version: already handled by docopt
rescue Docopt::Exit => e
puts e.message
end