password_genie 0.0.9 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e771197f9ee21c8a84f56a0bdefe99f46ad1b4ee
4
- data.tar.gz: 8061797c62d7a3f12234917350ce9e6da8d858c8
3
+ metadata.gz: 9c4ff3e902c9ddb34e2a8a09946637d9bfde5459
4
+ data.tar.gz: 6459e25ed36a9d55f1fe77c4d77414294db5f2e0
5
5
  SHA512:
6
- metadata.gz: 5c73c32567b6025003576ec6549b077644b8f38a595458492421dfa37a7d27f22832145581b3dc59b76ce8d17256174a6f591272f2a3368ff2340cc4d1a91645
7
- data.tar.gz: ba9e2e3f33354f6f9957512964c3efb1a1cd0def55aea453eeba203123c1707fd9ad7cceda405f7f860c004b5f752159aa0cdb25b02e8c1d36beed79fda8e80e
6
+ metadata.gz: 5b7f341a39a6f1bd4c2ca4a9118654360be54e6df6c490d45ae4b2ba4c2c08e0d4f2c0f3958e43a2a16ace29e70241fd1cc4be5639faef84b861f67f18cf6b4b
7
+ data.tar.gz: f60e8f73df150c71104377996084dea31a19d3bbbaa6fb0c4857b2a949a5f169580af60823b551f63e8f12f643d3aa59e69bc934861a121e352307117a2385b6
@@ -16,36 +16,43 @@ while go
16
16
  puts "you will now design a custom password!"
17
17
  print "How long do you want your password to be?: "
18
18
 
19
- number = gets.chomp.to_i
20
- unless number.is_a?(Integer)
21
- puts "#{number} is not an Integer."
22
- puts "Please make a NUMERIC selection from above."
23
- next
19
+ number = gets.chomp
20
+
21
+ unless number = Integer(number) rescue next
24
22
  end
25
23
 
26
24
  if number == 1
27
25
  word_number = "character"
26
+ elsif number == 0
27
+ next
28
28
  else
29
29
  word_number = "characters"
30
30
  end
31
31
  puts "your word bank will contain #{number} #{word_number}."
32
32
 
33
- print "please compile your word bank: "
33
+ print "please compile your word bank ([Enter] for PIN): "
34
34
  words = gets.chomp
35
35
  if words == '' || words == ' '
36
- next
36
+ puts "you have elected to create a custom numeric pin"
37
37
  end
38
38
 
39
- x = WordBank.new(words, number)
40
-
41
- print 'do you wish to include special characters such as "." "," and "$"? [y/n]: '
42
- special_char = gets.chomp
43
- x.add_special_chars unless special_char == "n"
44
- print "do you wish to include numbers? [y/n]: "
45
- num_chc = gets.chomp
46
- x.add_numbers unless num_chc == 'n'
39
+ x = WordBank.new(words,number)
40
+ unless words == '' || words == ' '
41
+ print 'do you wish to include any capitalized letters from your word bank? [y/n]: '
42
+ cap_char = gets.chomp
43
+ x.add_caps unless cap_char == "n"
44
+ print 'do you wish to include special characters such as "." "," and "$"? [y/n]: '
45
+ special_char = gets.chomp
46
+ x.add_special_chars unless special_char == "n"
47
+ print "do you wish to include numbers? [y/n]: "
48
+ num_chc = gets.chomp
49
+ x.add_numbers unless num_chc == 'n'
50
+ end
51
+ if words == '' || words == ' '
52
+ x.add_numbers
53
+ end
47
54
  x.create
48
-
55
+
49
56
  puts "done.\n\n"
50
57
  print "\tto save, please enter 'save': "
51
58
  choice = gets.chomp.downcase
@@ -70,7 +77,9 @@ while go
70
77
  x.find_info(word)
71
78
  next
72
79
  elsif choice == 3 || choice == 4
73
- puts "**MUST supply an EXISTING site and username**"
80
+ if choice == 4
81
+ puts "**MUST supply an EXISTING site and username**"
82
+ end
74
83
  print "enter site: "
75
84
  site = gets.chomp
76
85
  print "enter username: "
@@ -79,10 +88,10 @@ while go
79
88
  puts "BOTH site and username must be filled in. Back to the beginning."
80
89
  next
81
90
  end
82
- if choice == 3
83
- print "enter password: "
84
- else
91
+ if choice == 4
85
92
  print "enter new password: "
93
+ else
94
+ print "enter password: "
86
95
  end
87
96
  password = gets.chomp
88
97
  if password != ''
@@ -6,9 +6,9 @@ require 'sqlite3'
6
6
  class WordBank
7
7
  attr_reader :word_bank, :number, :special_chars
8
8
 
9
- def word_bank=(words)
9
+ def word_bank= (words)
10
10
  if words == ""
11
- raise "can't be empty."
11
+ puts "you have elected to design a numeric PIN."
12
12
  end
13
13
  unless words.is_a?(String)
14
14
  raise "entry must be letters"
@@ -34,15 +34,24 @@ class WordBank
34
34
  def special_chars=(special_chars)
35
35
  @special_chars=[".",",","$"]
36
36
  end
37
-
38
- def initialize(words,number=8)
37
+
38
+ def initialize(words, number=8)
39
39
  self.word_bank= words
40
40
  self.number= number
41
- self.special_chars= special_chars.to_a
41
+ self.special_chars= special_chars
42
42
  @password_ary = []
43
43
  @numbers= (0..9).to_a
44
44
  end
45
45
 
46
+ def add_caps
47
+ @caps_bank = []
48
+ @word_bank.each do |letter|
49
+ @caps_bank << letter.upcase
50
+ end
51
+ @word_bank.concat(@caps_bank)
52
+ @caps_bank
53
+ end
54
+
46
55
  def add_special_chars
47
56
  @word_bank.concat(@special_chars)
48
57
  @word_bank
@@ -56,18 +65,25 @@ class WordBank
56
65
  def create
57
66
  i = @number
58
67
  until i == 0
59
- if i == 2 && (!(@word_bank & @special_chars).empty? && (@password_ary & @special_chars).empty?)
68
+ if !@words.nil?
69
+ if i == 3 && (!(@word_bank & @caps_bank).empty? && (@password_ary & @caps_bank).empty?)
70
+ @password_ary << @caps_bank[rand(0..@caps_bank.size - 1)]
71
+ end
72
+ if i == 2 && (!(@word_bank & @special_chars).empty? && (@password_ary & @special_chars).empty?)
60
73
  @password_ary << @special_chars[rand(0..@special_chars.size - 1)]
61
- end
62
- if i == 1 && (!(@word_bank & @numbers).empty? && (@password_ary & @numbers).empty?)
74
+ end
75
+ if i == 1 && (!(@word_bank & @numbers).empty? && (@password_ary & @numbers).empty?)
63
76
  @password_ary << @numbers[rand(0..@numbers.size - 1)]
77
+ end
78
+ else
79
+ letter = rand(0..word_bank.size - 1)
80
+ @password_ary << word_bank[letter]
81
+ @word_bank.delete_at(letter)
82
+ @password = @password_ary.join()
83
+
64
84
  end
65
- letter = rand(0..word_bank.size - 1)
66
- @password_ary << word_bank[letter]
67
- word_bank.delete_at(letter)
68
85
  i -= 1
69
- end
70
- @password = @password_ary.join()
86
+ end
71
87
  puts @password
72
88
  @password
73
89
  end
@@ -117,6 +133,7 @@ class WordBank
117
133
  puts db.get_first_value "select SQLite_VERSION()"
118
134
  db.transaction
119
135
  if choice == 3
136
+ db.execute2 "CREATE table if not exists site_info(Id INTEGER PRIMARY KEY, Site TEXT, Username TEXT, Password TEXT)"
120
137
  db.execute2 "INSERT into site_info(Site, Password, Username) values(:site, :password, :username)" , site, password, username
121
138
  else
122
139
  db.execute2 "UPDATE site_info SET Password = :password WHERE Site = :site AND Username = :username" , password, site, username
metadata CHANGED
@@ -1,18 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: password_genie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - fookh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-08 00:00:00.000000000 Z
11
+ date: 2019-03-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: a simple tool to build a password sqlite repository based on user defined
14
- parameters 2. archive passwords, usernames, and corresponding site data 3. and search
15
- data. requires sqlite3
13
+ description: a simple tool to build a password/pin number sqlite repository based
14
+ on user defined parameters 2. archive passwords/pin numbers, usernames, and corresponding
15
+ site data 3. and search data. requires sqlite3
16
16
  email: foo@yetispeak.com
17
17
  executables: []
18
18
  extensions: []
@@ -43,5 +43,5 @@ rubyforge_project:
43
43
  rubygems_version: 2.5.2.1
44
44
  signing_key:
45
45
  specification_version: 4
46
- summary: debugged and expanded options
46
+ summary: added pin number generating functionality
47
47
  test_files: []