cobreak 0.0.4 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cobreak.gemspec +7 -8
- data/lib/cobreak/binary.rb +10 -0
- data/lib/cobreak/{Cesar.rb → cesar.rb} +5 -10
- data/lib/cobreak/cifrado.rb +28 -26
- data/lib/cobreak/cobreak.rb +30 -147
- data/lib/cobreak/decifrado.rb +28 -26
- data/lib/cobreak/decrypt.rb +36 -103
- data/lib/cobreak/encrypt.rb +28 -47
- data/lib/cobreak/force.rb +69 -189
- data/lib/cobreak/force_brute.rb +3 -31
- data/lib/cobreak/force_chars.rb +65 -0
- data/lib/cobreak/hash/hash.db +0 -0
- data/lib/cobreak/optionpr.rb +36 -9
- data/lib/cobreak/show/md4.db +0 -0
- data/lib/cobreak/show/md5.db +0 -0
- data/lib/cobreak/show/ripemd160.db +0 -0
- data/lib/cobreak/show/sha1.db +0 -0
- data/lib/cobreak/show/sha224.db +0 -0
- data/lib/cobreak/show/sha256.db +0 -0
- data/lib/cobreak/show/sha384.db +0 -0
- data/lib/cobreak/show/sha512.db +0 -0
- data/lib/cobreak/version.rb +1 -1
- metadata +42 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cd38e3a0c2c619fe0dfa738e8a7963d7b2ca135a2f49f2b8d2fd8f6494c5ea0
|
4
|
+
data.tar.gz: 232595ebcca59527750dea27084c153abb95274243c08513a18b8b634c119c36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d6388ce0dd355c0b8fae3520ac955c28401ff3b8653b4fd5dda5ed775864b9a5d3114d1069730e975fd5251cb66502b5346821f3b9df7f407603784bf53ae8b
|
7
|
+
data.tar.gz: 810b4d19c7fb9dfd372d4e686a1b7beaf2110192a46bc6dd8556cd0b5f3b3f9c103684449d30f5506549d94e14e449f2926badaf101a737e94518ac8b712b676
|
data/cobreak.gemspec
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
Gem::Specification.new do |info|
|
2
2
|
info.name = 'cobreak'
|
3
|
-
info.version = '
|
3
|
+
info.version = '1.0.1'
|
4
4
|
info.executables << "cobreak"
|
5
5
|
info.description = "The CoBreak script is an cipher and cryptography tool"
|
6
|
-
info.add_development_dependency
|
7
|
-
info.add_development_dependency "
|
8
|
-
info.add_development_dependency "
|
9
|
-
|
6
|
+
info.add_development_dependency "bundler", "~> 1.5"
|
7
|
+
info.add_development_dependency "Digest", "~> 3.0.0"
|
8
|
+
info.add_development_dependency "sequel", "~> 5.44.0"
|
9
|
+
info.add_development_dependency "sqlite3", "~> 1.4.2"
|
10
10
|
info.authors = ["BreakerBox"]
|
11
11
|
info.email = 'breakerhtb@gmail.com'
|
12
12
|
info.summary = "Force Brute, Cipher, Cryptography"
|
13
|
-
info.files = Dir["{lib}
|
14
|
-
info.homepage = 'https://
|
15
|
-
info.metadata = {"source_code_uri" => "https://github.com/BreakerBox/CoBreak"}
|
13
|
+
info.files = Dir["{lib}/**/*.rb"] + Dir["{lib}/**/show/*.db", "{lib}/**/hash/hash.db", "bin/*.rb", "*.gemspec", "diccionario.txt", "Gemfile", "LICENSE", "*.md"]
|
14
|
+
info.homepage = 'https://github.com/BreakerBox/CoBreak'
|
16
15
|
info.license = 'MIT'
|
17
16
|
info.post_install_message = "thanks for installing my gem"
|
18
17
|
end
|
@@ -1,16 +1,13 @@
|
|
1
1
|
class CesarCifrado
|
2
|
-
attr_accessor :dato
|
3
|
-
def initialize(dato = nil)
|
4
|
-
@dato = dato
|
5
|
-
end
|
6
2
|
def cesar(dato, rotasiones, orientacion = 1)
|
3
|
+
cesar = OpenStruct.new
|
4
|
+
cesar.cad_rot = []
|
7
5
|
alfa_mayus = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
8
6
|
alfa_minus = "abcdefghijklmnopqrstuvwxyz"
|
9
7
|
alf = 26
|
10
8
|
lit_mayus = 65
|
11
9
|
lit_minus = 97
|
12
10
|
cad_rot = ""
|
13
|
-
print "\e[1;32m[\e[0m+\e[1;32m]\e[0m CipherText: "
|
14
11
|
for letra in dato.chars
|
15
12
|
if !letra.match(/^[[:alpha:]]$/)
|
16
13
|
cad_rot += letra
|
@@ -25,11 +22,9 @@ class CesarCifrado
|
|
25
22
|
var_ascii = letra.ord
|
26
23
|
rot_ver = rotasiones * orientacion
|
27
24
|
new_pos = (var_ascii - limit + rot_ver) % alf
|
28
|
-
cad_rot
|
29
|
-
print cad_rot
|
25
|
+
cesar.cad_rot << alfabeto[new_pos]
|
30
26
|
end
|
31
|
-
|
27
|
+
return cesar.cad_rot.join('')
|
32
28
|
end
|
33
29
|
end
|
34
|
-
|
35
|
-
DecifraCesar = CesarCifrado.new
|
30
|
+
Cesar = CesarCifrado.new
|
data/lib/cobreak/cifrado.rb
CHANGED
@@ -2,31 +2,33 @@ require 'base64'
|
|
2
2
|
require 'base32'
|
3
3
|
require 'base16'
|
4
4
|
require 'ascii85'
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
5
|
+
require 'cobreak/cesar'
|
6
|
+
require 'cobreak/binary'
|
7
|
+
module CoBreak
|
8
|
+
class Cifrado
|
9
|
+
def self.cipher(mode, dato)
|
10
|
+
cipher = OpenStruct.new
|
11
|
+
cipher.mode = mode
|
12
|
+
cipher.dato = dato
|
13
|
+
if (cipher.mode.eql?('base16'))
|
14
|
+
cipher.result = Base16.encode16(dato)
|
15
|
+
elsif (cipher.mode.eql?('base32'))
|
16
|
+
cipher.result = Base32.encode(dato)
|
17
|
+
elsif (cipher.mode.eql?('base64'))
|
18
|
+
cipher.result = Base64.encode64(dato)
|
19
|
+
elsif (cipher.mode.eql?('ascii85'))
|
20
|
+
cipher.result = Ascii85.encode(dato)
|
21
|
+
elsif (cipher.mode.eql?('cesar'))
|
22
|
+
cipher.result = Cesar.cesar(dato, ARGV[0].to_i)
|
23
|
+
elsif (cipher.mode.eql?('binary'))
|
24
|
+
cipher.result = CoBreak::Binary.binary(dato)
|
25
|
+
end
|
26
|
+
unless (cipher.result.nil?) or (cipher.result.eql?(cipher.dato))
|
27
|
+
puts "\n\e[1;32m[\e[0m+\e[1;32m]\e[0m Ciphertext: #{cipher.result}"
|
28
|
+
puts "\e[1;32m[\e[0m+\e[1;32m]\e[0m Number Rotations: #{ARGV[0]}" if (cipher.mode.eql?('cesar'))
|
29
|
+
else
|
30
|
+
puts "\e[1;31m[\e[0m+\e[1;31m]\e[0m Not Cipher Text..."
|
31
|
+
end
|
32
|
+
end
|
30
33
|
end
|
31
34
|
end
|
32
|
-
Cifra = Cifrado.new
|
data/lib/cobreak/cobreak.rb
CHANGED
@@ -8,7 +8,6 @@ module CoBreak
|
|
8
8
|
begin
|
9
9
|
require 'cobreak/cifrado'
|
10
10
|
require 'cobreak/decifrado'
|
11
|
-
require 'cobreak/Cesar'
|
12
11
|
require 'cobreak/encrypt'
|
13
12
|
require 'cobreak/decrypt'
|
14
13
|
rescue LoadError => e
|
@@ -23,72 +22,25 @@ module CoBreak
|
|
23
22
|
@options = $options
|
24
23
|
@options.enc = "" if @options.enc.nil? == true
|
25
24
|
@options.dec = "" if @options.dec.nil? == true
|
26
|
-
|
25
|
+
@options.cipher = %w[Base16 Base32 Base64 Ascii85 Binary Cesar]
|
26
|
+
if (@options.cipher.include?(@options.enc.capitalize)) or (@options.cipher.include?(@options.dec.capitalize));
|
27
27
|
if (File.exists?(@options.algo));
|
28
28
|
IO.foreach(@options.algo){|line|
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
line.chomp!
|
30
|
+
if (@options.cipher?(@options.enc.capitalize))
|
31
|
+
CoBreak::Cifrado.cipher(line.to_s)
|
32
|
+
end
|
33
|
+
if (@options.cipher.include?(@options.dec.capitalize))
|
34
|
+
CoBreak::Decifrado.cipher(line.to_s)
|
35
|
+
end
|
32
36
|
}
|
33
|
-
else
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
line.chomp!
|
41
|
-
Cifra::base32(line.to_s) if (@options.enc.casecmp?('base32'))
|
42
|
-
Decifra::base32(line.to_s) if (@options.dec.casecmp('base32'))
|
43
|
-
}
|
44
|
-
else;
|
45
|
-
Cifra::base32(@options.algo.to_s) if (@options.enc.casecmp?('base32'))
|
46
|
-
Decifra::base32(@options.algo.to_s) if (@options.dec.casecmp?('base32'))
|
47
|
-
end
|
48
|
-
elsif (@options.enc.casecmp?('base64')) or (@options.dec.casecmp?('base64'));
|
49
|
-
if (File.exists?(@options.algo));
|
50
|
-
IO.foreach(@options.algo){|line|
|
51
|
-
line.chomp!
|
52
|
-
Cifra::base64(line.to_s) if (@options.enc.casecmp?('base64'))
|
53
|
-
Decifra::base64(line.to_s) if (@options.dec.casecmp?('base64'))
|
54
|
-
}
|
55
|
-
else;
|
56
|
-
Cifra::base64(@options.algo.to_s) if (@options.enc.casecmp?('base64'))
|
57
|
-
Decifra::base64(@options.algo.to_s) if (@options.dec.casecmp?('base64'))
|
58
|
-
end
|
59
|
-
elsif (@options.enc.casecmp?('ascii85')) or (@options.dec.casecmp?('ascii85'));
|
60
|
-
if (File.exists?(@options.algo));
|
61
|
-
IO.foreach(@options.algo){|line|
|
62
|
-
line.chomp!
|
63
|
-
Cifra::ascii85(line.to_s) if (@options.enc.casecmp?('ascii85'))
|
64
|
-
Decifra::ascii85(line.to_s) if (@options.dec.casecmp?('ascii85'))
|
65
|
-
}
|
66
|
-
else;
|
67
|
-
Cifra::ascii85(@options.algo.to_s) if (@options.enc.casecmp?('ascii85'))
|
68
|
-
Decifra::ascii85(@options.algo.to_s) if (@options.dec.casecmp?('ascii85'))
|
69
|
-
end
|
70
|
-
elsif (@options.enc.casecmp?('binary')) or (@options.dec.casecmp?('binary'));
|
71
|
-
if (File.exists?(@options.algo));
|
72
|
-
IO.foreach(@options.algo){|line|
|
73
|
-
line.chomp!
|
74
|
-
Cifra::binary(line.to_s) if (@options.enc.casecmp?('binary'))
|
75
|
-
Decifra::binary(line.to_s) if (@options.dec.casecmp?('binary'))
|
76
|
-
}
|
77
|
-
else;
|
78
|
-
Cifra::binary(@options.algo.to_s) if (@options.enc.casecmp?('binary'))
|
79
|
-
Decifra::binary(@options.algo.to_s) if (@options.dec.casecmp?('binary'))
|
80
|
-
end
|
81
|
-
elsif (@options.enc.casecmp?('cesar')) or (@options.dec.casecmp?('cesar'));
|
82
|
-
dat = ARGV[0]
|
83
|
-
if (File.exists?(@options.algo));
|
84
|
-
IO.foreach(@options.algo){|line|
|
85
|
-
line.chomp!
|
86
|
-
CifraCesar::cesar(line.to_s, dat.to_i) if (@options.enc.casecmp?('cesar'))
|
87
|
-
DecifraCesar::cesar(line.to_s, dat.to_i, -1) if (@options.dec.casecmp?('cesar'))
|
88
|
-
}
|
89
|
-
else;
|
90
|
-
CifraCesar::cesar(@options.algo.to_s, dat.to_i) if (@options.enc.casecmp?('cesar'))
|
91
|
-
DecifraCesar::cesar(@options.algo.to_s, dat.to_i, -1) if (@options.dec.casecmp?('cesar'))
|
37
|
+
else
|
38
|
+
if (@options.cipher.include?(@options.enc.capitalize))
|
39
|
+
CoBreak::Cifrado::cipher(@options.enc, @options.algo.to_s)
|
40
|
+
end
|
41
|
+
if (@options.cipher.include?(@options.dec.capitalize))
|
42
|
+
CoBreak::Decifrado::cipher(@options.dec,@options.algo.to_s)
|
43
|
+
end
|
92
44
|
end
|
93
45
|
end
|
94
46
|
end
|
@@ -98,94 +50,25 @@ module CoBreak
|
|
98
50
|
@options = $options
|
99
51
|
@options.encrypt = "" if @options.encrypt.nil? == true
|
100
52
|
@options.decrypt = "" if @options.decrypt.nil? == true
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
line.chomp!
|
105
|
-
EnCrypt::md4(line) if (@options.encrypt.casecmp?("md4"))
|
106
|
-
DeCrypt::md4(line) if (@options.decrypt.casecmp?("md4"))
|
107
|
-
}
|
108
|
-
else
|
109
|
-
EnCrypt::md4(@options.algo) if (@options.encrypt.casecmp?("md4"))
|
110
|
-
DeCrypt::md4(@options.algo) if (@options.decrypt.casecmp?("md4"))
|
111
|
-
end
|
112
|
-
elsif (@options.encrypt.casecmp?("md5")) or (@options.decrypt.casecmp?("md5"));
|
113
|
-
if (File.exists?(@options.algo));
|
114
|
-
IO.foreach(@options.algo){|line|
|
115
|
-
line.chomp!
|
116
|
-
EnCrypt::md5(line) if (@options.encrypt.casecmp?("md5"))
|
117
|
-
DeCrypt::md5(line) if (@options.decrypt.casecmp?("md5"))
|
118
|
-
}
|
119
|
-
else
|
120
|
-
EnCrypt::md5(@options.algo) if (@options.encrypt.casecmp?("md5"))
|
121
|
-
DeCrypt::md5(@options.algo) if (@options.decrypt.casecmp?("md5"))
|
122
|
-
end
|
123
|
-
elsif (@options.encrypt.casecmp?("sha1")) or (@options.decrypt.casecmp?("sha1"))
|
124
|
-
if (File.exists?(@options.algo));
|
125
|
-
IO.foreach(@options.algo){|line|
|
126
|
-
line.chomp!
|
127
|
-
EnCrypt::sha1(line) if (@options.encrypt.casecmp?("sha1"))
|
128
|
-
DeCrypt::sha1(line) if (@options.decrypt.casecmp?("sha1"))
|
129
|
-
}
|
130
|
-
else
|
131
|
-
EnCrypt::sha1(@options.algo) if (@options.encrypt.casecmp?("sha1"))
|
132
|
-
DeCrypt::sha1(@options.algo) if (@options.decrypt.casecmp?("sha1"))
|
133
|
-
end
|
134
|
-
elsif (@options.encrypt.casecmp?("sha224")) or (@options.decrypt.casecmp?("sha224"));
|
135
|
-
if (File.exists?(@options.algo));
|
136
|
-
IO.foreach(@options.algo){|line|
|
137
|
-
line.chomp!
|
138
|
-
EnCrypt::sha224(line) if (@options.encrypt.casecmp?("sha224"))
|
139
|
-
DeCrypt::sha224(line) if (@options.decrypt.casecmp?("sha224"))
|
140
|
-
}
|
141
|
-
else
|
142
|
-
EnCrypt::sha224(@options.algo) if (@options.encrypt.casecmp?("sha224"))
|
143
|
-
DeCrypt::sha224(@options.algo) if (@options.decrypt.casecmp?("sha224"))
|
144
|
-
end
|
145
|
-
elsif (@options.encrypt.casecmp?("sha256")) or (@options.decrypt.casecmp?("sha256"));
|
146
|
-
if (File.exists?(@options.algo));
|
147
|
-
IO.foreach(@options.algo){|line|
|
148
|
-
line.chomp!
|
149
|
-
EnCrypt::sha256(line) if (@options.encrypt.casecmp?("sha256"))
|
150
|
-
DeCrypt::sha256(line) if (@options.decrypt.casecmp?("sha256"))
|
151
|
-
}
|
152
|
-
else
|
153
|
-
EnCrypt::sha256(@options.algo) if (@options.encrypt.casecmp?("sha256"))
|
154
|
-
DeCrypt::sha256(@options.algo) if (@options.decrypt.casecmp?("sha256"))
|
155
|
-
end
|
156
|
-
elsif (@options.encrypt.casecmp?("sha384")) or (@options.decrypt.casecmp?("sha384"));
|
157
|
-
if (File.exists?(@options.algo));
|
158
|
-
IO.foreach(@options.algo){|line|
|
159
|
-
line.chomp!
|
160
|
-
EnCrypt::sha384(line) if (@options.encrypt.casecmp?("sha384"))
|
161
|
-
DeCrypt::sha384(line) if (@options.decrypt.casecmp?("sha384"))
|
162
|
-
}
|
163
|
-
else
|
164
|
-
EnCrypt::sha384(@options.algo) if (@options.encrypt.casecmp?("sha384"))
|
165
|
-
DeCrypt::sha384(@options.algo) if (@options.decrypt.casecmp?("sha384"))
|
166
|
-
end
|
167
|
-
elsif (@options.encrypt.casecmp?("sha512")) or (@options.decrypt.casecmp?("sha512"));
|
168
|
-
if (File.exists?(@options.algo));
|
169
|
-
IO.foreach(@options.algo){|line|
|
170
|
-
line.chomp!
|
171
|
-
EnCrypt::sha512(line) if (@options.encrypt.casecmp?("sha512"))
|
172
|
-
DeCrypt::sha512(line) if (@options.decrypt.casecmp?("sha512"))
|
173
|
-
}
|
174
|
-
else
|
175
|
-
EnCrypt::sha512(@options.algo) if (@options.encrypt.casecmp?("sha512"))
|
176
|
-
DeCrypt::sha512(@options.algo) if (@options.decrypt.casecmp?("sha512"))
|
177
|
-
end
|
178
|
-
elsif (@options.encrypt.casecmp?("ripemd160")) or (@options.decrypt.casecmp?("ripemd160"));
|
53
|
+
show = OpenStruct.new
|
54
|
+
show.hash = %w[MD4 MD5 SHA1 SHA224 SHA256 SHA384 SHA512 RIPEMD160]
|
55
|
+
if (show.hash.include?(@options.encrypt.upcase)) or (show.hash.include?(@options.decrypt.upcase));
|
179
56
|
if (File.exists?(@options.algo));
|
180
57
|
IO.foreach(@options.algo){|line|
|
181
|
-
|
182
|
-
|
183
|
-
|
58
|
+
line.chomp!
|
59
|
+
EnCrypt::show(@options.encrypt, line) if (show.hash.include?(@options.encrypt.upcase))
|
60
|
+
DeCrypt::show(@options.decrypt, line) if (show.hash.include?(@options.decrypt.upcase))
|
184
61
|
}
|
185
62
|
else
|
186
|
-
|
187
|
-
|
63
|
+
if (show.hash.include?(@options.encrypt.upcase))
|
64
|
+
EnCrypt::show(@options.encrypt, @options.algo)
|
65
|
+
end
|
66
|
+
if (show.hash.include?(@options.decrypt.upcase))
|
67
|
+
DeCrypt::show(@options.decrypt, @options.algo)
|
68
|
+
end
|
188
69
|
end
|
70
|
+
else
|
71
|
+
abort "\e[31m[\e[0m✘\e[31m]\e[0m Invalid Hash Format"
|
189
72
|
end
|
190
73
|
end
|
191
74
|
end
|
data/lib/cobreak/decifrado.rb
CHANGED
@@ -2,31 +2,33 @@ require 'base64'
|
|
2
2
|
require 'base32'
|
3
3
|
require 'base16'
|
4
4
|
require 'ascii85'
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
5
|
+
require 'cobreak/cesar'
|
6
|
+
require 'cobreak/binary'
|
7
|
+
module CoBreak
|
8
|
+
class Decifrado
|
9
|
+
def self.cipher(mode, dato)
|
10
|
+
decipher = OpenStruct.new
|
11
|
+
decipher.mode = mode
|
12
|
+
decipher.dato = dato
|
13
|
+
if (decipher.mode.eql?('base16'))
|
14
|
+
decipher.result = Base16.decode16(decipher.dato)
|
15
|
+
elsif (decipher.mode.eql?('base32'))
|
16
|
+
decipher.result = Base32.decode(decipher.dato)
|
17
|
+
elsif (decipher.mode.eql?('base64'))
|
18
|
+
decipher.result = Base64.decode64(decipher.dato)
|
19
|
+
elsif (decipher.mode.eql?('ascii85'))
|
20
|
+
decipher.result = Ascii85.decode(decipher.dato)
|
21
|
+
elsif (decipher.mode.eql?('cesar'))
|
22
|
+
decipher.result = Cesar.cesar(decipher.dato, ARGV[0].to_i, -1)
|
23
|
+
elsif (decipher.mode.eql?('binary'))
|
24
|
+
decipher.result = CoBreak::Binary.hexbinary(decipher.dato)
|
25
|
+
end
|
26
|
+
unless (decipher.result.nil?) or (decipher.result.eql?(decipher.dato))
|
27
|
+
puts "\n\e[1;32m[\e[0m+\e[1;32m]\e[0m Ciphertext: #{decipher.result}"
|
28
|
+
puts "\e[1;32m[\e[0m+\e[1;32m]\e[0m Number Rotations: #{ARGV[0]}" if (decipher.mode.eql?('cesar'))
|
29
|
+
else
|
30
|
+
puts "\e[1;31m[\e[0m+\e[1;31m]\e[0m Not Cipher Text..."
|
31
|
+
end
|
32
|
+
end
|
30
33
|
end
|
31
34
|
end
|
32
|
-
Decifra = Decifrado.new
|
data/lib/cobreak/decrypt.rb
CHANGED
@@ -2,109 +2,42 @@ require 'openssl'
|
|
2
2
|
require 'sequel'
|
3
3
|
require 'cobreak/version'
|
4
4
|
class Decrypt
|
5
|
-
def
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
print "\e[1;32m[\e[0m+\e[1;32m]\e[0m Decrypted Text: "
|
42
|
-
puts dbs[:hashes].filter(hash:dato).map(:original)
|
43
|
-
end
|
44
|
-
def sha224(dato, wordlist = File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'show', 'sha224.db'))
|
45
|
-
dbs = Sequel.sqlite
|
46
|
-
dbs.create_table? :hashes do
|
47
|
-
String :original
|
48
|
-
String :hash
|
49
|
-
end
|
50
|
-
IO.foreach(wordlist) {|line|
|
51
|
-
line.chomp!
|
52
|
-
dbs[:hashes] << {original:line, hash:OpenSSL::Digest::SHA224.hexdigest(line)}
|
53
|
-
}
|
54
|
-
print "\e[1;32m[\e[0m+\e[1;32m]\e[0m Decrypted Text: "
|
55
|
-
puts dbs[:hashes].filter(hash:dato).map(:original)
|
56
|
-
end
|
57
|
-
def sha256(dato, wordlist = File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'show', 'sha256.db'))
|
58
|
-
dbs = Sequel.sqlite
|
59
|
-
dbs.create_table? :hashes do
|
60
|
-
String :original
|
61
|
-
String :hash
|
62
|
-
end
|
63
|
-
IO.foreach(wordlist) {|line|
|
64
|
-
line.chomp!
|
65
|
-
dbs[:hashes] << {original:line, hash:OpenSSL::Digest::SHA256.hexdigest(line)}
|
66
|
-
}
|
67
|
-
print "\e[1;32m[\e[0m+\e[1;32m]\e[0m Decrypted Text: "
|
68
|
-
puts dbs[:hashes].filter(hash:dato).map(:original)
|
69
|
-
end
|
70
|
-
def sha384(dato, wordlist = File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'show', 'sha384.db'))
|
71
|
-
dbs = Sequel.sqlite
|
72
|
-
dbs.create_table? :hashes do
|
73
|
-
String :original
|
74
|
-
String :hash
|
75
|
-
end
|
76
|
-
IO.foreach(wordlist) {|line|
|
77
|
-
line.chomp!
|
78
|
-
dbs[:hashes] << {original:line, hash:OpenSSL::Digest::SHA384.hexdigest(line)}
|
79
|
-
}
|
80
|
-
print "\e[1;32m[\e[0m+\e[1;32m]\e[0m Decrypted Text: "
|
81
|
-
puts dbs[:hashes].filter(hash:dato).map(:original)
|
82
|
-
end
|
83
|
-
def sha512(dato, wordlist = File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'show', 'sha512.db'))
|
84
|
-
dbs = Sequel.sqlite
|
85
|
-
dbs.create_table? :hashes do
|
86
|
-
String :original
|
87
|
-
String :hash
|
88
|
-
end
|
89
|
-
IO.foreach(wordlist) {|line|
|
90
|
-
line.chomp!
|
91
|
-
dbs[:hashes] << {original:line, hash:OpenSSL::Digest::SHA512.hexdigest(line)}
|
92
|
-
}
|
93
|
-
print "\e[1;32m[\e[0m+\e[1;32m]\e[0m Decrypted Text: "
|
94
|
-
puts dbs[:hashes].filter(hash:dato).map(:original)
|
95
|
-
end
|
96
|
-
def ripemd160(dato, wordlist = File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'show', 'ripemd160.db'))
|
97
|
-
dbs = Sequel.sqlite
|
98
|
-
dbs.create_table? :hashes do
|
99
|
-
String :original
|
100
|
-
String :hash
|
101
|
-
end
|
102
|
-
IO.foreach(wordlist) {|line|
|
103
|
-
line.chomp!
|
104
|
-
dbs[:hashes] << {original:line, hash:OpenSSL::Digest::RIPEMD160.hexdigest(line)}
|
105
|
-
}
|
106
|
-
print "\e[1;32m[\e[0m+\e[1;32m]\e[0m Decrypted Text: "
|
107
|
-
puts dbs[:hashes].filter(hash:dato).map(:original)
|
5
|
+
def show(mode, dato)
|
6
|
+
decrypt = OpenStruct.new
|
7
|
+
decrypt.mode = mode.downcase
|
8
|
+
decrypt.wordlist = File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'show', "#{decrypt.mode}.db")
|
9
|
+
dbs = Sequel.sqlite
|
10
|
+
dbs.create_table? :hashes do
|
11
|
+
String :original
|
12
|
+
String :hash
|
13
|
+
end
|
14
|
+
if (decrypt.mode.eql?('md4'))
|
15
|
+
decrypt.hash = OpenSSL::Digest::MD4.new
|
16
|
+
elsif (decrypt.mode.eql?('md5'))
|
17
|
+
decrypt.hash = OpenSSL::Digest::MD5.new
|
18
|
+
elsif (decrypt.mode.eql?('sha1'))
|
19
|
+
decrypt.hash = OpenSSL::Digest::SHA1.new
|
20
|
+
elsif (decrypt.mode.eql?('sha224'))
|
21
|
+
decrypt.hash = OpenSSL::Digest::SHA224.new
|
22
|
+
elsif (decrypt.mode.eql?('sha256'))
|
23
|
+
decrypt.hash = OpenSSL::Digest::SHA256.new
|
24
|
+
elsif (decrypt.mode.eql?('sha384'))
|
25
|
+
decrypt.hash = OpenSSL::Digest::SHA384.new
|
26
|
+
elsif (decrypt.mode.eql?('sha512'))
|
27
|
+
decrypt.hash = OpenSSL::Digest::SHA512.new
|
28
|
+
elsif (decrypt.mode.eql?('ripemd160'))
|
29
|
+
decrypt.hash = OpenSSL::Digest::RIPEMD160.new
|
30
|
+
end
|
31
|
+
File.foreach(decrypt.wordlist) {|line|
|
32
|
+
line.chomp!
|
33
|
+
dbs[:hashes] << {original:line, hash:decrypt.hash.hexdigest(line)}
|
34
|
+
}
|
35
|
+
decrypt.pass = dbs[:hashes].filter(hash:dato).map(:original)
|
36
|
+
unless (decrypt.pass.empty?)
|
37
|
+
puts "\e[1;32m[\e[0m+\e[1;32m]\e[0m Hash Found: #{decrypt.pass.join(',')}"
|
38
|
+
else
|
39
|
+
puts "\e[1;31m[\e[0m+\e[1;31m]\e[0m Hash Not Found in Database..."
|
40
|
+
end
|
108
41
|
end
|
109
42
|
end
|
110
43
|
DeCrypt = Decrypt.new
|