haiti-hash 1.5.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd592c70589060103cc205f32fadb24e09c5aa21467bc43f37c9ec6c10f543df
4
- data.tar.gz: 3062b9c1a82699502a94349404a62af27667f8456c7c6549ac7b2e00f7b5e363
3
+ metadata.gz: 1fcea45a6ae417a25dbd280f27fcdc55e515a3378486bae9d0092ed24a9efbf4
4
+ data.tar.gz: e47efec0dfa8a7ab15bada00c5ba4875722923c31d2fedf17bd09edf60e7a646
5
5
  SHA512:
6
- metadata.gz: f0508b249173ece824297cd7fd89464b94a51d4927121cf46c71c76f5d00af92aacb5ef1dee85e5c6495ed838fb33be6cd58ebc0b6654466dc9974a31e633b47
7
- data.tar.gz: abbaab41b018f76f45685f18c7b809c74a1e96c569c46eeccc0ec98c9ad771b7d0128c2566854b7fa51abaacef30ca490e06269553cbe87563c8c30fed9cd2f7
6
+ metadata.gz: d0f2588f566e48473014c19e90822afb0f4372c45d387bde6480dd1c99226fd35b9b546bfbf9861458763169f9a58e8d9841c9f8589cce96cd40bb6c0edc1c53
7
+ data.tar.gz: 1fae1ee5d9289ad83914809bdbc68f8531a7f7f99d71a28820edccb6a6c116fd3ee6b2b9ba527c5055efaaf2d4028f7c155daee2330eef96e551cdae490e2571
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2020-2022 Alexandre ZANNI (independent)
3
+ Copyright (c) 2020-2023 Alexandre ZANNI (independent)
4
4
  Copyright (c) 2019-2020 Alexandre ZANNI at Orange Cyberdefense
5
5
 
6
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
data/bin/haiti CHANGED
@@ -8,18 +8,21 @@ require 'haiti'
8
8
  require 'docopt'
9
9
  require 'paint'
10
10
 
11
+ # NOTE: `haiti [options] <hash>` needs to be after `list` and `samples`, else `list` is caught as a hash
11
12
  doc = <<~DOCOPT
12
13
  #{Paint['HAITI (HAsh IdenTifIer)', '#FF69B4']} v#{Paint[HashIdentifier::VERSION, :bold]}
13
14
 
14
15
  #{Paint['Usage:', '#00FFFF']}
15
- haiti [options] <hash>
16
+ haiti [options] list
16
17
  haiti samples (<ref> | <name>)
18
+ haiti [options] <hash>
17
19
  haiti --ascii-art
18
20
  haiti -h | --help
19
21
  haiti --version
20
22
 
21
23
  #{Paint['Commands:', '#00FFFF']}
22
24
  samples Display hash samples for the given type
25
+ list Display a list of all the available hash types
23
26
 
24
27
  #{Paint['Parameters:', '#00FFFF']}
25
28
  <hash> Hash string to identify, read from STDIN if equal to "-"
@@ -32,7 +35,7 @@ doc = <<~DOCOPT
32
35
  --short Display in a short format: do not display hashcat and john the ripper references
33
36
  --hashcat-only Show only hashcat references
34
37
  --john-only Show only john the ripper references
35
- --ascii-art Display the logo in colored ascii-art
38
+ --ascii-art Display the logo in colored ascii-art
36
39
  --debug Display arguments
37
40
  -h, --help Show this screen
38
41
  --version Show version
@@ -49,6 +52,18 @@ doc = <<~DOCOPT
49
52
  #{Paint['documentation', :underline]} (https://noraj.github.io/haiti)
50
53
  DOCOPT
51
54
 
55
+ # Shared option management logic for the identify and list command
56
+ def manage_options(args, types)
57
+ types.each do |type|
58
+ next if type.extended && !args['--extended']
59
+
60
+ print Paint[type.name, :bold]
61
+ print Paint[" [HC: #{type.hashcat}]", '#00FFFF'] unless type.hashcat.nil? || args['--short'] || args['--john-only']
62
+ print Paint[" [JtR: #{type.john}]", '#FF69B4'] unless type.john.nil? || args['--short'] || args['--hashcat-only']
63
+ puts
64
+ end
65
+ end
66
+
52
67
  begin
53
68
  args = Docopt.docopt(doc, version: HashIdentifier::VERSION)
54
69
  Paint.mode = 0 if args['--no-color']
@@ -61,22 +76,16 @@ begin
61
76
  puts 'Unknown hash type'
62
77
  exit(0)
63
78
  end
64
- hi.type.each do |type|
65
- next if type.extended && !args['--extended']
66
-
67
- print Paint[type.name, :bold]
68
- unless type.hashcat.nil? || args['--short'] || args['--john-only']
69
- print Paint[" [HC: #{type.hashcat}]", '#00FFFF']
70
- end
71
- print Paint[" [JtR: #{type.john}]", '#FF69B4'] unless type.john.nil? || args['--short'] || args['--hashcat-only']
72
- puts
73
- end
79
+ manage_options(args, hi.type)
74
80
  elsif args['samples']
75
81
  input = args['<ref>'] || args['<name>']
76
82
  samples = HashIdentifier.samples(input)
77
83
  samples.each do |sample|
78
84
  puts sample
79
85
  end
86
+ elsif args['list']
87
+ types = HashIdentifier.object_list
88
+ manage_options(args, types)
80
89
  elsif args['--ascii-art']
81
90
  puts File.read(File.join(__dir__, '../docs/_media/logo.ascii'))
82
91
  end
data/bin/haiti-fzf ADDED
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # Ruby internal
5
+ # Project internal
6
+ require 'haiti'
7
+ # External
8
+ require 'docopt'
9
+ require 'paint'
10
+
11
+ doc = <<~DOCOPT
12
+ #{Paint['HAITI (HAsh IdenTifIer)', '#FF69B4']} v#{Paint[HashIdentifier::VERSION, :bold]}
13
+
14
+ #{Paint['Usage:', '#00FFFF']}
15
+ haiti-fzf hc [options] <hash>
16
+ haiti-fzf jtr [options] <hash>
17
+ haiti-fzf -h | --help
18
+ haiti-fzf --version
19
+
20
+ #{Paint['Commands:', '#00FFFF']}
21
+ hc Select a Hashcat reference with fzf from one of the matching hash types
22
+ jtr Select a John the Ripper reference with fzf from one of the matching hash types
23
+
24
+ #{Paint['Parameters:', '#00FFFF']}
25
+ <hash> Hash string to identify, read from STDIN if equal to "-"
26
+
27
+ #{Paint['Options:', '#00FFFF']}
28
+ -e, --extended List all possible hash algorithms including ones using salt
29
+ --debug Display arguments
30
+ -h, --help Show this screen
31
+ --version Show version
32
+
33
+ #{Paint['Examples:', '#00FFFF']}
34
+ haiti-fzf hc -e d41d8cd98f00b204e9800998ecf8427e
35
+ haiti-fzf jtr d41d8cd98f00b204e9800998ecf8427e
36
+
37
+ #{Paint['Project:', '#00FFFF']}
38
+ #{Paint['author', :underline]} (https://pwn.by/noraj / https://twitter.com/noraj_rawsec)
39
+ #{Paint['source', :underline]} (https://github.com/noraj/haiti)
40
+ #{Paint['documentation', :underline]} (https://noraj.github.io/haiti)
41
+ DOCOPT
42
+
43
+ begin
44
+ args = Docopt.docopt(doc, version: HashIdentifier::VERSION)
45
+ puts args if args['--debug']
46
+ # use case 1, using the tool
47
+ if args['<hash>']
48
+ args['<hash>'] = $stdin.read.chomp if args['<hash>'] == '-'
49
+ ext = args['--extended'] ? '-e' : ''
50
+ system("haiti-parsable hc #{ext} #{args['<hash>']} | fzf | cut -d '|' -f 2") if args['hc']
51
+ system("haiti-parsable jtr #{ext} #{args['<hash>']} | fzf | cut -d '|' -f 2") if args['jtr']
52
+ end
53
+ # use case 2, help: already handled by docopt
54
+ # use case 3, version: already handled by docopt
55
+ rescue Docopt::Exit => e
56
+ puts e.message
57
+ end
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # Ruby internal
5
+ # Project internal
6
+ require 'haiti'
7
+ # External
8
+ require 'docopt'
9
+ require 'paint'
10
+
11
+ doc = <<~DOCOPT
12
+ #{Paint['HAITI (HAsh IdenTifIer)', '#FF69B4']} v#{Paint[HashIdentifier::VERSION, :bold]}
13
+
14
+ #{Paint['Usage:', '#00FFFF']}
15
+ haiti-parsable hc [options] <hash>
16
+ haiti-parsable jtr [options] <hash>
17
+ haiti-parsable -h | --help
18
+ haiti-parsable --version
19
+
20
+ #{Paint['Commands:', '#00FFFF']}
21
+ hc Display hash types matching that have a Hashcat reference
22
+ jtr Display hash types matching that have a John the Ripper reference
23
+
24
+ #{Paint['Parameters:', '#00FFFF']}
25
+ <hash> Hash string to identify, read from STDIN if equal to "-"
26
+
27
+ #{Paint['Options:', '#00FFFF']}
28
+ -e, --extended List all possible hash algorithms including ones using salt
29
+ --debug Display arguments
30
+ -h, --help Show this screen
31
+ --version Show version
32
+
33
+ #{Paint['Examples:', '#00FFFF']}
34
+ haiti-parsable hc -e d41d8cd98f00b204e9800998ecf8427e
35
+ haiti-parsable jtr d41d8cd98f00b204e9800998ecf8427e
36
+
37
+ #{Paint['Project:', '#00FFFF']}
38
+ #{Paint['author', :underline]} (https://pwn.by/noraj / https://twitter.com/noraj_rawsec)
39
+ #{Paint['source', :underline]} (https://github.com/noraj/haiti)
40
+ #{Paint['documentation', :underline]} (https://noraj.github.io/haiti)
41
+ DOCOPT
42
+
43
+ def manage_options(args, types)
44
+ types.each do |type|
45
+ next if type.extended && !args['--extended']
46
+
47
+ puts "#{type.name} |#{type.hashcat}" if args['hc'] && !type.hashcat.nil?
48
+ puts "#{type.name} |#{type.john}" if args['jtr'] && !type.john.nil?
49
+ end
50
+ end
51
+
52
+ begin
53
+ args = Docopt.docopt(doc, version: HashIdentifier::VERSION)
54
+ puts args if args['--debug']
55
+ # use case 1, using the tool
56
+ if args['<hash>']
57
+ args['<hash>'] = $stdin.read.chomp if args['<hash>'] == '-'
58
+ hi = HashIdentifier.new(args['<hash>'])
59
+ if hi.type.empty?
60
+ puts 'Unknown hash type'
61
+ exit(0)
62
+ end
63
+ manage_options(args, hi.type)
64
+ end
65
+ # use case 2, help: already handled by docopt
66
+ # use case 3, version: already handled by docopt
67
+ rescue Docopt::Exit => e
68
+ puts e.message
69
+ end
data/bin/hashcat-haiti ADDED
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # Ruby internal
5
+ # Project internal
6
+ require 'haiti'
7
+ # External
8
+ require 'docopt'
9
+ require 'paint'
10
+
11
+ doc = <<~DOCOPT
12
+ #{Paint['HAITI (HAsh IdenTifIer)', '#FF69B4']} v#{Paint[HashIdentifier::VERSION, :bold]}
13
+
14
+ #{Paint['Usage:', '#00FFFF']}
15
+ hashcat-haiti [options] <hash> -- <hashcat_options>...
16
+ hashcat-haiti -h | --help
17
+ hashcat-haiti --version
18
+
19
+ #{Paint['Parameters:', '#00FFFF']}
20
+ <hash> Hash string to identify, read from STDIN if equal to "-"
21
+
22
+ #{Paint['Options:', '#00FFFF']}
23
+ -e, --extended List all possible hash algorithms including ones using salt
24
+ --debug Display arguments
25
+ -h, --help Show this screen
26
+ --version Show version
27
+
28
+ #{Paint['Examples:', '#00FFFF']}
29
+ hashcat-haiti -e d41d8cd98f00b204e9800998ecf8427e -- hashes.txt /usr/share/wordlists/passwords/rockyou.txt -r /usr/share/doc/hashcat/rules/best64.rule
30
+ hashcat-haiti d41d8cd98f00b204e9800998ecf8427e -- hashes.txt -a 3
31
+ head -1 /tmp/hash.txt | hashcat-haiti - -- /tmp/hash.txt
32
+ hashcat-haiti -e d41d8cd98f00b204e9800998ecf8427e -- hashes.txt --show
33
+
34
+ #{Paint['Project:', '#00FFFF']}
35
+ #{Paint['author', :underline]} (https://pwn.by/noraj / https://twitter.com/noraj_rawsec)
36
+ #{Paint['source', :underline]} (https://github.com/noraj/haiti)
37
+ #{Paint['documentation', :underline]} (https://noraj.github.io/haiti)
38
+ DOCOPT
39
+
40
+ begin
41
+ args = Docopt.docopt(doc, version: HashIdentifier::VERSION)
42
+ puts args if args['--debug']
43
+ # use case 1, using the tool
44
+ if args['<hash>']
45
+ args['<hash>'] = $stdin.read.chomp if args['<hash>'] == '-'
46
+ ext = args['--extended'] ? '-e' : ''
47
+ system("hashcat -m $(haiti-fzf hc #{ext} #{args['<hash>']}) #{args['<hashcat_options>'].join(' ')}")
48
+ end
49
+ # use case 2, help: already handled by docopt
50
+ # use case 3, version: already handled by docopt
51
+ rescue Docopt::Exit => e
52
+ puts e.message
53
+ end
data/bin/john-haiti ADDED
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # Ruby internal
5
+ # Project internal
6
+ require 'haiti'
7
+ # External
8
+ require 'docopt'
9
+ require 'paint'
10
+
11
+ doc = <<~DOCOPT
12
+ #{Paint['HAITI (HAsh IdenTifIer)', '#FF69B4']} v#{Paint[HashIdentifier::VERSION, :bold]}
13
+
14
+ #{Paint['Usage:', '#00FFFF']}
15
+ john-haiti [options] <hash> -- <john_options>...
16
+ john-haiti -h | --help
17
+ john-haiti --version
18
+
19
+ #{Paint['Parameters:', '#00FFFF']}
20
+ <hash> Hash string to identify, read from STDIN if equal to "-"
21
+
22
+ #{Paint['Options:', '#00FFFF']}
23
+ -e, --extended List all possible hash algorithms including ones using salt
24
+ --debug Display arguments
25
+ -h, --help Show this screen
26
+ --version Show version
27
+
28
+ #{Paint['Examples:', '#00FFFF']}
29
+ john-haiti -e d41d8cd98f00b204e9800998ecf8427e -- hashes.txt --wordlist=/usr/share/wordlists/passwords/rockyou.txt
30
+ john-haiti 1f474c6dadb3cb2370f6cb88d4576ede0db9ff43 -- hashes.txt --rules=NT --fork=3
31
+ head -1 /tmp/hash.txt | john-haiti - -- /tmp/hash.txt
32
+ john-haiti -e d41d8cd98f00b204e9800998ecf8427e -- hashes.txt --show
33
+
34
+ #{Paint['Project:', '#00FFFF']}
35
+ #{Paint['author', :underline]} (https://pwn.by/noraj / https://twitter.com/noraj_rawsec)
36
+ #{Paint['source', :underline]} (https://github.com/noraj/haiti)
37
+ #{Paint['documentation', :underline]} (https://noraj.github.io/haiti)
38
+ DOCOPT
39
+
40
+ begin
41
+ args = Docopt.docopt(doc, version: HashIdentifier::VERSION)
42
+ puts args if args['--debug']
43
+ # use case 1, using the tool
44
+ if args['<hash>']
45
+ args['<hash>'] = $stdin.read.chomp if args['<hash>'] == '-'
46
+ ext = args['--extended'] ? '-e' : ''
47
+ system("john --format=$(haiti-fzf jtr #{ext} #{args['<hash>']}) #{args['<john_options>'].join(' ')}")
48
+ end
49
+ # use case 2, help: already handled by docopt
50
+ # use case 3, version: already handled by docopt
51
+ rescue Docopt::Exit => e
52
+ puts e.message
53
+ end
data/data/commons.json CHANGED
@@ -1,30 +1,31 @@
1
1
  [
2
- "MD5",
3
- "SHA-1",
4
- "SHA-256",
5
- "SHA-512",
6
- "bcrypt",
7
- "NTLM",
8
- "NT",
9
- "NetNTLMv2",
10
- "NetNTLMv1-VANILLA / NetNTLMv1+ESS",
11
- "BLAKE2-512",
12
- "SHA3-224",
13
- "SHA3-256",
14
- "SHA3-512",
15
- "Keccak-256",
16
- "Keccak-512",
17
- "CRC-32B",
18
- "CRC-32",
19
- "CRC-16",
20
- "CRC-64",
21
- "GOST R 34.11-94",
22
- "Apache MD5",
23
- "MD5(APR)",
24
- "md5apr1",
25
- "Domain Cached Credentials",
26
- "Domain Cached Credentials 2",
27
- "LM",
28
- "RIPEMD-160",
29
- "scrypt"
2
+ "MD5",
3
+ "SHA-1",
4
+ "SHA-256",
5
+ "SHA-512",
6
+ "bcrypt",
7
+ "NTLM",
8
+ "NetNTLMv2 (vanilla)",
9
+ "NetNTLMv2 (NT)",
10
+ "NetNTLMv1 / NetNTLMv1+ESS (vanilla)",
11
+ "NetNTLMv1 / NetNTLMv1+ESS (NT)",
12
+ "BLAKE2-512 (blake2b)",
13
+ "SHA3-224",
14
+ "SHA3-256",
15
+ "SHA3-512",
16
+ "Keccak-256",
17
+ "Keccak-512",
18
+ "CRC-32B",
19
+ "CRC-32",
20
+ "CRC-16",
21
+ "CRC-64",
22
+ "GOST R 34.11-94",
23
+ "Apache MD5",
24
+ "MD5 (APR)",
25
+ "md5apr1",
26
+ "Domain Cached Credentials (DCC), MS Cache",
27
+ "Domain Cached Credentials 2 (DCC2), MS Cache 2",
28
+ "LM",
29
+ "RIPEMD-160",
30
+ "scrypt"
30
31
  ]