stupid_password 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,107 @@
1
+ # Stupid Password
2
+
3
+ PasswordStupidityChecker.new.is_stupid? "alexander"
4
+ => "Is that a male name?"
5
+
6
+ ## Description
7
+
8
+ Tell users their passwords are stupid and guessable.
9
+ Save time on 'my password was stolen' support requests.
10
+
11
+ ## Synopsis
12
+
13
+ gem install stupid_password
14
+
15
+ In Ruby:
16
+
17
+ require 'stupid_password'
18
+
19
+ class PasswordStupidityChecker
20
+ include StupidPassword
21
+ end
22
+
23
+ PasswordStupidityChecker.new.is_stupid? "alexander"
24
+ => "Is that a male name?"
25
+
26
+ If you're like to waste in namespace, you can include directly to String (which is highly not recommended):
27
+
28
+ String.send :include, StupidPassword
29
+
30
+ "valera".is_stupid?
31
+ => "Is that a male name?"
32
+
33
+ ## Contribute
34
+
35
+ Fork, create topic branch, modify code, write tests, run tests, push, send me a pull request.
36
+
37
+ Or, you can create a plugin and reference it on Wiki.
38
+ Example plugin code:
39
+
40
+ class StupidPassword::Modifier::Reverse
41
+ def self.modify password
42
+ return 'reversed', password.reverse
43
+ end
44
+ end
45
+
46
+ PasswordStupidityChecker.new.is_stupid? "rednaxela"
47
+ => "Is that a reversed male name?"
48
+
49
+ # Inspiration
50
+
51
+ http://habrahabr.ru/post/113401/
52
+ http://habrahabr.ru/post/132880/
53
+ http://habrahabr.ru/post/138127/
54
+ http://habrahabr.ru/post/138726/
55
+ http://habrahabr.ru/post/145658/
56
+ http://habrahabr.ru/post/147840/
57
+ http://habrahabr.ru/company/abbyy/blog/149396/
58
+ http://habrahabr.ru/post/80130/
59
+ http://habrahabr.ru/post/2388/
60
+ http://habrahabr.ru/post/75345/
61
+ http://xato.net/passwords/more-top-worst-passwords/
62
+
63
+ # Roadmap
64
+
65
+ * Implement permutations
66
+ * Use language specific dictionaries eg https://github.com/yohasebe/engtagger/blob/master/lib/engtagger/words.yml
67
+ * Use aspell ffi-aspell
68
+ * Allow configuration of which checks should (not) be run, i.e. "Spanish dictionary only", "limit permutations to 2 at once"
69
+ * i18n for messages
70
+ * Check compositions (with all modifier permutations), ie "alex1234"
71
+ * Allow double checks ('monkey' => Is that an english word AND is it in top25 popular passwords?)
72
+ * Implement benchmarks, refactor
73
+
74
+ # Contributors
75
+
76
+ ...none yet
77
+
78
+ # Links
79
+
80
+ * [Code](https://github.com/pirj/stupid_password)
81
+ * [Wiki](https://github.com/pirj/stupid_password/wiki)
82
+ * [Author](https://github.com/pirj)
83
+
84
+ ## License
85
+
86
+ (The MIT License)
87
+
88
+ Copyright (c) 2012 Phil Pirozhkov
89
+
90
+ Permission is hereby granted, free of charge, to any person obtaining
91
+ a copy of this software and associated documentation files (the
92
+ 'Software'), to deal in the Software without restriction, including
93
+ without limitation the rights to use, copy, modify, merge, publish,
94
+ distribute, sublicense, and/or sell copies of the Software, and to
95
+ permit persons to whom the Software is furnished to do so, subject to
96
+ the following conditions:
97
+
98
+ The above copyright notice and this permission notice shall be
99
+ included in all copies or substantial portions of the Software.
100
+
101
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
102
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
103
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
104
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
105
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
106
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
107
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,20 @@
1
+ module StupidPassword
2
+
3
+ def is_stupid? password=self
4
+ StupidPassword::Base.constants.each do |clazz_name|
5
+ clazz = Base.const_get clazz_name
6
+ clazz.guess password
7
+ end
8
+
9
+ #TODO check with all permutations of modifiers
10
+
11
+ false # Probably not so stupid
12
+ rescue Stupid => guessed
13
+ "Is that a #{guessed.message}?"
14
+ end
15
+ end
16
+
17
+ require 'stupid_password/stupid'
18
+ require 'stupid_password/version'
19
+ require 'stupid_password/base'
20
+ require 'stupid_password/modifier'
@@ -0,0 +1,17 @@
1
+ module StupidPassword::Base
2
+ end
3
+
4
+ require 'stupid_password/base/name'
5
+ require 'stupid_password/base/top10'
6
+
7
+ # TODO:
8
+ # Sequence
9
+ # Date
10
+ # Band
11
+ # Mean
12
+ # Sport
13
+ # City
14
+ # State
15
+ # Country
16
+ # Word
17
+ # Site name
@@ -0,0 +1,9 @@
1
+ class StupidPassword::Base::Name
2
+ MALE_NAMES = %w{alexander alex andrey andrew basil claire vladimir vasily}
3
+ FEMALE_NAMES = %w{alexandra vera nadejda lubov}
4
+
5
+ def self.guess password
6
+ raise StupidPassword::Stupid.new 'male name' if MALE_NAMES.include? password
7
+ raise StupidPassword::Stupid.new 'female name' if FEMALE_NAMES.include? password
8
+ end
9
+ end
@@ -0,0 +1,93 @@
1
+ #TODO
2
+
3
+ #Myspace:
4
+ # password1
5
+ # abc123
6
+ # myspace1
7
+ # password
8
+ # blink182
9
+ # qwerty1
10
+ # fuckyou
11
+ # 123abc
12
+ # baseball1
13
+ # football1
14
+ # 123456
15
+ # soccer
16
+ # monkey1
17
+ # liverpool1
18
+ # princess1
19
+ # jordan23
20
+ # slipknot1
21
+ # superman1
22
+ # iloveyou1
23
+ # monkey
24
+
25
+ #Yahoo:
26
+ # 123456 1666 0.38%
27
+ # password 780 0.18%
28
+ # welcome 436 0.1%
29
+ # ninja 333 0.08%
30
+ # abc123 250 0.06%
31
+ # 123456789 222 0.05%
32
+ # 12345678 208 0.05%
33
+ # sunshine 205 0.05%
34
+ # princess 202 0.05%
35
+ # qwerty
36
+
37
+ # by SplashData:
38
+ # password
39
+ # 123456
40
+ # 12345678
41
+ # qwerty
42
+ # abc123
43
+ # monkey
44
+ # 1234567
45
+ # letmein
46
+ # trustno1
47
+ # dragon
48
+ # baseball
49
+ # 111111
50
+ # iloveyou
51
+ # master
52
+ # sunshine
53
+ # ashley
54
+ # bailey
55
+ # passw0rd
56
+ # shadow
57
+ # 123123
58
+ # 654321
59
+ # superman
60
+ # qazwsx
61
+ # michael
62
+ # football
63
+
64
+ #LinkedIn:
65
+ # link
66
+ # 1234
67
+ # work
68
+ # god
69
+ # job
70
+ # 12345
71
+ # angel
72
+ # the
73
+ # ilove
74
+ # sex
75
+ # jesus
76
+ # connect
77
+ # fuck
78
+ # monkey
79
+ # 123456
80
+ # master
81
+ # bitch
82
+ # dick
83
+ # michael
84
+ # jordan
85
+ # dragon
86
+ # killer
87
+ # 654321
88
+ # pepper
89
+ # devil
90
+ # princess
91
+ # 1234567
92
+ # iloveyou
93
+ # carreer
@@ -0,0 +1,10 @@
1
+ module StupidPassword::Modifier
2
+ end
3
+
4
+ require 'stupid_password/modifier/upcase'
5
+ require 'stupid_password/modifier/downcase'
6
+ require 'stupid_password/modifier/capitalize'
7
+
8
+ # TODO
9
+ # translit
10
+ # keyboard layout
@@ -0,0 +1,13 @@
1
+ class StupidPassword::Modifier::Capitalize
2
+ def self.modify password
3
+ password.capitalize
4
+ end
5
+
6
+ def self.prefix
7
+ 'capitalized'
8
+ end
9
+
10
+ def self.postfix
11
+ ''
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ class StupidPassword::Modifier::Downcase
2
+ def self.modify password
3
+ password.downcase
4
+ end
5
+
6
+ def self.prefix
7
+ ''
8
+ end
9
+
10
+ def self.postfix
11
+ 'in lower case'
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ class StupidPassword::Modifier::Upcase
2
+ def self.modify password
3
+ password.downcase
4
+ end
5
+
6
+ def self.prefix
7
+ ''
8
+ end
9
+
10
+ def self.postfix
11
+ 'in upper case'
12
+ end
13
+ end
@@ -0,0 +1,2 @@
1
+ class StupidPassword::Stupid < StandardError
2
+ end
@@ -0,0 +1,3 @@
1
+ module StupidPassword
2
+ VERSION = "0.0.1"
3
+ end
data/spec/base_spec.rb ADDED
@@ -0,0 +1,8 @@
1
+ require 'spec_helper.rb'
2
+
3
+ describe StupidPassword::Base do
4
+ it "detects names" do
5
+ 'alexander'.is_stupid?.should eq "Is that a male name?"
6
+ 'rnieciunm'.is_stupid?.should eq false
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ require 'stupid_password'
2
+
3
+ String.send :include, StupidPassword
@@ -0,0 +1,20 @@
1
+ require File.expand_path('../lib/stupid_password/version', __FILE__)
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.name = "stupid_password"
5
+ gem.version = StupidPassword::VERSION
6
+ # gem.date = ???
7
+ gem.summary = "Stupid password detector"
8
+ gem.description = "Tell users their passwords are stupid and guessable."
9
+
10
+ gem.homepage = "http://github.com/pirj/stupid_password"
11
+ gem.authors = ["Phil Pirozhkov"]
12
+
13
+ gem.files = `git ls-files`.split("\n")
14
+ gem.test_files = `git ls-files -- {spec}/*`.split("\n")
15
+ gem.require_paths = ["lib"]
16
+
17
+ # gem.add_runtime_dependency 'ffi-aspell'
18
+
19
+ gem.add_development_dependency 'rspec', '~> 2.0'
20
+ end
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: stupid_password
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Phil Pirozhkov
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-18 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '2.0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '2.0'
30
+ description: Tell users their passwords are stupid and guessable.
31
+ email:
32
+ executables: []
33
+ extensions: []
34
+ extra_rdoc_files: []
35
+ files:
36
+ - README.md
37
+ - lib/stupid_password.rb
38
+ - lib/stupid_password/base.rb
39
+ - lib/stupid_password/base/name.rb
40
+ - lib/stupid_password/base/top10.rb
41
+ - lib/stupid_password/modifier.rb
42
+ - lib/stupid_password/modifier/capitalize.rb
43
+ - lib/stupid_password/modifier/downcase.rb
44
+ - lib/stupid_password/modifier/upcase.rb
45
+ - lib/stupid_password/stupid.rb
46
+ - lib/stupid_password/version.rb
47
+ - spec/base_spec.rb
48
+ - spec/spec_helper.rb
49
+ - stupid_password.gemspec
50
+ homepage: http://github.com/pirj/stupid_password
51
+ licenses: []
52
+ post_install_message:
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ requirements: []
69
+ rubyforge_project:
70
+ rubygems_version: 1.8.24
71
+ signing_key:
72
+ specification_version: 3
73
+ summary: Stupid password detector
74
+ test_files: []