gentle_brute 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/GentleBrute +24 -21
  2. data/gentle_brute.gemspec +1 -1
  3. metadata +1 -1
@@ -35,34 +35,43 @@ def crack_md5_list file_path
35
35
  Curses.init_pair(COLOR_GREEN,COLOR_GREEN,COLOR_BLACK)
36
36
  Curses.init_pair(COLOR_RED,COLOR_RED,COLOR_BLACK)
37
37
 
38
+ divider = "-" * 77
39
+
38
40
  win = Curses::Window.new(0, 0, 0, 0)
39
41
  win.setpos(1, 0)
40
42
  win.addstr("== Attempting to crack target hashes using heuristic brute forcing ==".center(Curses.cols))
41
43
  win.setpos(2, 0)
42
44
  win.addstr("(Press 'q' to quit at any time)".center(Curses.cols))
43
45
  win.setpos(4, 0)
44
- header = "Phrase | MD5 Hash (Phrase) | MD5 Hash (Target)"
45
- divider = ("-" * 77) + " "
46
- while header.length < divider.length
47
- header += " "
48
- end
49
- win.addstr(header.rjust(Curses.cols))
46
+ header = "Phrase | MD5 Hash (Phrase) | MD5 Hash (Target)".ljust(divider.length)
47
+ win.addstr(header.center(Curses.cols))
50
48
  win.setpos(5, 0)
51
- win.addstr(divider.rjust(Curses.cols))
49
+ win.addstr(divider.center(Curses.cols))
52
50
 
53
51
  while unbroken_hashes.length > 0
54
52
  break if Curses.getch == ?q
55
53
  phrase = b.next_valid_phrase
56
54
  attempt_hash = Digest::MD5.hexdigest(phrase)
57
55
  output_phrase = phrase
56
+ #output_phrase = "a" * 10
58
57
 
59
58
  row = 6
60
59
  target_hashes.each do | target_hash |
60
+ if attempt_hash == target_hash
61
+ unbroken_hashes.delete target_hash
62
+ cracked_hashes[target_hash] = output_phrase
63
+ end
64
+
61
65
  if cracked_hashes.key? target_hash
62
66
  new_phrase = cracked_hashes[target_hash]
63
67
  new_hash = target_hash
64
- line = "#{new_phrase} | #{new_hash} | #{target_hash} "
65
- offset = (line.rjust(Curses.cols).length) - line.length
68
+ line = "#{new_phrase} | #{new_hash} | #{target_hash} ".rjust(divider.length)
69
+ offset = ((line.center(Curses.cols).length) - line.length)/2
70
+ index = header.center(Curses.cols).index("|")
71
+ while ((" " * offset) + "#{new_phrase} |").index("|") < index
72
+ offset += 1
73
+ end
74
+
66
75
  win.setpos(row, offset)
67
76
  win.attron(color_pair(COLOR_GREEN)|A_NORMAL){
68
77
  win.addstr(new_phrase)
@@ -76,30 +85,24 @@ def crack_md5_list file_path
76
85
  win.addstr(target_hash)
77
86
  }
78
87
  else
79
- line = "#{output_phrase} | #{attempt_hash} | #{target_hash} "
88
+ line = "#{output_phrase} | #{attempt_hash} | #{target_hash} ".rjust(divider.length)
80
89
  win.setpos(row, 0)
81
- win.addstr(line.rjust(Curses.cols))
82
- end
83
-
84
- if attempt_hash == target_hash
85
- unbroken_hashes.delete target_hash
86
- cracked_hashes[target_hash] = output_phrase
90
+ win.addstr(line.center(Curses.cols))
87
91
  end
88
-
89
92
  row += 1
90
93
  end
91
94
 
92
95
  # Add time elapsed information
93
96
  win.setpos(row, 0)
94
- win.addstr(divider.rjust(Curses.cols))
97
+ win.addstr(divider.center(Curses.cols))
95
98
  row += 1
96
99
  time_elapsed = Time.now.to_f - start_time
97
- time_elapsed_string = "Time Elapsed: #{pretty_time_string time_elapsed} "
100
+ time_elapsed_string = "Time Elapsed: #{pretty_time_string time_elapsed} ".rjust(divider.length)
98
101
  win.setpos(row, 0)
99
- win.addstr(time_elapsed_string.rjust(Curses.cols))
102
+ win.addstr(time_elapsed_string.center(Curses.cols))
100
103
  row += 1
101
104
  win.setpos(row, 0)
102
- win.addstr(divider.rjust(Curses.cols))
105
+ win.addstr(divider.center(Curses.cols))
103
106
 
104
107
  win.refresh
105
108
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'gentle_brute'
3
- s.version = '0.0.1'
3
+ s.version = '0.0.2'
4
4
  s.summary = 'The better brute force algorithm'
5
5
  s.description = 'A heuristic brute forcing algorithm for Ruby that generates brute force passphrases that adhere to the rules of English-like words and phrases.'
6
6
  s.authors = ["Brandon Smith"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gentle_brute
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: