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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
# File 'lib/cobreak/optionpr.rb', line 10
def self.optparse(options)
begin
OptionParser.new do|param|
param.banner = "Usage: cobreak [--mode] [--options] [--input text or file]"
param.separator ''
param.separator "Mode Cipher:"
param.on('--encoding=[CIPHER]', String, 'encoding input text or file'){|en_co| options.enc = en_co}
param.on('--decoding=[CIPHER]', String, 'decoding input text or file'){|de_co| options.dec = de_co}
param.separator "Mode Cryptography"
param.on('--encrypt=[FORMAT]', String, 'encrypt parameter'){|en_en| options.encrypt = en_en}
param.separator "Mode BruteForce"
param.on('-b', '--bruteforce=DIGEST', String, 'brute force mode to crack a hash'){|modeforce|options.bruteforce = modeforce}
param.separator ""
param.separator "Options:"
param.on('-l', '--list=encoding or encrypt', String, 'list cipher types of hash formats'){|lin| options.list = lin}
param.on('-r', '--range MIN MAX', Array, "word chars length"){|rang| options.range = rang}
param.on('-c', '--chars CHARACTERS', String, 'character input to generate word lists'){|chars| options.chars = chars}
param.on('-w', '--wordlist=WORDLIST', 'Wordlist mode, read words from FILE or stadin (default: rockyou)'){|wordlist| options.wordlist = wordlist}
param.on('--show=[FORMAT]', String, 'show decrypted specific hash'){|de_en| options.decrypt = de_en}
param.on('-i', '--input FILE or TEXT', String, 'take file or text to carry out the process'){|alg| options.algo = alg}
param.on('-o', '--output FILe', String, 'output the software'){|out| options.out = out}
param.on('-v', '--verbose', 'verbose mode'){options.verbose = true}
param.on('--usage', 'show examples of use of this tool')do
puts "usage: cobreak [--mode] [--options] [--input] text or file"
puts ""
puts "cipher:"
puts ""
puts "cobreak --encoding=[CIPHER] --input text or file"
puts "cobreak --decoding=[CIPHER] --input text or file"
puts ""
puts "note that the cesar cipher mode has to have a number in front to know the rotations"
puts "examples: --encoding=cesar 5 --input hola"
puts ""
puts "bruteforce:"
puts ""
puts "cobreak --bruteforce=[ENCRYPT] --wordlist=[WORDLIST] --input text or file"
puts "cobreak --bruteforce=[ENCRYPT] --chars [CHARACTERS] --range MIN MAX --input text or file"
puts ""
end
param.on_tail('-V', '--version', 'show version'){puts "CoBreak version #{CoBreak.version}"; exit}
param.on_tail('-h', '--help', 'command to view help parameters'){puts param; exit}
param.separator ''
end.parse!
rescue OptionParser::MissingArgument => missing
if missing.to_s.include?("--wordlist")
options.wordlist = File.join(Gem.path[1], 'gems', "cobreak-#{CoBreak.version}", 'diccionario.txt')
elsif missing.to_s.include?("--chars")
options.chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
else
puts missing.message
end
ensure
if (options.wordlist == "rockyou")
unless (File.exists?(options.wordlist))
options.wordlist = File.join('/usr', 'share', 'wordlists', 'rockyou.txt')
end
end
end
CoBreak::Box.var(options)
case options.bruteforce
when ('1')
options.bruteforce = 'md4'
when ('2')
options.bruteforce = 'md5'
when ('3')
options.bruteforce = 'half-md5'
when ('4')
options.bruteforce = 'sha1'
when ('5')
options.bruteforce = 'double-sha1'
when ('6')
options.bruteforce = 'sha2-224'
when ('7')
options.bruteforce = 'sha2-256'
when ('8')
options.bruteforce = 'sha2-384'
when ('9')
options.bruteforce = 'sha2-512'
when ('10')
options.bruteforce = 'sha3-224'
when ('11')
options.bruteforce = 'sha3-256'
when ('12')
options.bruteforce = 'sha3-384'
when ('13')
options.bruteforce = 'sha3-512'
when ('14')
options.bruteforce = 'ripemd-160'
when ('15')
options.bruteforce = 'tiger-160'
when ('16')
options.bruteforce = 'blake2s-128'
when ('17')
options.bruteforce = 'blake2s-160'
when ('18')
options.bruteforce = 'blake2b-160'
when ('19')
options.bruteforce = 'blake2s-224'
when ('20')
options.bruteforce = 'blake2s-256'
when ('21')
options.bruteforce = 'blake2b-256'
when ('22')
options.bruteforce = 'blake2b-384'
when ('23')
options.bruteforce = 'blake2b-512'
when ('24')
options.bruteforce = 'whirlpool'
when ('25')
options.bruteforce = 'gost-streeboog-256'
when ('26')
options.bruteforce = 'gost-streeboog-512'
when ('27')
options.bruteforce = 'shake-128'
else
puts ""
end
if !(options.enc.nil?) or !(options.dec.nil?)
CoBreak::Box::Cipher.coding()
end
if !(options.encrypt.nil?) or !(options.decrypt.nil?)
CoBreak::Box::Cryptgraphy.crypt()
end
CoBreak::List.new(options)
unless (options.wordlist.nil?) or (options.wordlist.empty?)
bruteforce = CoBreak::BruteForze.new(options)
bruteforce.banner_wordlist()
bruteforce.wordlist
end
unless (options.chars.nil?) or (options.chars.empty?)
options.range << ARGV[0].to_i
brutechars = CoBreak::BruteChars.new(options)
brutechars.banner_chars()
brutechars.chars()
end
end
|