heitt 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09a5102cf903ce6b0064303daa378ba34d5ab5835ec90be737cef63325e48872'
4
- data.tar.gz: d6a882c5ae2f4b33390ee4c4a5ca03ffdb3032832333c0a8f355c126a7223841
3
+ metadata.gz: 0beed2894ada25d59c6c1d9267fee2e0753dbfbcb89b81156a748cbee6171402
4
+ data.tar.gz: 58209cc283a7c4864904e44280395a163da79b8144f36d33617fe9336038962d
5
5
  SHA512:
6
- metadata.gz: 0da456e13048b5687e010ccc6361179f51a781d97880d22306a5a90eda9bb48ca5f596f196d4cbee7d0fdb10e58cac24674cc5a15efe366811a81745d6d90f48
7
- data.tar.gz: 4c65b51cda918629388e41ecde058909ba475fafcdeb1640b02b0c68609b29bcc804e9b24512de7d67f502a26a6bd0923688d3dec9de274e7ce118df4c5e0a9e
6
+ metadata.gz: 93cb5c2a948fc18961f02a082ff72ee7bef0a3d2bb6304da64f3839d0d90c147f9652a4c9a24208f17626d66be5321177ad42e03758c8ccce5b8ed240bdc8d32
7
+ data.tar.gz: e0ebeb29a0cd51ab44ce9364a043d2840cdb8f312fe5a1399d82a96a089b72bf0377f3fea06948e4e7964f6063f45ee196e1eb4a5f7f47a540ffa70096a8809a
data/bin/heitt CHANGED
@@ -4,6 +4,7 @@ require 'io/console'
4
4
  require 'heitt'
5
5
 
6
6
 
7
+
7
8
  module HEITT
8
9
  class CLI
9
10
  attr_accessor :inputs, :extended, :verbose, :output, :json, :database, :show_regex_match, :min_entropy
data/lib/heitt/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HEITT
4
- VERSION = "0.4.2"
4
+ VERSION = "0.4.3"
5
5
  GITHUB = "https://github.com/jobotow/heitt"
6
6
  end
data/lib/heitt.rb CHANGED
@@ -69,7 +69,6 @@ module HEITT
69
69
  prefix_matched_mode = mode[:name]
70
70
  score += 20
71
71
  end
72
- #puts "MODENAME: #{mode[:name]}"
73
72
  {
74
73
  name: mode[:name],
75
74
  hashcat: mode[:hashcat],
@@ -95,7 +94,7 @@ module HEITT
95
94
  entry[:candidates] || entry[:types] || entry[:hashtypes]
96
95
  end
97
96
 
98
- #this code is a copy or inspiration of "https://github.com/chrisjchandler/entropy/blob/main/entropy.go"
97
+ #this code is an inspiration of "https://github.com/chrisjchandler/entropy/blob/main/entropy.go"
99
98
  def self.entropy(text)
100
99
  frequency = Hash.new(0)
101
100
  text.each_char { |ch| frequency[ch] += 1 }
@@ -211,11 +210,22 @@ module HEITT
211
210
 
212
211
  candidates = HEITT::Analyzer.score_candidates(modes, delim_prefix, context_scores)
213
212
  score = candidates.first[:score]
214
- if score > (seen[matched] || -1)
215
- seen[matched] = score
216
- found[matched] = {hash: matched, candidates: candidates}
213
+
214
+ found[matched] ||= {hash: matched, candidates: []}
215
+ found[matched][:candidates].concat(candidates)
217
216
  end
218
217
  end
218
+
219
+ found.each_value do |result|
220
+ result[:candidates] = result[:candidates]
221
+ .group_by {|c| c[:name]}
222
+ .map {|name, dupes| dupes.max_by {|c| c[:score]}}
223
+ .sort_by {|c| -c[:score]}
224
+
225
+ # Re-assign confidence based on final merged scores
226
+ scores_hash = result[:candidates].map {|c| [c[:name], c[:score]]}.to_h
227
+ confidences = Analyzer.assign_confidence(scores_hash)
228
+ result[:candidates] = result[:candidates].map {|c| c.merge(confidence: confidences[c[:name]])}
219
229
  end
220
230
  found.values
221
231
  end
@@ -305,7 +315,7 @@ module HEITT
305
315
  JSON.pretty_generate(
306
316
  renumbered_groups.map do |group|
307
317
  visible_candidates = group[:candidates].select do |c|
308
- (!c[:extended] || extended) && (c[:confidence] != "regex-match" || show_regex_match)
318
+ (!c[:extended] || extended) && (c[:confidence] != "regex-match" || show_regex_match)
309
319
  end
310
320
  {
311
321
  cluster_id: group[:cluster_id],
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heitt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Botchway Owusu