Class: PasswordCrack::PasswordChecker

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

Instance Method Summary collapse

Instance Method Details

#check(password) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/password_crack.rb', line 44

def check password

  return 'number_1_to_6' if password.scan(/^\d{1,6}$/).length >0

  result =  check_by_dict password,'week_password_sample'

  return result if result

  return check_by_dict password,'birthday'


end

#check_by_dict(password, dict_name) ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/password_crack.rb', line 58

def check_by_dict password,dict_name
      d =   Dict.new dict_name
      File.open(d.create).each_line() do |pass|
 
          pass.chomp!

           return dict_name if pass == password 

      end

      return nil
end