password_genie 0.0.2 → 0.0.3

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/password_genie.rb +66 -45
  3. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7375e6bf07aaf97b993d813f7c7514d91247ef9b
4
- data.tar.gz: e56338fc10a5591589416c6935270f3f8e39dfef
3
+ metadata.gz: 264939c29e562aa811909ebf4f0b1411591e7f6f
4
+ data.tar.gz: 78e93ee7c119594f56b49f51091482436ef21a91
5
5
  SHA512:
6
- metadata.gz: 7b6027b613c34c3d8d8b9c72e20e85ff148d0d7a80d1ae35257e83b713b02e7c31cef784d5ea1ebaf717adffc13c36217e3d80ce404ad16a04edb0eb7ec3373a
7
- data.tar.gz: 044212e408c397fb5a6534a8635ccb988be07a67bb1dfc117302fd92a8c799f117532a5287ffa1dba6b6311b23cb6769787dc28942c020b734757e55e3faf09c
6
+ metadata.gz: c026c2146ff942d094c6696959a44ddd636e500f8e80b3df31e9e44efa225cd4b9ec07fbef55d4eda442d891a9d70b6589b310346a2d6186ca81b35f004accb4
7
+ data.tar.gz: a52e0357411ec77b2ea8f507dbcc1a0dc7a6f21129b2a95f36a780d77a3097f056ccbdc88c54013ca872dddd248a21fffd60a22fb263b1b89d1e293352e071c9
@@ -48,16 +48,14 @@ class WordBank
48
48
  def create
49
49
  i = number
50
50
  while i != 0
51
- if i == 2 && (@password_ary.include?([@special_chars]) == false && word_bank.include?(@special_chars))
52
- @password_ary << @special_chars[rand(1..@special_chars.size)]
53
- elsif i == 1 && (@password_ary.include?(@numbers) == false && word_bank.include?(@numbers))
51
+ if i == 2 && word_bank.include?(@special_chars) && @password_ary.include?(@special_chars) == false
52
+ @password_ary << @special_chars[rand(0..@special_chars.size)]
53
+ puts "1 == 2"
54
+ elsif i == 1 && word_bank.include?(@numbers) && @password_ary.include?(@numbers) == false
54
55
  @password_ary << @numbers[rand(1..@numbers.size)]
56
+ puts "i == 1"
55
57
  end
56
- letter = rand(1..word_bank.size)
57
- if letter == nil
58
- next
59
- end
60
- puts "letter: #{word_bank[letter]} and num: #{letter}"
58
+ letter = rand(0..word_bank.size)
61
59
  @password_ary << word_bank[letter]
62
60
  word_bank.delete_at(letter)
63
61
  i -= 1
@@ -73,50 +71,73 @@ class WordBank
73
71
  f.puts("[#{site}] username: #{username} | password: #{@password}")
74
72
  end
75
73
  end
74
+
75
+ def find_info(info)
76
+ return "please create a password directory first" unless File.exist?('site_info.txt')
77
+ IO.foreach('site_info.txt') do |line|
78
+ return line if line.include?(info)
79
+ end
80
+ return "no match"
81
+ end
76
82
  end
77
83
 
78
84
  go = true
79
85
 
80
86
  while go
81
- puts "HELLO. You will now design a custom password!"
82
- puts "How long do you want your password to be?"
83
-
84
- number = gets.chomp.to_i
85
- if number == 1
86
- word_number = "character"
87
- else
88
- word_number = "characters"
89
- end
90
- puts "your word bank will contain #{number} #{word_number}."
91
-
92
- puts "please compile your word bank:"
93
- words = gets.chomp
87
+ puts "enter [1] to CREATE a new password\nenter [2] to LOOKUP a password."
94
88
 
95
- x = WordBank.new(words, number)
89
+ choice = gets.chomp.to_i
96
90
 
97
- puts 'do you wish to include special characters such as "." "," and "$"? [y/n]'
98
- special_char = gets.chomp
99
- x.add_special_chars unless special_char == "n"
100
- puts "do you wish to include numbers? [y/n]"
101
- num_chc = gets.chomp
102
- x.add_numbers unless num_chc == 'n'
103
- x.create
104
-
105
- puts "done.\n\n"
106
- puts "\tto save, please enter 'save'"
107
- choice = gets.chomp.downcase
108
- if choice == 'save' || choice == 's' || choice == 'yes' || choice == 'y'
109
- puts "enter site"
110
- site = gets.chomp.downcase
111
- puts "enter username"
112
- username = gets.chomp.to_s
113
- x.save_info(site,username)
91
+ if choice == 1
92
+ puts "ou will now design a custom password!"
93
+ puts "How long do you want your password to be?"
94
+
95
+ number = gets.chomp.to_i
96
+ if number == 1
97
+ word_number = "character"
98
+ else
99
+ word_number = "characters"
100
+ end
101
+ puts "your word bank will contain #{number} #{word_number}."
102
+
103
+ puts "please compile your word bank:"
104
+ words = gets.chomp
105
+
106
+ x = WordBank.new(words, number)
107
+
108
+ puts 'do you wish to include special characters such as "." "," and "$"? [y/n]'
109
+ special_char = gets.chomp
110
+ x.add_special_chars unless special_char == "n"
111
+ puts "do you wish to include numbers? [y/n]"
112
+ num_chc = gets.chomp
113
+ x.add_numbers unless num_chc == 'n'
114
+ x.create
115
+
116
+ puts "done.\n\n"
117
+ puts "\tto save, please enter 'save'"
118
+ choice = gets.chomp.downcase
119
+ if choice == 'save' || choice == 's' || choice == 'yes' || choice == 'y'
120
+ puts "enter site"
121
+ site = gets.chomp.downcase
122
+ puts "enter username"
123
+ username = gets.chomp.to_s
124
+ x.save_info(site,username)
125
+ end
126
+
127
+ puts "go again? [y/n]"
128
+ choice = gets.chomp
129
+ unless choice == 'y'
130
+ go = false
131
+ end
132
+ next
133
+ elsif choice == 2
134
+ print "enter the word you want to search for (usually site or username): "
135
+ word = gets.chomp.to_s
136
+ x = WordBank.new(word)
137
+ puts x.find_info(word)
138
+ next
139
+ else
140
+ next
114
141
  end
115
142
 
116
- puts "go again? [y/n]"
117
- choice = gets.chomp
118
- unless choice == 'y'
119
- go = false
120
- end
121
- next
122
143
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: password_genie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - fookh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-01 00:00:00.000000000 Z
11
+ date: 2018-12-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: a simple tool to 1. build a password based on user defined parameters
14
- and 2. archive passwords, usernames, and corresponding site data
13
+ description: a simple tool to build a password based on user defined parameters 2.
14
+ archive passwords, usernames, and corresponding site data 3. search data
15
15
  email: foo@yetispeak.com
16
16
  executables: []
17
17
  extensions: []
@@ -41,5 +41,5 @@ rubyforge_project:
41
41
  rubygems_version: 2.5.2.1
42
42
  signing_key:
43
43
  specification_version: 4
44
- summary: password_genie
44
+ summary: introduces a search feature
45
45
  test_files: []