cobreak 0.0.6 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
File without changes
@@ -3,53 +3,36 @@ require 'cobreak/function_db'
3
3
  require 'cobreak/function_hash'
4
4
  require 'cobreak/version'
5
5
  class Encrypt
6
- def md4(dato)
7
- md4 = OpenSSL::Digest::MD4.hexdigest(dato)
8
- puts "\n\e[1;32m[\e[0m+\e[1;32m]\e[0m Encrypted Text: " + md4
9
- $datBas::database(md4)
10
- DB::database(dato, File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'show', 'md4.db'))
11
- end
12
- def md5(dato)
13
- md5 = OpenSSL::Digest::MD5.hexdigest(dato)
14
- puts "\n\e[1;32m[\e[0m+\e[1;32m]\e[0m Encrypted Text: " + md5
15
- DB::database(dato, File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'show', 'md5.db'))
16
- $datBas::database(md5)
17
- end
18
- def sha1(dato)
19
- sha1 = OpenSSL::Digest::SHA1.hexdigest(dato)
20
- puts "\n\e[1;32m[\e[0m+\e[1;32m]\e[0m Encrypted Text: " + sha1
21
- DB::database(dato, File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'show', 'sha1.db'))
22
- $datBas::database(sha1)
23
- end
24
- def sha224(dato)
25
- sha224 = OpenSSL::Digest::SHA224.hexdigest(dato)
26
- puts "\n\e[1;32m[\e[0m+\e[1;32m]\e[0m Encrypted Text: " + sha224
27
- DB::database(dato, File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'show', 'sha224.db'))
28
- $datBas::database(sha224)
29
- end
30
- def sha256(dato)
31
- sha256 = OpenSSL::Digest::SHA256.hexdigest(dato)
32
- puts "\n\e[1;32m[\e[0m+\e[1;32m]\e[0m Encrypted Text: " + sha256
33
- DB::database(dato, File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'show', 'sha256.db'))
34
- $datBas::database(sha256)
35
- end
36
- def sha384(dato)
37
- sha384 = OpenSSL::Digest::SHA384.hexdigest(dato)
38
- puts "\n\e[1;32m[\e[0m+\e[1;32m]\e[0m Encrypted Text: " + sha384
39
- DB::database(dato, File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'show', '384.db'))
40
- $datBas::database(sha384)
41
- end
42
- def sha512(dato)
43
- sha512 = OpenSSL::Digest::SHA512.hexdigest(dato)
44
- puts "\n\e[1;32m[\e[0m+\e[1;32m]\e[0m Encrypted Text: " + sha512
45
- DB::database(dato, File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'show', 'sha512.db'))
46
- $datBas::database(sha512)
47
- end
48
- def ripemd160(dato)
49
- ripemd160 = OpenSSL::Digest::RIPEMD160.hexdigest(dato)
50
- puts "\n\e[1;32m[\e[0m+\e[1;32m]\e[0m Encrypted Text: " + ripemd160
51
- DB::database(dato, File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'show', 'ripemd160.db'))
52
- $datBas::database(ripemd160)
6
+ def show(mode, dato)
7
+ encrypt = OpenStruct.new
8
+ encrypt.mode = mode.downcase
9
+ encrypt.dato = dato
10
+ case encrypt.mode
11
+ when ('md4')
12
+ encrypt.crypt = OpenSSL::Digest::MD4.hexdigest(dato)
13
+ when ('md5')
14
+ encrypt.crypt = OpenSSL::Digest::MD5.hexdigest(dato)
15
+ when ('sha1')
16
+ encrypt.crypt = OpenSSL::Digest::SHA1.hexdigest(dato)
17
+ when ('sha224')
18
+ encrypt.crypt = OpenSSL::Digest::SHA224.hexdigest(dato)
19
+ when ('sha256')
20
+ encrypt.crypt = OpenSSL::Digest::SHA256.hexdigest(dato)
21
+ when ('sha384')
22
+ encrypt.crypt = OpenSSL::Digest::SHA384.hexdigest(dato)
23
+ when ('sha512')
24
+ encrypt.crypt = OpenSSL::Digest::SHA512.hexdigest(dato)
25
+ when ('ripemd160')
26
+ encrypt.crypt = OpenSSL::Digest::RIPEMD160.hexdigest(dato)
27
+ else "\e[1;31m[\e[1;37m+\e[1;31m]\e[1;37m Type Hash Not Found"
28
+ end
29
+ unless (encrypt.crypt.nil?)
30
+ puts "\e[1;32m[\e[1;37m+\e[1;32m]\e[1;37m Encrypted Text: #{encrypt.crypt}"
31
+ $datBas::database(encrypt.crypt)
32
+ DB::database(dato, File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'show', "#{encrypt.mode}.db"))
33
+ else
34
+ puts "\e[1;31m[\e[1;37m+\e[1;31m]\e[1;37m Not Encrypt Text..."
35
+ end
53
36
  end
54
37
  end
55
38
  EnCrypt = Encrypt.new
data/lib/cobreak/force.rb CHANGED
@@ -1,227 +1,212 @@
1
- require 'sequel'
2
- require 'ostruct'
3
1
  require 'cobreak/function_hash'
4
2
  class Forze_brute
3
+ attr_accessor :hash_input, :type_hash, :crypt, :min_chr, :max_chr, :charact, :word, :wordlist, :result, :out, :verbose, :crack
5
4
  def initialize(author = 'BreakerBox')
6
5
  @author = author
6
+ @result = nil
7
+ @crack = nil
8
+ @crypt = nil
9
+ @dict = nil
10
+ @word = nil
7
11
  end
8
12
  def verify(dato, word = File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'hash', 'hash.db'))
9
13
  hash_db = Sequel.sqlite
10
14
  hash_db.create_table? :datahash do
11
15
  String :ori
12
- String :has
16
+ String :hash
13
17
  end
14
- IO.foreach(word) {|lin|
15
- lin = lin.chomp
16
- hash_db[:datahash] << {ori:lin, has:dato}
17
- }
18
- ha = hash_db[:datahash].filter(ori:dato).map(:has)
18
+ begin
19
+ IO.foreach(word) {|lin|
20
+ lin = lin.chomp
21
+ hash_db[:datahash] << {ori:lin, hash:dato}
22
+ }
23
+ rescue Errno::ENOENT
24
+ return
25
+ end
26
+ ha = hash_db[:datahash].filter(ori:dato).map(:hash)
19
27
  arr = Array.new
20
28
  arr << dato
21
29
  if (ha == arr)
22
- puts "\e[1;32m[\e[0m+\e[1;32m]\e[0m Hash already existing in the database: #{dato}"
23
- puts "\e[1;32m[\e[0m+\e[1;32m]\e[0m decrypt the hash using --decrypt, see the help parameter for more information"
30
+ puts "\e[1;32m[\e[1;37m+\e[1;32m]\e[1;37m Hash already existing in the database: #{dato}"
31
+ puts "\e[1;32m[\e[1;37m+\e[1;32m]\e[1;37m show the hash using --show, see the help parameter for more information\e[0m"
24
32
  exit
25
33
  end
26
34
  end
27
- def md4(dato, wordlist)
28
- verify(dato)
35
+ def word(dato, wordlist, type, out, verbose = false)
29
36
  forzebrute = OpenStruct.new
30
- forzebrute.time = Time.now
31
- forzebrute.hash = dato
32
- forzebrute.wordlist = wordlist
33
- require 'openssl'
34
- File.foreach(forzebrute.wordlist) {|line|
35
- line.chomp!
36
- forzebrute.md4 = OpenSSL::Digest::MD4.hexdigest(line)
37
- if (forzebrute.md4 == forzebrute.hash)
38
- print "\e[1;32m[\e[0m+\e[1;32m]\e[0m Decrypted Text: "
39
- puts line
40
- puts "\e[1;32m[\e[0m+\e[1;32m]\e[0m Hash Cracking #{Time.now - forzebrute.time} seconds"
41
- $datBas::database(forzebrute.hash)
42
- DB::database(forzebrute.md4, File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'show', 'md4.db'))
43
- exit
44
- end
45
- }
46
- if true
47
- puts "\e[1;31m[\e[0m+\e[1;31m]\e[0m Not Decrypted Text: #{dato}"
48
- puts "\e[1;31m[\e[0m+\e[1;31m]\e[0m Time: #{Time.now - forzebrute.time} seconds"
49
- end
50
- end
51
- def md5(dato, wordlist)
52
- # verify(dato)
53
- forzebrute = OpenStruct.new
54
- forzebrute.hash = dato
55
- forzebrute.wordlist = wordlist
56
- require 'digest/md5'
57
- forzebrute.time = Time.now
58
- File.foreach(forzebrute.wordlist) {|line|
59
- line.chomp!
60
- forzebrute.md5 = Digest::MD5.hexdigest(line)
61
- if (forzebrute.md5 == forzebrute.hash)
62
- print "\e[1;32m[\e[0m+\e[1;32m]\e[0m Decrypted Text: "
63
- puts line
64
- puts "\e[1;32m[\e[0m+\e[1;32m]\e[0m Hash Cracking #{Time.now - forzebrute.time} seconds"
65
- $datBas::database(forzebrute.hash)
66
- DB::database(forzebrute.md5, File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'show', 'md5.db'))
67
- exit
68
- end
69
- }
70
- if true
71
- puts "\e[1;31m[\e[0m+\e[1;31m]\e[0m Not Decrypted Text: #{dato}"
72
- puts "\e[1;31m[\e[0m+\e[1;31m]\e[0m Time: #{Time.now - forzebrute.time} seconds"
73
- exit
74
- end
75
- end
76
- def sha1(dato, wordlist)
77
- verify(dato)
78
- forzebrute = OpenStruct.new
79
- forzebrute.time = Time.now
80
- forzebrute.hash = dato
81
- forzebrute.wordlist = wordlist
82
- require 'digest/sha1'
83
- File.foreach(forzebrute.wordlist) {|line|
84
- line.chomp!
85
- forzebrute.sha1 = Digest::SHA1.hexdigest(line)
86
- if (forzebrute.sha1 == forzebrute.hash)
87
- print "\e[1;32m[\e[0m+\e[1;32m]\e[0m Decrypted Text: "
88
- puts line
89
- puts "\e[1;32m[\e[0m+\e[1;32m]\e[0m Hash Cracking #{Time.now - forzebrute.time} seconds"
90
- $datBas::database(forzebrute.hash)
91
- DB::database(forzebrute.sha1, File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'show', 'sha1.db'))
92
- exit
93
- end
94
- }
95
- if true
96
- puts "\e[1;31m[\e[0m+\e[1;31m]\e[0m Not Decrypted Text: #{dato}"
97
- puts "\e[1;31m[\e[0m+\e[1;31m]\e[0m Time: #{Time.now - forzebrute.time} seconds"
98
- end
99
- end
100
- def sha224(dato, wordlist)
101
- verify(dato)
102
- forzebrute = OpenStruct.new
103
- forzebrute.time = Time.now
104
- forzebrute.hash = dato
105
- forzebrute.wordlist = wordlist
106
- require 'digest/sha224'
107
- File.foreach(forzebrute.wordlist) {|line|
108
- line.chomp!
109
- forzebrute.sha224 = Digest::SHA224.hexdigest(line)
110
- if (forzebrute.sha224 == forzebrute.hash)
111
- print "\e[1;32m[\e[0m+\e[1;32m]\e[0m Decrypted Text: "
112
- puts line
113
- puts "\e[1;32m[\e[0m+\e[1;32m]\e[0m Hash Cracking #{Time.now - forzebrute.time} seconds"
114
- $datBas::database(forzebrute.hash)
115
- DB::database(forzebrute.sha224, File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'show', 'sha224.db'))
116
- exit
117
- end
118
- }
119
- if true
120
- puts "\e[1;31m[\e[0m+\e[1;31m]\e[0m Not Decrypted Text: #{dato}"
121
- puts "\e[1;31m[\e[0m+\e[1;31m]\e[0m Time: #{Time.now - forzebrute.time} seconds"
122
- exit
123
- end
124
- end
125
- def sha256(dato, wordlist)
126
- verify(dato)
127
- forzebrute = OpenStruct.new
128
- forzebrute.time = Time.now
129
- forzebrute.hash = dato
130
- forzebrute.wordlist = wordlist
131
- require 'digest/sha256'
132
- File.foreach(forzebrute.wordlist) {|line|
133
- line.chomp!
134
- forzebrute.sha256 = Digest::SHA256.hexdigest(line)
135
- if (forzebrute.sha256 == forzebrute.hash)
136
- print "\e[1;32m[\e[0m+\e[1;32m]\e[0m Decrypted Text: "
137
- puts line
138
- puts "\e[1;32m[\e[0m+\e[1;32m]\e[0m Hash Cracking #{Time.now - forzebrute.time} seconds"
139
- $datBas::database(forzebrute.hash)
140
- DB::database(forzebrute.sha256, File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'show', 'sha256.db'))
141
- exit
142
- end
37
+ @hash_input = dato
38
+ @type_hash = type
39
+ @out = out
40
+ @verbose = verbose
41
+ @wordlist = wordlist
42
+ File.foreach(File.join(Gem.path[1], "gems","cobreak-#{CoBreak.version}" , "lib", "cobreak", "config", "database.db"), mode: 'r'){|booleano|
43
+ forzebrute.booleano = booleano
44
+ if (booleano.eql?('true'))
45
+ verify(dato)
46
+ end
143
47
  }
144
- if true
145
- puts "\e[1;31m[\e[0m+\e[1;31m]\e[0m Not Decrypted Text: #{dato}"
146
- puts "\e[1;31m[\e[0m+\e[1;31m]\e[0m Time: #{Time.now - forzebrute.time} seconds"
147
- exit
148
- end
149
- end
150
- def sha384(dato, wordlist)
151
- verify(dato)
152
- forzebrute = OpenStruct.new
153
- forzebrute.time = Time.now
154
- forzebrute.hash = dato
155
- forzebrute.wordlist = wordlist
156
- require 'digest/sha384'
157
- File.foreach(forzebrute.wordlist) {|line|
158
- line.chomp!
159
- forzebrute.sha384 = Digest::SHA384.hexdigest(line)
160
- if (forzebrute.sha384 == forzebrute.hash)
161
- print "\e[1;32m[\e[0m+\e[1;32m]\e[0m Decrypted Text: "
162
- puts line
163
- puts "\e[1;32m[\e[0m+\e[1;32m]\e[0m Hash Cracking #{Time.now - forzebrute.time} seconds"
164
- $datBas::database(forzebrute.hash)
165
- DB::database(forzebrute.sha384, File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'show', 'sha384.db'))
166
- exit
48
+ if (type_hash.downcase.eql?('md4'))
49
+ @crypt = OpenSSL::Digest::MD4.new
50
+ elsif (type_hash.downcase.eql?('md5'))
51
+ @crypt = OpenSSL::Digest::MD5.new
52
+ elsif (type_hash.downcase.eql?('sha1'))
53
+ @crypt = OpenSSL::Digest::SHA1.new
54
+ elsif (type_hash.downcase.eql?('sha224'))
55
+ @crypt = OpenSSL::Digest::SHA224.new
56
+ elsif (type_hash.downcase.eql?('sha256'))
57
+ @crypt = OpenSSL::Digest::SHA256.new
58
+ elsif (type_hash.downcase.eql?('sha384'))
59
+ @crypt = OpenSSL::Digest::SHA384.new
60
+ elsif (type_hash.downcase.eql?('sha512'))
61
+ @crypt = OpenSSL::Digest::SHA512.new
62
+ elsif (type_hash.downcase.eql?('ripemd160'))
63
+ @crypt = OpenSSL::Digest::RIPEMD160.new
167
64
  end
168
- }
169
- if true
170
- puts "\e[1;31m[\e[0m+\e[1;31m]\e[0m Not Decrypted Text: #{forzebrute.hash}"
171
- puts "\e[1;31m[\e[0m+\e[1;31m]\e[0m Time: #{Time.now - forzebrute.time} seconds"
172
- exit
173
- end
174
- end
175
- def sha512(dato, wordlist)
176
- verify(dato)
177
- forzebrute = OpenStruct.new
178
- forzebrute.time = Time.now
179
- forzebrute.hash = dato
180
- forzebrute.wordlist = wordlist
181
- require 'digest/sha512'
182
- File.foreach(forzebrute.wordlist) {|line|
183
- line.chomp!
184
- forzebrute.sha512 = Digest::SHA512.hexdigest(line)
185
- if (forzebrute.sha512 == forzebrute.hash)
186
- print "\e[1;32m[\e[0m+\e[1;32m]\e[0m Decrypted Text: "
187
- puts line
188
- puts "\e[1;32m[\e[0m+\e[1;32m]\e[0m Hash Cracking #{Time.now - forzebrute.time} seconds"
189
- $datBas::database(forzebrute.hash)
190
- DB::database(forzebrute.sha512, File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'show', 'sha512.db'))
65
+ lin = 0
66
+ forzebrute.time = Time.now
67
+ begin
68
+ if (verbose)
69
+ thread = Thread.new do
70
+ dict = File.open(wordlist, mode: 'r')
71
+ while word = dict.gets
72
+ lin += 1
73
+ $word = word
74
+ if (crypt.hexdigest(word.chomp).eql?(hash_input))
75
+ @result = word
76
+ verbose = false
77
+ thread.kill
78
+ end
79
+ end
80
+ verbose = 'no'
81
+ end
82
+ else
83
+ dict = File.open(wordlist, mode: 'r')
84
+ while word = dict.gets
85
+ lin += 1
86
+ begin
87
+ if (crypt.hexdigest(word.chomp).eql?(hash_input.chomp))
88
+ @result = word
89
+ verbose = false
90
+ break
91
+ end
92
+ rescue
93
+ end
94
+ end
95
+ end
96
+ while (verbose == true)
97
+ STDOUT.flush
98
+ begin
99
+ print "\r\e[1;32m[\e[1;37m+\e[1;32m]\e[1;37m Password Crack: #{$word.chomp}" + " " *30
100
+ rescue
101
+ end
102
+ sleep(0.1)
103
+ end
104
+ if (verbose == false)
105
+ puts "\r\e[1;32m[\e[1;37m+\e[1;32m]\e[1;37m Password Crack: #{result}"
106
+ puts "\r\e[1;32m[\e[1;37m+\e[1;32m]\e[1;37m Number of lines: #{lin}"
107
+ puts "\e[1;32m[\e[1;37m+\e[1;32m]\e[1;37m Hash Cracking in #{Time.now - forzebrute.time} seconds"
108
+ else
109
+ puts "\r\e[1;31m[\e[1;37m+\e[1;31m]\e[1;37m Not Cracking Text: #{hash_input}"
110
+ puts "\e[1;31m[\e[1;37m+\e[1;31m]\e[1;37m Time: #{Time.now - forzebrute.time} seconds\e[0m"
111
+ end
112
+ if (forzebrute.booleano.eql?('true'))
113
+ $datBas::database(crypt.hexdigest(wordlist.chomp))
114
+ DB::database(result, File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'show', "#{type_hash}.db"))
115
+ end
116
+ if !(result.nil?)
117
+ if !(out.nil?)
118
+ File.open(out, mode: 'a'){|out|
119
+ out.puts "=================================================="
120
+ out.puts "software: CoBreak #{CoBreak.version}"
121
+ out.puts "Type Hash: #{type_hash}\n"
122
+ out.puts "#{result.chomp}:#{crypt.hexdigest(result)}"
123
+ out.puts "=================================================="
124
+ }
125
+ end
126
+ end
127
+ rescue Interrupt
128
+ puts "\n\e[1;31m[\e[1;37m+\e[1;31m]\e[1;37m Interrupt mode"
129
+ puts "\e[1;31m[\e[1;37m+\e[1;31m]\e[1;37m Password Not Cracked"
130
+ puts "\e[1;31m[\e[1;37m+\e[1;31m]\e[1;37m Number of Lines: #{lin}"
131
+ puts "\e[1;31m[\e[1;37m+\e[1;31m]\e[1;37m Wait Time: #{Time.now - forzebrute.time} seconds\e[0m"
191
132
  exit
192
133
  end
193
- }
194
- if true
195
- puts "\e[1;31m[\e[0m+\e[1;31m]\e[0m Not Decrypted Text: #{forzebrute.hash}"
196
- puts "\e[1;31m[\e[0m+\e[1;31m]\e[0m Time: #{Time.now - forzebrute.time} seconds"
197
- exit
198
- end
199
134
  end
200
- def ripemd160(dato, wordlist)
201
- verify(dato)
202
- verify(dato)
203
- forzebrute = OpenStruct.new
204
- forzebrute.time = Time.now
205
- forzebrute.hash = dato
206
- forzebrute.wordlist = wordlist
207
- require 'digest/rmd160'
208
- File.foreach(forzebrute.wordlist) {|line|
209
- line.chomp!
210
- forzebrute.ripemd160 = Digest::RMD160.hexdigest(line)
211
- if (forzebrute.ripemd160 == forzebrute.hash)
212
- print "\e[1;32m[\e[0m+\e[1;32m]\e[0m Decrypted Text: "
213
- puts line
214
- puts "\e[1;32m[\e[0m+\e[1;32m]\e[0m Hash Cracking #{Time.now - forzebrute.time} seconds"
215
- $datBas::database(forzebrute.hash)
216
- DB::database(forzebrute.ripemd160, File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'show', 'ripemd160.db'))
217
- exit
135
+ def chars(dato, range, char, type, out, verbose = false)
136
+ bool = File.open(File.join(Gem.path[1], "gems","cobreak-#{CoBreak.version}" , "lib", "cobreak", "config", "database.db"))
137
+ bool = bool.readlines[0].to_s.chomp
138
+ if (bool.eql?('true'))
139
+ verify(dato)
140
+ end
141
+ forzechars = OpenStruct.new
142
+ forzechars.dato = dato
143
+ forzechars.range = range
144
+ forzechars.char = char.chars
145
+ forzechars.type = type
146
+ forzechars.out = out
147
+ forzechars.verbose = verbose
148
+ forzechars.cont = Array.new
149
+ forzechars.result = nil
150
+ if (forzechars.type.downcase.eql?('md4'))
151
+ forzechars.crypt = OpenSSL::Digest::MD4.new
152
+ elsif (forzechars.type.downcase.eql?('md5'))
153
+ forzechars.crypt = OpenSSL::Digest::MD5.new
154
+ elsif (forzechars.type.downcase.eql?('sha1'))
155
+ forzechars.crypt = OpenSSL::Digest::SHA1.new
156
+ elsif (forzechars.type.downcase.eql?('sha224'))
157
+ forzechars.crypt = OpenSSL::Digest::SHA224.new
158
+ elsif (forzechars.type.downcase.eql?('sha256'))
159
+ forzechars.crypt = OpenSSL::Digest::SHA256.new
160
+ elsif (forzechars.type.downcase.eql?('sha384'))
161
+ forzechars.crypt = OpenSSL::Digest::SHA384.new
162
+ elsif (forzechars.type.downcase.eql?('sha512'))
163
+ forzechars.crypt = OpenSSL::Digest::SHA512.new
164
+ elsif (forzechars.type.downcase.eql?('ripemd160'))
165
+ forzechars.crypt = OpenSSL::Digest::RIPEMD160.new
166
+ end
167
+ lin = 0
168
+ begin
169
+ forzechars.time = Time.now
170
+ for range in (forzechars.range[0].to_i..forzechars.range[1].to_i).to_a
171
+ for chars in forzechars.char.repeated_permutation(range).map(&:join)
172
+ lin += 1
173
+ if (forzechars.verbose.eql?(true))
174
+ print "\r\e[1;32m[\e[1;37m+\e[1;32m]\e[1;37m Password Crack: #{chars}"
175
+ end
176
+ if (forzechars.crypt.hexdigest(chars).eql?(forzechars.dato))
177
+ forzechars.result = chars
178
+ puts "\e[1;32m[\e[1;37m+\e[1;32m]\e[1;37m Password Crack: #{chars}"
179
+ puts "\e[1;32m[\e[1;37m+\e[1;32m]\e[1;37m Number of Lines: #{lin}"
180
+ puts "\e[1;32m[\e[1;37m+\e[1;32m]\e[1;37m Hash Cracking in #{Time.now - forzechars.time} seconds"
181
+ if bool.eql?('true')
182
+ $datBas::database(forzechars.crypt.hexdigest(chars))
183
+ DB::database(chars, File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'show', "#{forzechars.type}.db"))
184
+ end
185
+ if !(forzechars.out.nil?)
186
+ File.open(forzechars.out, mode: 'a'){|out|
187
+ out.puts "=================================================="
188
+ out.puts "software: CoBreak #{CoBreak.version}"
189
+ out.puts "Type Hash: #{forzechars.type}\n"
190
+ out.puts "#{chars}:#{forzechars.crypt.hexdigest(chars)}"
191
+ out.puts "=================================================="
192
+ }
193
+ end
194
+ break
195
+ end
196
+ end
218
197
  end
219
- }
220
- if true
221
- puts "\e[1;31m[\e[0m+\e[1;31m]\e[0m Not Decrypted Text: #{forzebrute.hash}"
222
- puts "\e[1;31m[\e[0m+\e[1;31m]\e[0m Time: #{Time.now - forzebrute.time} seconds"
223
- exit
224
- end
198
+ rescue Interrupt
199
+ puts "\n\e[1;31m[\e[1;37m+\e[1;31m]\e[1;37m Interrupt mode"
200
+ puts "\e[1;31m[\e[1;37m+\e[1;31m]\e[1;37m Password Not Cracked"
201
+ puts "\e[1;31m[\e[1;37m+\e[1;31m]\e[1;37m Number of Lines: #{lin}"
202
+ puts "\e[1;31m[\e[1;37m+\e[1;31m]\e[1;37m Wait Time: #{Time.now - forzechars.time} seconds\e[0m"
203
+ exit
204
+ end
205
+ if (forzechars.result.nil?)
206
+ puts "\e[1;31m[\e[1;37m+\e[1;31m]\e[1;37m Not Cracking Text: #{forzechars.dato}"
207
+ puts "\e[1;31m[\e[1;37m+\e[1;31m]\e[1;37m Time: #{Time.now - forzechars.time}\e[0m"
208
+ exit
209
+ end
225
210
  end
226
211
  end
227
- ForzeBrute = Forze_brute.new
212
+ ForzeBrute = Forze_brute.new