Class: CoBreak::BruteForze

Inherits:
Object
  • Object
show all
Defined in:
lib/cobreak/force_brute.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ BruteForze

Returns a new instance of BruteForze.



7
8
9
10
# File 'lib/cobreak/force_brute.rb', line 7

def initialize(options)
  @options = options
  @hash = %w[MD4 MD5 SHA1 SHA224 SHA256 SHA384 SHA512 RIPEMD160]
end

Instance Method Details



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/cobreak/force_brute.rb', line 17

def banner_wordlist()
  puts "\e[0;31m"
  puts "cobreak".art("Bloody")
  puts "\e[0m"
  puts "\e[1;32m╭─[\e[37m CoBreak: #{CoBreak.version}"
  if (File.exists?(@options.wordlist.to_s))
    puts "\e[1;32m├─[\e[37m Wordlist: #{File.expand_path(@options.wordlist)}"
  else
    puts "\e[1;31m├─[\e[37m WordList Not Found"
  end
  if (@hash.include?(@options.bruteforce.to_s.upcase))
    puts "\e[1;32m├─[\e[37m Type Hash: #{@options.bruteforce.upcase}"
  else
    puts "\e[1;31m├─[\e[37m Type Hash Not Found"
  end
  unless (@options.algo.nil?) or (@options.algo.empty?)
    puts "\e[1;32m╰─[\e[37m Hash: #{@options.algo}\n\n"
  else
    puts "\e[1;31m╰─[\e[37m Hash Not Found"
  end
end

#wordlistObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/cobreak/force_brute.rb', line 38

def wordlist()
  if (@options.wordlist.nil?) or (@options.wordlist.empty?) or ('-'.include?(@options.wordlist.to_s))
    abort "\n"
  end
  if (@hash.include?(@options.bruteforce.to_s.upcase))
    if (File.exists?(@options.algo.to_s))
      begin
        IO.foreach(@options.algo.to_s){|line|
          line.chomp!
          if (@hash.include?(@options.bruteforce.to_s.upcase))
            ForzeBrute::word(line, @options.wordlist, @options.bruteforce.to_s, @options.out, @options.verbose)
          end
        }
      rescue ArgumentError => e
        puts e.message
      end
    else
      if (@hash.include?(@options.bruteforce.upcase.to_s))
        ForzeBrute::word(@options.algo.to_s, @options.wordlist, @options.bruteforce.to_s, @options.out, @options.verbose)
      end
    end
  end
end