Class: Cracklib::Password
- Inherits:
-
Object
- Object
- Cracklib::Password
- Extended by:
- FFI::Library
- Defined in:
- lib/rubylibcrack.rb
Constant Summary collapse
- POTENTIAL_DICT_PATHS =
%w(/usr/share/cracklib/pw_dict /usr/lib/cracklib_dict /usr/lib64/cracklib_dict /var/cache/cracklib/cracklib_dict)
- @@dictpath =
""
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(password) ⇒ Password
constructor
A new instance of Password.
- #strong?(dictpath = default_dictpath) ⇒ Boolean
- #weak?(dictpath = default_dictpath) ⇒ Boolean
Constructor Details
#initialize(password) ⇒ Password
Returns a new instance of Password.
14 15 16 |
# File 'lib/rubylibcrack.rb', line 14 def initialize(password) @password = password end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
6 7 8 |
# File 'lib/rubylibcrack.rb', line 6 def @message end |
Instance Method Details
#strong?(dictpath = default_dictpath) ⇒ Boolean
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rubylibcrack.rb', line 18 def strong?(dictpath = default_dictpath) if not valid_dictpath? dictpath raise "#{dictpath} is not a valid dictionary path!" end begin @message = check(@password, dictpath) return @message.nil? rescue return true end return false end |
#weak?(dictpath = default_dictpath) ⇒ Boolean
31 32 33 |
# File 'lib/rubylibcrack.rb', line 31 def weak?(dictpath = default_dictpath) not strong? dictpath end |