Method: ViolentRuby::UnixPasswordCracker#crack_passwords
- Defined in:
- lib/violent_ruby/unix_password_cracker/unix_password_cracker.rb
#crack_passwords(args = {}) {|Hash| ... } ⇒ Object Also known as: crack, crack!, get_crackn, release_the_kraken
Crack unix passwords.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/violent_ruby/unix_password_cracker/unix_password_cracker.rb', line 99 def crack_passwords(args = {}) # Use the file and dictionry instance variables or the arguments. file = args[:file] || @file dict = args[:dictionary] || @dictionary # Parse the given /etc/passwd file and compare with the dictionary. parse_etc_file(file: file) do |user, password| File.readlines(dict).map(&:strip).each do |word| if cracked?(password, word) yield format_result(user, password, word) break else yield format_result(user, password) end end end end |