Sha256: 5ff77b75041390d6f9e613329625c606615edd893aaa725a4df0ee2ca9de622f

Contents?: true

Size: 1.88 KB

Versions: 1

Compression:

Stored size: 1.88 KB

Contents

#!/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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
haiti-hash-2.1.0 bin/hashcat-haiti