password_genie 0.0.8 → 0.0.9

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: 8c2d1d40e660997048117a34dc8ec59831ef0d6b
4
- data.tar.gz: 23a86db34df9af8cb315de2a3ca7bbe9a50971d9
3
+ metadata.gz: e771197f9ee21c8a84f56a0bdefe99f46ad1b4ee
4
+ data.tar.gz: 8061797c62d7a3f12234917350ce9e6da8d858c8
5
5
  SHA512:
6
- metadata.gz: ad1f93196ab03d3287e6b83f22ea4347a04f66c04652de09604687d50d8065536d826d9c4def43617438357525b6b3bd0db648fbe3bde2d97c341b7f7901eacb
7
- data.tar.gz: 0c4d99db84672a9d1706e457b9420b7400bcce7aadfdff045d781249fffad474f56309d9b585d0c4a4ad8b3b38adeeadcf35dad741511b54d976ae114592ebc7
6
+ metadata.gz: 5c73c32567b6025003576ec6549b077644b8f38a595458492421dfa37a7d27f22832145581b3dc59b76ce8d17256174a6f591272f2a3368ff2340cc4d1a91645
7
+ data.tar.gz: ba9e2e3f33354f6f9957512964c3efb1a1cd0def55aea453eeba203123c1707fd9ad7cceda405f7f860c004b5f752159aa0cdb25b02e8c1d36beed79fda8e80e
@@ -7,13 +7,14 @@ go = true
7
7
 
8
8
  while go
9
9
  puts "enter [1] to CREATE a new password\nenter [2] to LOOKUP a password"
10
- puts "enter [3] to ADD/CHANGE an already existing password\nenter [4] to EXIT"
10
+ puts "enter [3] to ADD a password\nenter [4] to CHANGE an existing password"
11
+ puts "enter [5] to EXIT"
11
12
 
12
13
  choice = gets.chomp.to_i
13
14
 
14
15
  if choice == 1
15
16
  puts "you will now design a custom password!"
16
- puts "How long do you want your password to be?"
17
+ print "How long do you want your password to be?: "
17
18
 
18
19
  number = gets.chomp.to_i
19
20
  unless number.is_a?(Integer)
@@ -29,7 +30,7 @@ while go
29
30
  end
30
31
  puts "your word bank will contain #{number} #{word_number}."
31
32
 
32
- puts "please compile your word bank:"
33
+ print "please compile your word bank: "
33
34
  words = gets.chomp
34
35
  if words == '' || words == ' '
35
36
  next
@@ -37,26 +38,26 @@ while go
37
38
 
38
39
  x = WordBank.new(words, number)
39
40
 
40
- puts 'do you wish to include special characters such as "." "," and "$"? [y/n]'
41
+ print 'do you wish to include special characters such as "." "," and "$"? [y/n]: '
41
42
  special_char = gets.chomp
42
43
  x.add_special_chars unless special_char == "n"
43
- puts "do you wish to include numbers? [y/n]"
44
+ print "do you wish to include numbers? [y/n]: "
44
45
  num_chc = gets.chomp
45
46
  x.add_numbers unless num_chc == 'n'
46
47
  x.create
47
48
 
48
49
  puts "done.\n\n"
49
- puts "\tto save, please enter 'save'"
50
+ print "\tto save, please enter 'save': "
50
51
  choice = gets.chomp.downcase
51
52
  if choice == 'save' || choice == 's' || choice == 'yes' || choice == 'y'
52
- puts "enter site"
53
+ print "enter site: "
53
54
  site = gets.chomp.downcase
54
- puts "enter username"
55
+ print "enter username: "
55
56
  username = gets.chomp.to_s
56
57
  x.save_info(site,username)
57
58
  end
58
59
 
59
- puts "go again? [y/n]"
60
+ print "go again? [y/n]: "
60
61
  choice = gets.chomp
61
62
  unless choice == 'y'
62
63
  go = false
@@ -66,9 +67,9 @@ while go
66
67
  print "enter the word you want to search for (usually site or username): "
67
68
  word = gets.chomp.to_s
68
69
  x = WordBank.new(word)
69
- puts x.find_info(word)
70
+ x.find_info(word)
70
71
  next
71
- elsif choice == 3
72
+ elsif choice == 3 || choice == 4
72
73
  puts "**MUST supply an EXISTING site and username**"
73
74
  print "enter site: "
74
75
  site = gets.chomp
@@ -78,12 +79,21 @@ while go
78
79
  puts "BOTH site and username must be filled in. Back to the beginning."
79
80
  next
80
81
  end
81
- print "enter password: "
82
+ if choice == 3
83
+ print "enter password: "
84
+ else
85
+ print "enter new password: "
86
+ end
82
87
  password = gets.chomp
83
- x = WordBank.new(site)
84
- x.add_or_replace_info(site,username,password)
88
+ if password != ''
89
+ x = WordBank.new(site)
90
+ x.add_or_replace_info(site, username, password, choice)
91
+ else
92
+ print "password can't be blank."
93
+ next
94
+ end
85
95
  next
86
- elsif choice == 4
96
+ elsif choice == 5
87
97
  go = false
88
98
  else
89
99
  next
@@ -56,14 +56,13 @@ class WordBank
56
56
  def create
57
57
  i = @number
58
58
  until i == 0
59
- if i == 2 && (@word_bank.include?(@special_chars) == true && @password_ary.include?(@special_chars) == false)
59
+ if i == 2 && (!(@word_bank & @special_chars).empty? && (@password_ary & @special_chars).empty?)
60
60
  @password_ary << @special_chars[rand(0..@special_chars.size - 1)]
61
61
  end
62
- if i == 1 && (@word_bank.include?(@numbers) == true && @password_ary.include?(@numbers) == false)
62
+ if i == 1 && (!(@word_bank & @numbers).empty? && (@password_ary & @numbers).empty?)
63
63
  @password_ary << @numbers[rand(0..@numbers.size - 1)]
64
64
  end
65
65
  letter = rand(0..word_bank.size - 1)
66
- #puts "#{i}, #{word_bank[letter]}"
67
66
  @password_ary << word_bank[letter]
68
67
  word_bank.delete_at(letter)
69
68
  i -= 1
@@ -103,6 +102,7 @@ class WordBank
103
102
  print_out.each do |line|
104
103
  puts "[%5s] %8s | %s" % [line[1], line[2], line[3]]
105
104
  end
105
+ puts
106
106
  rescue SQLite3::Exception => e
107
107
  puts e
108
108
  ensure
@@ -110,15 +110,24 @@ class WordBank
110
110
  end
111
111
  end
112
112
 
113
- def add_or_replace_info(site, username, password)
113
+ def add_or_replace_info(site, username, password, choice)
114
114
  begin
115
115
  db = SQLite3::Database.open('genie.db')
116
116
  return "please set up database by restarting and choosing [1]" unless File.file?('genie.db')
117
117
  puts db.get_first_value "select SQLite_VERSION()"
118
118
  db.transaction
119
- db.execute2 "UPDATE site_info SET Password = :password WHERE Site = :site AND Username = :username", password, site, username
119
+ if choice == 3
120
+ db.execute2 "INSERT into site_info(Site, Password, Username) values(:site, :password, :username)" , site, password, username
121
+ else
122
+ db.execute2 "UPDATE site_info SET Password = :password WHERE Site = :site AND Username = :username" , password, site, username
123
+ end
120
124
  db.commit
121
- puts "you made #{db.changes} changes."
125
+ if db.changes != 1
126
+ alter = "changes"
127
+ else
128
+ alter = "change"
129
+ end
130
+ puts "you made #{db.changes} #{alter}."
122
131
  rescue SQLite3::Exception => e
123
132
  puts e
124
133
  db.rollback
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.8
4
+ version: 0.0.9
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-05 00:00:00.000000000 Z
11
+ date: 2019-03-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: |-
14
- a simple tool to build a password sqlite repository based on user defined parameters 2. archive passwords, usernames, and corresponding site data 3. and search data
15
- emaiL foo [] yetispeak dot com to collaborate
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
16
16
  email: foo@yetispeak.com
17
17
  executables: []
18
18
  extensions: []
@@ -20,7 +20,7 @@ extra_rdoc_files: []
20
20
  files:
21
21
  - lib/password_genie.rb
22
22
  - lib/password_genie_cl.rb
23
- homepage: http://rubygems.org/gems/password_genie
23
+ homepage: https://github.com/mepyyeti/password_genie
24
24
  licenses:
25
25
  - MIT
26
26
  metadata: {}
@@ -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 softened printouts
46
+ summary: debugged and expanded options
47
47
  test_files: []