rb_safe 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +4 -0
- data/Gemfile +5 -0
- data/LICENSE +21 -0
- data/README.md +82 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/rb_safe.rb +2 -0
- data/lib/rb_safe/constant.rb +6 -0
- data/lib/rb_safe/safe.rb +81 -0
- data/lib/rb_safe/version.rb +3 -0
- data/lib/rb_safe/words.dat +10000 -0
- data/lib/rb_safe/words.rb +39 -0
- data/rb_safe.gemspec +41 -0
- metadata +109 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module RbSafe
|
|
2
|
+
class Words
|
|
3
|
+
def common_passwords
|
|
4
|
+
load_words
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
private
|
|
8
|
+
|
|
9
|
+
def load_words
|
|
10
|
+
cache_name = "rb_safe-#{VERSION}.words.cache"
|
|
11
|
+
cache_file = ENV.fetch('RUBY_SAFE_WORDS_CACHE',
|
|
12
|
+
"#{Dir.tmpdir}/#{cache_name}")
|
|
13
|
+
# Load from cache if it exists.
|
|
14
|
+
if File.exist?(cache_file)
|
|
15
|
+
# TODO: deal with the exception.
|
|
16
|
+
return Marshal.load(File.open(cache_file, 'rb'))
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Convert the data to a hash.
|
|
20
|
+
words_file = ENV.fetch(
|
|
21
|
+
'RUBY_SAFE_WORDS_FILE',
|
|
22
|
+
"#{File.dirname(File.realdirpath(__FILE__))}/words.dat")
|
|
23
|
+
words = {}
|
|
24
|
+
File.open(words_file, 'rb') do |file|
|
|
25
|
+
file.readlines.each do |line|
|
|
26
|
+
name, freq = line.split
|
|
27
|
+
words[name] = freq.to_i
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Cache the words.
|
|
32
|
+
File.open(cache_file, 'wb') do |file|
|
|
33
|
+
Marshal.dump(words, file)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
words
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
data/rb_safe.gemspec
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'rb_safe/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "rb_safe"
|
|
8
|
+
spec.version = RbSafe::VERSION
|
|
9
|
+
spec.authors = ["lord63"]
|
|
10
|
+
spec.email = ["lord63.j@gmail.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{Check the password's strength for you.}
|
|
13
|
+
spec.description = <<-EOF
|
|
14
|
+
RbSafe will check the password's strength for you:
|
|
15
|
+
|
|
16
|
+
*. password's length
|
|
17
|
+
*. contain lower letters, upper letters, numbers and marks
|
|
18
|
+
*. in the order on the keyboard
|
|
19
|
+
*. simple alphabet by step
|
|
20
|
+
*. common used passwords
|
|
21
|
+
EOF
|
|
22
|
+
spec.homepage = "https://github.com/lord63/rb_safe"
|
|
23
|
+
spec.license = "MIT"
|
|
24
|
+
|
|
25
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
|
26
|
+
# delete this section to allow pushing this gem to any host.
|
|
27
|
+
if spec.respond_to?(:metadata)
|
|
28
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
|
29
|
+
else
|
|
30
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
34
|
+
spec.bindir = "exe"
|
|
35
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
36
|
+
spec.require_paths = ["lib"]
|
|
37
|
+
|
|
38
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
|
39
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
40
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
|
41
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: rb_safe
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- lord63
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2016-05-09 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.11'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.11'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: minitest
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '5.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '5.0'
|
|
55
|
+
description: |2
|
|
56
|
+
RbSafe will check the password's strength for you:
|
|
57
|
+
|
|
58
|
+
*. password's length
|
|
59
|
+
*. contain lower letters, upper letters, numbers and marks
|
|
60
|
+
*. in the order on the keyboard
|
|
61
|
+
*. simple alphabet by step
|
|
62
|
+
*. common used passwords
|
|
63
|
+
email:
|
|
64
|
+
- lord63.j@gmail.com
|
|
65
|
+
executables: []
|
|
66
|
+
extensions: []
|
|
67
|
+
extra_rdoc_files: []
|
|
68
|
+
files:
|
|
69
|
+
- ".gitignore"
|
|
70
|
+
- ".travis.yml"
|
|
71
|
+
- Gemfile
|
|
72
|
+
- LICENSE
|
|
73
|
+
- README.md
|
|
74
|
+
- Rakefile
|
|
75
|
+
- bin/console
|
|
76
|
+
- bin/setup
|
|
77
|
+
- lib/rb_safe.rb
|
|
78
|
+
- lib/rb_safe/constant.rb
|
|
79
|
+
- lib/rb_safe/safe.rb
|
|
80
|
+
- lib/rb_safe/version.rb
|
|
81
|
+
- lib/rb_safe/words.dat
|
|
82
|
+
- lib/rb_safe/words.rb
|
|
83
|
+
- rb_safe.gemspec
|
|
84
|
+
homepage: https://github.com/lord63/rb_safe
|
|
85
|
+
licenses:
|
|
86
|
+
- MIT
|
|
87
|
+
metadata:
|
|
88
|
+
allowed_push_host: https://rubygems.org
|
|
89
|
+
post_install_message:
|
|
90
|
+
rdoc_options: []
|
|
91
|
+
require_paths:
|
|
92
|
+
- lib
|
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
94
|
+
requirements:
|
|
95
|
+
- - ">="
|
|
96
|
+
- !ruby/object:Gem::Version
|
|
97
|
+
version: '0'
|
|
98
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - ">="
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: '0'
|
|
103
|
+
requirements: []
|
|
104
|
+
rubyforge_project:
|
|
105
|
+
rubygems_version: 2.5.1
|
|
106
|
+
signing_key:
|
|
107
|
+
specification_version: 4
|
|
108
|
+
summary: Check the password's strength for you.
|
|
109
|
+
test_files: []
|