diff --git a/bin/haiti-fzf b/bin/haiti-fzf new file mode 100755 index 0000000..a581a53 --- /dev/null +++ b/bin/haiti-fzf @@ -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] + haiti-fzf jtr [options] + 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 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[''] + args[''] = $stdin.read.chomp if args[''] == '-' + ext = args['--extended'] ? '-e' : '' + system("haiti-parsable hc #{ext} #{args['']} | fzf | cut -d '|' -f 2") if args['hc'] + system("haiti-parsable jtr #{ext} #{args['']} | 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 diff --git a/bin/haiti-parsable b/bin/haiti-parsable new file mode 100755 index 0000000..f7ca20c --- /dev/null +++ b/bin/haiti-parsable @@ -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] + haiti-parsable jtr [options] + 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 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[''] + args[''] = $stdin.read.chomp if args[''] == '-' + hi = HashIdentifier.new(args['']) + 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 diff --git a/bin/hashcat-haiti b/bin/hashcat-haiti new file mode 100755 index 0000000..7518ee2 --- /dev/null +++ b/bin/hashcat-haiti @@ -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] -- ... + hashcat-haiti -h | --help + hashcat-haiti --version + + #{Paint['Parameters:', '#00FFFF']} + 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[''] + args[''] = $stdin.read.chomp if args[''] == '-' + ext = args['--extended'] ? '-e' : '' + system("hashcat -m $(haiti-fzf hc #{ext} #{args['']}) #{args[''].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 diff --git a/bin/john-haiti b/bin/john-haiti new file mode 100755 index 0000000..07c7464 --- /dev/null +++ b/bin/john-haiti @@ -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] -- ... + john-haiti -h | --help + john-haiti --version + + #{Paint['Parameters:', '#00FFFF']} + 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[''] + args[''] = $stdin.read.chomp if args[''] == '-' + ext = args['--extended'] ? '-e' : '' + system("john --format=$(haiti-fzf jtr #{ext} #{args['']}) #{args[''].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 diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 29bf0ba..cd44c7a 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,16 @@ ## [unreleased] +## [2.1.0] + +- **Additions**: + - 4 new binaries + - `hashcat-haiti`: wrapper for Hashcat where you can select the mode using haiti and fzf + - `john-haiti`: wrapper for John the Ripper where you can select the format using haiti and fzf + - `haiti-fzf`: select a Hashcat or John the Ripper reference with fzf from one of the matching hash types + - mostly useful for `hashcat-haiti` and `john-haiti` or building another binary or alias that will make use of haiti with fzf input + - `haiti-parsable`: display hash types matching that have a Hashcat reference in an easily parsable format + - mostly useful for `haiti-fzf` or building another binary or alias + ## [2.0.0] - **Breaking changes**: