phoenix_password 1.0.0 → 1.0.1
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 +4 -4
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +186 -0
- data/Rakefile +6 -0
- data/lib/phoenix_password/version.rb +3 -0
- data/lib/phoenix_password.rb +799 -0
- data/lib/realistic.rb +307 -0
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83d0eb354fbfdc1b3de02c1c3660273adda26023
|
4
|
+
data.tar.gz: 104b23c7112f0ffe1cf9aec3a065b42d61e8352b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00cf5b95bd04ad171621aa365d2fdc98ef6f80bca662e06c04afee7a92fe7cd654580fc03de610b5b06144704192b39db7a93f76b68ae3e214b611aad77f65bb
|
7
|
+
data.tar.gz: 97fdc6eee52695e8fc5ec067bfe401528db35fbba708dbc8de73260e03e23b228a2ce10ccee7d3d71a11e643cb2bae00288f73b9b6a6d93f6574a91c8dff9b94
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at spirosa84@hotmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Spiros Avlonitis
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,186 @@
|
|
1
|
+
# PhoenixPassword
|
2
|
+
|
3
|
+
The PhoenixPassword generator gem is intended to be used
|
4
|
+
in password recovery operations or random password generation
|
5
|
+
purposes.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'phoenix_password'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install phoenix_password
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
In order to generate combinations simply add the minimum of the required options here is an irb example:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
irb(main):001:0> require 'phoenix_password'
|
28
|
+
=> true
|
29
|
+
irb(main):002:0> PhoenixPassword.new.combinations({:piped=>true,:type=>'matching',:cmb_length=>[6],:characters=>[0,1,2,3,4,5,6,7,8,9]})
|
30
|
+
```
|
31
|
+
001273
|
32
|
+
|
33
|
+
001274
|
34
|
+
|
35
|
+
001275
|
36
|
+
|
37
|
+
.....
|
38
|
+
|
39
|
+
## Manual
|
40
|
+
This is a list of the options available to you and what they do
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
obj_a=PhoenixPassword.new()
|
44
|
+
obj_b=PhoenixPassword.new({:rules=>true})
|
45
|
+
obj_c=PhoenixPassword.new({:rules=>true,:stricness=>2})
|
46
|
+
obj_d=PhoenixPassword.new({:rules=>true,:stricness=>2,:own_rules=>[/regexp_a/,regexp_b]})
|
47
|
+
```
|
48
|
+
|
49
|
+
You can initialize a PhoenixPassword object in 4 different ways.
|
50
|
+
|
51
|
+
**a)No arguments:**
|
52
|
+
This means that there will be no extra combination restriction rules other than the ones defined in the combinations method.
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
obj_a=PhoenixPassword.new()
|
56
|
+
```
|
57
|
+
|
58
|
+
**b)rules**
|
59
|
+
By setting rules to true there is an extra combination filter added, namely any combinations that have alternating letter digit value get discarded: 0a0a0a or a0a0a0 etc.
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
obj_b=PhoenixPassword.new({:rules=>true})
|
63
|
+
```
|
64
|
+
**c)strictness**
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
obj_b=PhoenixPassword.new({:rules=>true,:stricness=>2})
|
68
|
+
```
|
69
|
+
When using rules you can also change the strictness level of combination filtering.By default it is set to 0 meaning no other combinations will be filtered other than what rules filters on its own.
|
70
|
+
|
71
|
+
When using a level say 2 you are implementing the filters provided by 0,1 and 2.If you use 3 the you use 0,1,2 and 3
|
72
|
+
filters.
|
73
|
+
|
74
|
+
There are 4 levels in total:
|
75
|
+
X=digit,A=letter
|
76
|
+
|
77
|
+
Level 0:
|
78
|
+
default filtering XAXAXA or AXAXAX
|
79
|
+
|
80
|
+
Level 1:
|
81
|
+
Filters combinations that are half digits or half letters
|
82
|
+
XXXAAA or AAAXXX.
|
83
|
+
|
84
|
+
Level 2:
|
85
|
+
Filters combinations that have only digits XXXXXX
|
86
|
+
|
87
|
+
Level 3:
|
88
|
+
Filters combinations that have only letters AAAAAA
|
89
|
+
|
90
|
+
|
91
|
+
**d)own_rules**
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
obj_d=PhoenixPassword.new({:rules=>true,:stricness=>2,:own_rules=>[/regexp_a/,regexp_b]})
|
95
|
+
```
|
96
|
+
|
97
|
+
If you want to use your own combination filtering rules you must use the own_rules key and add an array with Regexp objects.
|
98
|
+
|
99
|
+
The rules that you will add will be implemented after all the rules that are used by the strictness level have been checked.Make sure when using your rules that you don't filter twice things that have been already checked.
|
100
|
+
|
101
|
+
==================================================================================================
|
102
|
+
```ruby
|
103
|
+
:piped=>(true or false)
|
104
|
+
```
|
105
|
+
Lets you decide whether you want to pipe the results to an other program
|
106
|
+
or write them to a file.
|
107
|
+
|
108
|
+
```ruby
|
109
|
+
:cmb_length=>([5] or [5,6])
|
110
|
+
```
|
111
|
+
Set the length of the possible combinations to be generated if
|
112
|
+
there is more than one value first all the combinations with the
|
113
|
+
starting value are generated and then once done combinations of
|
114
|
+
the following length are generated till all the values have been used.
|
115
|
+
|
116
|
+
```ruby
|
117
|
+
:characters=>["e","x","m","p","l","e",1]
|
118
|
+
```
|
119
|
+
Sets the characters that will be used in the combination generation process.
|
120
|
+
|
121
|
+
```ruby
|
122
|
+
:extra_chars=>["x",1] (Optional)
|
123
|
+
```
|
124
|
+
Set extra characters to be used one at a time if the initial characters,minimum value 1 char.
|
125
|
+
Note that when etxra_chars are used only combinations that include them will be written to file.
|
126
|
+
|
127
|
+
```ruby
|
128
|
+
:type=>("matching" or "unique")
|
129
|
+
```
|
130
|
+
Sets which type of combinations to be generated.
|
131
|
+
Matching: Characters repeating them selves any number of times xx or xxx
|
132
|
+
Unique:Characters are different in every position xz or xzx
|
133
|
+
|
134
|
+
```ruby
|
135
|
+
:match_limit=> 2 (:optional)
|
136
|
+
```
|
137
|
+
Set the max matching characters for each combination example:
|
138
|
+
|
139
|
+
2 = xxabc, axxbc,abxxc,abcxx
|
140
|
+
|
141
|
+
3 = xxxab, axxxb,abxxx
|
142
|
+
|
143
|
+
Note that you can set the limit to more than 3 but file size info will
|
144
|
+
not be accurate.
|
145
|
+
|
146
|
+
```ruby
|
147
|
+
:skip_first=>(true |false) (Optional)
|
148
|
+
```
|
149
|
+
Used with extra_chars allows you to skip the first iteration with the
|
150
|
+
main characters thus starting from the extra characters.Useful if you
|
151
|
+
want to continue from where you left off.
|
152
|
+
|
153
|
+
```ruby
|
154
|
+
:uniqueness_type=>("repeat"|"singe") (Optional)
|
155
|
+
```
|
156
|
+
If not set all possible unique combinations are generated i.e reappearing char xzx,single char xyz
|
157
|
+
When set to repeat only reappearing character combinations are generated xzx
|
158
|
+
When set to single only single character appearance combinations are generated xzy.
|
159
|
+
|
160
|
+
|
161
|
+
```ruby
|
162
|
+
:cap_limit=>1 or more (optional)
|
163
|
+
|
164
|
+
```
|
165
|
+
When used it ensures that each combination generated will contain only the amount of capital letters specified.
|
166
|
+
|
167
|
+
**Note that file size and combination estimates when using match_limit may not be accurate**
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
## Development
|
173
|
+
|
174
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
175
|
+
|
176
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
177
|
+
|
178
|
+
## Contributing
|
179
|
+
|
180
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/phoenix_password. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
181
|
+
|
182
|
+
|
183
|
+
## License
|
184
|
+
|
185
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
186
|
+
|
data/Rakefile
ADDED