haiti-hash 1.5.0 → 2.0.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: f7b5955de5a61d1e1ab59d2d6e09ca4c4be5f55b945cbf5cf587a8cfa3667d51
4
+ data.tar.gz: 033f766ccc4d8d1795176e55994472ce965bb4360382f8f3decd93d8044a8c43
5
5
  SHA512:
6
- metadata.gz: f0508b249173ece824297cd7fd89464b94a51d4927121cf46c71c76f5d00af92aacb5ef1dee85e5c6495ed838fb33be6cd58ebc0b6654466dc9974a31e633b47
7
- data.tar.gz: abbaab41b018f76f45685f18c7b809c74a1e96c569c46eeccc0ec98c9ad771b7d0128c2566854b7fa51abaacef30ca490e06269553cbe87563c8c30fed9cd2f7
6
+ metadata.gz: c96dd859d8a3d256891002bdfce1903978da263bc1405e18f07b4fc9ee42c2c3163cdc3783593d20e2a5f5a5798b79c425341a0ffd99910d75a5217c6e3a08ee
7
+ data.tar.gz: a1346e64b98974aa355efe105f1225d0f993f3c515ff5c65ab3e404ce24b7d0f39b98c0b32d322ca2e76240c0c460db64feace71714c8ad12c3d982737a574d4
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/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
  ]