-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix #168
- Loading branch information
Showing
5 changed files
with
243 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/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']} | ||
haiti-fzf hc [options] <hash> | ||
haiti-fzf jtr [options] <hash> | ||
haiti-fzf -h | --help | ||
haiti-fzf --version | ||
#{Paint['Commands:', '#00FFFF']} | ||
hc Select a Hashcat reference with fzf from one of the matching hash types | ||
jtr Select a John the Ripper reference with fzf from one of the matching hash types | ||
#{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']} | ||
haiti-fzf hc -e d41d8cd98f00b204e9800998ecf8427e | ||
haiti-fzf jtr d41d8cd98f00b204e9800998ecf8427e | ||
#{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("haiti-parsable hc #{ext} #{args['<hash>']} | fzf | cut -d '|' -f 2") if args['hc'] | ||
system("haiti-parsable jtr #{ext} #{args['<hash>']} | fzf | cut -d '|' -f 2") if args['jtr'] | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/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']} | ||
haiti-parsable hc [options] <hash> | ||
haiti-parsable jtr [options] <hash> | ||
haiti-parsable -h | --help | ||
haiti-parsable --version | ||
#{Paint['Commands:', '#00FFFF']} | ||
hc Display hash types matching that have a Hashcat reference | ||
jtr Display hash types matching that have a John the Ripper reference | ||
#{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']} | ||
haiti-parsable hc -e d41d8cd98f00b204e9800998ecf8427e | ||
haiti-parsable jtr d41d8cd98f00b204e9800998ecf8427e | ||
#{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 | ||
|
||
def manage_options(args, types) | ||
types.each do |type| | ||
next if type.extended && !args['--extended'] | ||
|
||
puts "#{type.name} |#{type.hashcat}" if args['hc'] && !type.hashcat.nil? | ||
puts "#{type.name} |#{type.john}" if args['jtr'] && !type.john.nil? | ||
end | ||
end | ||
|
||
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>'] == '-' | ||
hi = HashIdentifier.new(args['<hash>']) | ||
if hi.type.empty? | ||
puts 'Unknown hash type' | ||
exit(0) | ||
end | ||
manage_options(args, hi.type) | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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']} | ||
john-haiti [options] <hash> -- <john_options>... | ||
john-haiti -h | --help | ||
john-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']} | ||
john-haiti -e d41d8cd98f00b204e9800998ecf8427e -- hashes.txt --wordlist=/usr/share/wordlists/passwords/rockyou.txt | ||
john-haiti 1f474c6dadb3cb2370f6cb88d4576ede0db9ff43 -- hashes.txt --rules=NT --fork=3 | ||
head -1 /tmp/hash.txt | john-haiti - -- /tmp/hash.txt | ||
john-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("john --format=$(haiti-fzf jtr #{ext} #{args['<hash>']}) #{args['<john_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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters