dynarex-password 0.1.10 → 0.1.11
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/dynarex-password.rb +23 -21
- metadata +29 -21
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56a7acf3d31b2590f85eeec15a7342330c20296f
|
4
|
+
data.tar.gz: 95427ebada7bfe0e53d7b88403549102f8b77ede
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8c7c343952431389ffa4526c2a1c17f6b613b46f2d2b55c941c715a182585cbc7fd03a066ab1fdaff12f1d65abf0bef7ebbe282aca32337c5345752784c06bc
|
7
|
+
data.tar.gz: a002acf822c4bf702394c403a609abed7f91a8132c87ada599139e8c1607e13be3a5ed384ca346bbe257404a4a91ac08f66a5cb55af90d898489458093047711
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/dynarex-password.rb
CHANGED
@@ -6,7 +6,7 @@ require 'dynarex'
|
|
6
6
|
|
7
7
|
class DynarexPassword
|
8
8
|
|
9
|
-
attr_reader :
|
9
|
+
attr_reader :dx
|
10
10
|
|
11
11
|
def initialize()
|
12
12
|
super()
|
@@ -15,35 +15,36 @@ class DynarexPassword
|
|
15
15
|
# if a fized size of 2 is passed in then each character will generate
|
16
16
|
# exactly 2 random alphanumeric characters
|
17
17
|
#
|
18
|
-
def generate_lookup(fixed_size
|
18
|
+
def generate_lookup(fixed_size: nil)
|
19
19
|
|
20
20
|
@fixed_size = fixed_size
|
21
21
|
@temp_list = []
|
22
|
-
@
|
22
|
+
@dx = Dynarex.new('codes/code(index,value)')
|
23
23
|
|
24
|
-
chars = (0..9).to_a + Array.new(7) + ('A'..'Z').to_a
|
24
|
+
chars = (0..9).to_a + Array.new(7) + ('A'..'Z').to_a \
|
25
|
+
+ Array.new(6) + ('a'..'z').to_a
|
25
26
|
@chars = (0..9).to_a + ('A'..'Z').to_a + ('a'..'z').to_a
|
26
27
|
|
27
28
|
chars.each do |char|
|
28
|
-
@
|
29
|
+
@dx.create index: char, value: get_random_chars(2) if char
|
29
30
|
end
|
30
31
|
end
|
31
32
|
|
32
33
|
def lookup(weak_password, file=nil)
|
33
34
|
|
34
|
-
if file then
|
35
|
-
|
36
|
-
elsif @
|
37
|
-
|
35
|
+
dx = if file then
|
36
|
+
Dynarex.new file
|
37
|
+
elsif @dx
|
38
|
+
@dx
|
38
39
|
else
|
39
|
-
|
40
|
+
raise 'dynarex-password: please supply a lookup file'
|
40
41
|
end
|
41
42
|
|
42
|
-
|
43
|
-
char[/[0-9A-Za-z]/] ?
|
43
|
+
chars = weak_password.split(//).map do |char|
|
44
|
+
char[/[0-9A-Za-z]/] ? dx.records[char][:body][:value] : char
|
44
45
|
end
|
45
46
|
|
46
|
-
|
47
|
+
chars.join
|
47
48
|
end
|
48
49
|
|
49
50
|
alias encrypt lookup
|
@@ -53,15 +54,15 @@ class DynarexPassword
|
|
53
54
|
#
|
54
55
|
def reverse_lookup(password, file=nil)
|
55
56
|
|
56
|
-
if file then
|
57
|
-
|
58
|
-
elsif @
|
59
|
-
|
57
|
+
dx = if file then
|
58
|
+
Dynarex.new file
|
59
|
+
elsif @dx
|
60
|
+
@dx
|
60
61
|
else
|
61
|
-
|
62
|
+
raise 'dynarex-password: please supply a lookup file'
|
62
63
|
end
|
63
64
|
|
64
|
-
h =
|
65
|
+
h = dx.to_h.inject({}){|r, x| r.merge({x[:value] => x[:index]})}
|
65
66
|
|
66
67
|
password.split('-').map do |linex|
|
67
68
|
linex.split('_').map do |x|
|
@@ -73,7 +74,7 @@ class DynarexPassword
|
|
73
74
|
|
74
75
|
alias decrypt reverse_lookup
|
75
76
|
|
76
|
-
def save(filepath) @
|
77
|
+
def save(filepath) @dx.save filepath end
|
77
78
|
|
78
79
|
private
|
79
80
|
|
@@ -82,7 +83,8 @@ class DynarexPassword
|
|
82
83
|
size = @fixed_size ? @fixed_size : rand(upper_size)+1
|
83
84
|
newpass = Array.new(size, '').map{@chars[rand(@chars.size)]}.join
|
84
85
|
|
85
|
-
# return the encryption providing it
|
86
|
+
# return the encryption providing it
|
87
|
+
# doesn't already exist in the lookup table.
|
86
88
|
return !@temp_list.include?(newpass) ? newpass : get_random_chars(size)
|
87
89
|
|
88
90
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynarex-password
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,41 +10,49 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
13
|
+
MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
|
14
14
|
YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
|
15
|
-
|
15
|
+
8ixkARkWAmV1MB4XDTE1MDQxODEwMTgwNloXDTE2MDQxNzEwMTgwNlowSDESMBAG
|
16
16
|
A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
|
17
17
|
EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-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----END CERTIFICATE-----
|
32
|
-
date:
|
34
|
+
date: 2015-04-18 00:00:00.000000000 Z
|
33
35
|
dependencies:
|
34
36
|
- !ruby/object:Gem::Dependency
|
35
37
|
name: dynarex
|
36
38
|
requirement: !ruby/object:Gem::Requirement
|
37
39
|
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '1.2'
|
38
43
|
- - ">="
|
39
44
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
45
|
+
version: 1.2.90
|
41
46
|
type: :runtime
|
42
47
|
prerelease: false
|
43
48
|
version_requirements: !ruby/object:Gem::Requirement
|
44
49
|
requirements:
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '1.2'
|
45
53
|
- - ">="
|
46
54
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
55
|
+
version: 1.2.90
|
48
56
|
description:
|
49
57
|
email: james@r0bertson.co.uk
|
50
58
|
executables: []
|
@@ -64,7 +72,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
64
72
|
requirements:
|
65
73
|
- - ">="
|
66
74
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
75
|
+
version: 2.1.2
|
68
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
77
|
requirements:
|
70
78
|
- - ">="
|
@@ -72,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
80
|
version: '0'
|
73
81
|
requirements: []
|
74
82
|
rubyforge_project:
|
75
|
-
rubygems_version: 2.
|
83
|
+
rubygems_version: 2.4.6
|
76
84
|
signing_key:
|
77
85
|
specification_version: 4
|
78
86
|
summary: dynarex-password
|
metadata.gz.sig
CHANGED
Binary file
|