dynarex-password 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dynarex-password.rb +21 -1
- metadata +1 -1
data/lib/dynarex-password.rb
CHANGED
@@ -9,7 +9,10 @@ class DynarexPassword
|
|
9
9
|
attr_reader :dynarex
|
10
10
|
|
11
11
|
def initialize()
|
12
|
-
|
12
|
+
super()
|
13
|
+
end
|
14
|
+
|
15
|
+
def generate_lookup()
|
13
16
|
@temp_list = []
|
14
17
|
@dynarex = Dynarex.new('codes/code(index,value)')
|
15
18
|
|
@@ -18,7 +21,24 @@ class DynarexPassword
|
|
18
21
|
|
19
22
|
chars.each do |char|
|
20
23
|
@dynarex.create index: char, value: get_random_chars(2) if char
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def lookup(weak_password, file=nil)
|
28
|
+
|
29
|
+
if file then
|
30
|
+
dynarex = Dynarex.new file
|
31
|
+
elsif @dynarex then
|
32
|
+
dynarex = @dynarex
|
33
|
+
else
|
34
|
+
return 'please supply a lookup file'
|
35
|
+
end
|
36
|
+
|
37
|
+
string = weak_password.split(//).map do |char|
|
38
|
+
dynarex.records[char][:body][:value]
|
21
39
|
end
|
40
|
+
|
41
|
+
string.join
|
22
42
|
end
|
23
43
|
|
24
44
|
def save(filepath) @dynarex.save filepath, pretty: true end
|