passbox 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e0c8dfcfe0c35f8cb3e5057adbc1122d2d670a6fa0ed97d44e5655a4fd305bf5
4
- data.tar.gz: b13b397644588e4454c4c35a316c0ea8a5ec51153797f5cb3456b508775c650b
3
+ metadata.gz: 90ceafe15e91672b29f6b5bfe56635e1201418f09ac29052f144dbdadb71b26e
4
+ data.tar.gz: 669582b1329e58ed3a6a2150c0c988ef323abb7cfa3f5a4bb3c229b229d3bcf1
5
5
  SHA512:
6
- metadata.gz: 3bf7448c47f36b9533216029c193bbc03f8886323dce002bfff5e0d52ec39e1390c9c428813e6399999457c05965fb38b3f86a2b61cf2d3dfe1b2ee6f4895f83
7
- data.tar.gz: 4ba865bae5f0564f0fef6b1aa0660344bb538c231fb9f1fe6f6f93add08fef6263f6f432207ae33d8c669699f65b66eec06a0919512a67024e7421c830231b83
6
+ metadata.gz: d3e16665f6b58dffd624d2504e24ef783ce74143c0684d9f773b587f5fe40234422fe87d98dfdf7fd996ae6de3d662aac1af0ce1dc0b5a99fd36978e10dfc74c
7
+ data.tar.gz: 5200997df9adb2237e60634975447c2190efcdcd9591acea17d9db019c27816e522e4f3c81973fdf0b12232d6dd7477d349898092c7f9f6030bdf6d0d57c602c
data/bin/passbox CHANGED
@@ -30,6 +30,8 @@ def print_help
30
30
 
31
31
  -, delete delete an account from passbox.
32
32
  Usage: passbox delete | passbox del | passbox -
33
+
34
+ genpass Generates a secure password of chosen size
33
35
 
34
36
  HELP
35
37
  end
@@ -55,6 +57,8 @@ elsif ARGV.length == 1
55
57
  delete_pass
56
58
  when "list", "ls"
57
59
  list_of_accounts
60
+ when "genpass"
61
+ generate
58
62
  else
59
63
  puts "Invalid Command. Enter 'passbox help' to show usage.".red
60
64
  end
@@ -0,0 +1,49 @@
1
+ module Passbox
2
+
3
+ def generator_init
4
+ chars = "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWXyYzZ"
5
+ nums = "0123456789"
6
+ specials = "!@#$^&*()%,+-_.:;<>?/[]{}~|"
7
+
8
+ inclusion = chars+nums
9
+ print "Need Special characters in your password? (Y/n): "
10
+ special_chars_flag = user_input.downcase
11
+ inclusion = inclusion + specials if special_chars_flag == "y"
12
+ return inclusion
13
+ end
14
+
15
+ def password_size
16
+ attempts = 0
17
+ while(true)
18
+ if attempts == 3
19
+ print too_many_attempts.bold.red
20
+ exit(0)
21
+ end
22
+ print "Password length(8-25): "
23
+ passlen = user_input.to_i
24
+ if (passlen >= 8 && passlen <= 25)
25
+ return passlen
26
+ else
27
+ print invalid_input.red
28
+ attempts = attempts+1
29
+ next
30
+ end
31
+ end
32
+ end
33
+
34
+ def generate
35
+ set = generator_init.split("")
36
+ length = password_size
37
+ pwd = []
38
+ length.times do
39
+ i = rand(set.size-1)
40
+ set = set.shuffle
41
+ char = set[i]
42
+ set.delete(char)
43
+ pwd.push(char)
44
+ end
45
+ print "\nPassword is: #{pwd.join("")}\n\n"
46
+ end
47
+
48
+
49
+ end
@@ -50,4 +50,5 @@ module Passbox
50
50
  def auth_success; return "Authentication Successful!!\n"; end
51
51
  def auth_failed; return "Authentication Failed!!\n"; end
52
52
 
53
+ def invalid_input; return "Invalid Input. Try again!!\n"; end
53
54
  end
data/lib/passbox/init.rb CHANGED
@@ -8,8 +8,8 @@ module Passbox
8
8
  def init
9
9
  pass256=""
10
10
 
11
- if (Dir.exists?($pbdir))
12
- if(File.exists?($passfile))
11
+ if (Dir.exist?($pbdir))
12
+ if(File.exist?($passfile))
13
13
  print pb_already_setup
14
14
  return
15
15
  else
@@ -23,7 +23,7 @@ module Passbox
23
23
  end
24
24
 
25
25
  def check_passbox
26
- if !File.exists?($passfile)
26
+ if !File.exist?($passfile)
27
27
  print pb_not_setup
28
28
  exit(0)
29
29
  end
data/lib/passbox/version CHANGED
@@ -1 +1 @@
1
- 2.0.1
1
+ 2.0.2
data/lib/passbox.rb CHANGED
@@ -9,4 +9,5 @@ require 'passbox/crud/delete'
9
9
  require 'passbox/helpers/options'
10
10
  require 'passbox/helpers/colourize'
11
11
  require 'passbox/helpers/strings'
12
+ require 'passbox/helpers/generator'
12
13
  include Passbox
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaushal Rupani
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-08 00:00:00.000000000 Z
11
+ date: 2023-12-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A gem to store and manage password offline, encrypted using AES 256 strong
14
14
  encryption.
@@ -30,6 +30,7 @@ files:
30
30
  - lib/passbox/crud/read.rb
31
31
  - lib/passbox/crud/update.rb
32
32
  - lib/passbox/helpers/colourize.rb
33
+ - lib/passbox/helpers/generator.rb
33
34
  - lib/passbox/helpers/options.rb
34
35
  - lib/passbox/helpers/strings.rb
35
36
  - lib/passbox/init.rb
@@ -53,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
54
  - !ruby/object:Gem::Version
54
55
  version: '0'
55
56
  requirements: []
56
- rubygems_version: 3.0.9
57
+ rubygems_version: 3.4.10
57
58
  signing_key:
58
59
  specification_version: 4
59
60
  summary: 'PassBox gem : AES encrypted offline password manager'