haiti-hash 1.4.1 → 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: c8666ca33015b9d177521ed2dbf2c57cf4d5d368916448acae67b0709b08e54d
4
- data.tar.gz: 6c623a158e316ecdb438d8e470614dbd152e59620954ca697d8e74681095b0e5
3
+ metadata.gz: f7b5955de5a61d1e1ab59d2d6e09ca4c4be5f55b945cbf5cf587a8cfa3667d51
4
+ data.tar.gz: 033f766ccc4d8d1795176e55994472ce965bb4360382f8f3decd93d8044a8c43
5
5
  SHA512:
6
- metadata.gz: e668334fd140646b1a64df1ecec7353a5111d8fa9873888bbad88f8420fbeda50b08abb97ef53ac901c6bf3c0d6a87d1171df32d12b1b4869e20c5a94d9a92fc
7
- data.tar.gz: 36eba5ecad7673002acc91d1c3230ecca973bf1257a1aa3e2932433fd1cc83ac7fc574bc132e6818c7c6e2ca84069fee03b6fae22d59d84b120e2cc712f86aeb
6
+ metadata.gz: c96dd859d8a3d256891002bdfce1903978da263bc1405e18f07b4fc9ee42c2c3163cdc3783593d20e2a5f5a5798b79c425341a0ffd99910d75a5217c6e3a08ee
7
+ data.tar.gz: a1346e64b98974aa355efe105f1225d0f993f3c515ff5c65ab3e404ce24b7d0f39b98c0b32d322ca2e76240c0c460db64feace71714c8ad12c3d982737a574d4
data/bin/haiti CHANGED
@@ -2,51 +2,72 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  # Ruby internal
5
- require 'pp'
6
5
  # Project internal
7
6
  require 'haiti'
8
7
  # External
9
8
  require 'docopt'
10
9
  require 'paint'
11
10
 
11
+ # NOTE: `haiti [options] <hash>` needs to be after `list` and `samples`, else `list` is caught as a hash
12
12
  doc = <<~DOCOPT
13
- HAITI (HAsh IdenTifIer) v#{HashIdentifier::VERSION}
13
+ #{Paint['HAITI (HAsh IdenTifIer)', '#FF69B4']} v#{Paint[HashIdentifier::VERSION, :bold]}
14
14
 
15
- Usage:
16
- haiti [options] <hash>
15
+ #{Paint['Usage:', '#00FFFF']}
16
+ haiti [options] list
17
17
  haiti samples (<ref> | <name>)
18
+ haiti [options] <hash>
19
+ haiti --ascii-art
18
20
  haiti -h | --help
19
21
  haiti --version
20
22
 
21
- Commands:
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
- Parameters:
27
+ #{Paint['Parameters:', '#00FFFF']}
25
28
  <hash> Hash string to identify, read from STDIN if equal to "-"
26
29
  <ref> hashcat or john the ripper reference
27
30
  <name> Hash type name
28
31
 
29
- Options:
30
- --no-color Disable colorized output
32
+ #{Paint['Options:', '#00FFFF']}
33
+ --no-color Disable colorized output (NO_COLOR environment variable is respected too)
31
34
  -e, --extended List all possible hash algorithms including ones using salt
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
38
+ --ascii-art Display the logo in colored ascii-art
35
39
  --debug Display arguments
36
40
  -h, --help Show this screen
37
41
  --version Show version
38
42
 
39
- Examples:
43
+ #{Paint['Examples:', '#00FFFF']}
40
44
  haiti -e d41d8cd98f00b204e9800998ecf8427e
41
45
  haiti --no-color --short d41d8cd98f00b204e9800998ecf8427e
42
46
  b2sum /etc/os-release | awk '{print $1}' | haiti -
43
47
  haiti samples crc32
48
+
49
+ #{Paint['Project:', '#00FFFF']}
50
+ #{Paint['author', :underline]} (https://pwn.by/noraj / https://twitter.com/noraj_rawsec)
51
+ #{Paint['source', :underline]} (https://github.com/noraj/haiti)
52
+ #{Paint['documentation', :underline]} (https://noraj.github.io/haiti)
44
53
  DOCOPT
45
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
+
46
67
  begin
47
68
  args = Docopt.docopt(doc, version: HashIdentifier::VERSION)
48
69
  Paint.mode = 0 if args['--no-color']
49
- pp args if args['--debug']
70
+ puts args if args['--debug']
50
71
  # use case 1, using the tool
51
72
  if args['<hash>']
52
73
  args['<hash>'] = $stdin.read.chomp if args['<hash>'] == '-'
@@ -55,20 +76,18 @@ begin
55
76
  puts 'Unknown hash type'
56
77
  exit(0)
57
78
  end
58
- hi.type.each do |type|
59
- next if type.extended && !args['--extended']
60
-
61
- print Paint[type.name, :bold]
62
- print Paint[" [HC: #{type.hashcat}]", :blue] unless type.hashcat.nil? || args['--short'] || args['--john-only']
63
- print Paint[" [JtR: #{type.john}]", :green] unless type.john.nil? || args['--short'] || args['--hashcat-only']
64
- puts
65
- end
79
+ manage_options(args, hi.type)
66
80
  elsif args['samples']
67
81
  input = args['<ref>'] || args['<name>']
68
82
  samples = HashIdentifier.samples(input)
69
83
  samples.each do |sample|
70
84
  puts sample
71
85
  end
86
+ elsif args['list']
87
+ types = HashIdentifier.object_list
88
+ manage_options(args, types)
89
+ elsif args['--ascii-art']
90
+ puts File.read(File.join(__dir__, '../docs/_media/logo.ascii'))
72
91
  end
73
92
  # use case 2, help: already handled by docopt
74
93
  # use case 3, version: already handled by docopt
data/data/commons.json CHANGED
@@ -1,29 +1,31 @@
1
1
  [
2
- "MD5",
3
- "SHA-1",
4
- "SHA-256",
5
- "SHA-512",
6
- "bcrypt",
7
- "NTLM",
8
- "NetNTLMv2",
9
- "NetNTLMv1-VANILLA / NetNTLMv1+ESS",
10
- "BLAKE2-512",
11
- "SHA3-224",
12
- "SHA3-256",
13
- "SHA3-512",
14
- "Keccak-256",
15
- "Keccak-512",
16
- "CRC-32B",
17
- "CRC-32",
18
- "CRC-16",
19
- "CRC-64",
20
- "GOST R 34.11-94",
21
- "Apache MD5",
22
- "MD5(APR)",
23
- "md5apr1",
24
- "Domain Cached Credentials",
25
- "Domain Cached Credentials 2",
26
- "LM",
27
- "RIPEMD-160",
28
- "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"
29
31
  ]