passbox 2.0.0 → 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: 7f7ecaf34fb41df4dc4b08c057d4850dd824fb2008f42af37900fada39b55dab
4
- data.tar.gz: faaca8fd5355c9ee2b519afbfe6190efe20bb9f53cb2ac4731547d3f12d62f6d
3
+ metadata.gz: 90ceafe15e91672b29f6b5bfe56635e1201418f09ac29052f144dbdadb71b26e
4
+ data.tar.gz: 669582b1329e58ed3a6a2150c0c988ef323abb7cfa3f5a4bb3c229b229d3bcf1
5
5
  SHA512:
6
- metadata.gz: aa21924d9a86c26eb5c4cbeefaa376fb46bc9dee134d308f2b51994f1c74a5b90ee81df72c0ca551a8bb2a9ec0a35c559af1068dcc39ac17a7f0e7f1fd3e822b
7
- data.tar.gz: 762e06d5b9a53e9787c6b63aaa1410f6aded92a527e8a6b6350b7610497e94cd9d3ac21b1bdac59bf046c48eaa80933a412a89eb9fb931e715a3394cd8672f3e
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
data/lib/passbox/aes.rb CHANGED
@@ -18,7 +18,7 @@ module Passbox
18
18
  decipher = OpenSSL::Cipher::AES256.new(:CTR)
19
19
  decipher.decrypt
20
20
  decipher.iv = data[0..15]
21
- data = data[16..]
21
+ data = data[16..-1]
22
22
  decipher.key = key[0..31]
23
23
  decrypted_data = decipher.update(data) + decipher.final
24
24
  return decrypted_data
@@ -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.0
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.0
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-05 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.2.3
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'