gtk2passwordapp 5.1.0 → 5.2.1

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: 79485306d9e37506f0e8fa7448a241750025df9c
4
- data.tar.gz: c18908868eed76153a2fac67c35a29941d1fef87
3
+ metadata.gz: 8e1a7fc4482638c1e48e23e95acd85352c7394ef
4
+ data.tar.gz: d0e03faec80ad444b930b8f1154330c1a2b2aa0a
5
5
  SHA512:
6
- metadata.gz: f009160e3875f503e46c5c9188cf86a0bbff21779b823cdee3ff7776086f016583b571fcdabf1f7a2317bdc4a326f6e673737e839573b95f6353b5746eaa68cf
7
- data.tar.gz: 70b7a5347ed2f322458f0223cc6b1c9763e0e74a1d1b9ce9d047d18b57fe11d3c6efce4485fc56377c005991c33ca628c5f1f3125c9a96c9b00a3a702e3d5b20
6
+ metadata.gz: 4e3b17b4781554d70e0b44781f74bd503c330bf171f475db5f3c177d3688f49adf75b0e84f89e15c23137dfe00a2a296ade1f4c945259f2f31eae103aa09d52f
7
+ data.tar.gz: 6e5550cc6bda20473c448059816672d83427e0144f422aab0413ebde722ac96531979b0d4070337a65ab1750cf6388eb81cbc091838090aec6282cfec9cbc07b
@@ -1,19 +1,19 @@
1
- = Gtk2passwordapp
1
+ = Gtk2PasswordApp
2
2
 
3
3
  {<img src="https://badge.fury.io/rb/gtk2passwordapp.svg" alt="Gem Version" />}[http://badge.fury.io/rb/gtk2passwordapp]
4
4
 
5
- == DESCRIPTION:
5
+ == Description:
6
6
 
7
7
  Ruby-Gnome Password Manager.
8
8
 
9
9
  Uses Blowfish to encrypt the datafile.
10
- Features random password generator and clipboard use.
10
+ Features random password generator, clipboard use, and TOTP.
11
11
 
12
- == INSTALL:
12
+ == Install:
13
13
 
14
14
  sudo gem install gtk2passwordapp
15
15
 
16
- == HELP:
16
+ == Help:
17
17
 
18
18
  Usage:
19
19
  gtk2pwdV [:options]
@@ -21,42 +21,22 @@ Features random password generator and clipboard use.
21
21
  Options:
22
22
  -v --version Show version and exit
23
23
  -h --help Show help and exit
24
- Notes:
25
- With the --nogui option,
26
- one can give a pattern to filter by account names.
27
- On the first run, --nogui can be used to export
28
- version's 4 password data into version's 5 password data.
29
24
 
30
- == MORE:
25
+ == More:
31
26
 
32
27
  "Mouse Left Click" on window to get the application menu.
33
- Anything I thought could be customized I made configurable.
34
- See:
35
28
 
36
- ~/.config/gtk3app/gtk2passwordapp/config-?.?.yml
37
29
 
38
- You may want to change the following settings:
30
+ == Configuration:
31
+
32
+ ~/.config/gtk3app/gtk2passwordapp/config-?.?.yml
39
33
 
40
- [SharedSecretFile] You may prefer it to be a file in some removable media.
34
+ [Salt] If your master-password length is under 14(MinPwdLen), it'll append this Salt.
35
+ [TOTP] If password matches this pattern, it will show the time based one time code.
41
36
  [BackupFile] Although the GUI allows you to specify the file, this gives a default.
42
37
  [TooOld] I have this set for a year (in seconds).
43
- [CustomDigits] I have this as "ABC...XYZ" for CAPS.
44
- [Custom] I have this as CAPS. Describes CustomDigits.
45
-
46
- If you're updating from a previous version,
47
- you may need to edit the new config file to match you're previously edited changes.
48
-
49
- If you use a qrcode to enter your master password, and
50
- the result is a multiline string,
51
- gtk2passwordapp will assume you want the qgraph-sha256-digest.
52
- See gtk2passwordapp/gtk2pwdv.rb's #process_pwd_entries to see how that's done.
53
-
54
- If you add :Salt to the configuration file, it'll use the qgraph-sha256-digest
55
- of the entry salted as can be seen in #process_pwd_entries.
56
-
57
- Note that the initial set up of the mater-password still needs to be done explicitly.
58
- That is, you'll need to enter the final resulting string when setting the master-password.
59
- Again, see Gtk2PasswordApp::Gtk2PwdV#process_pwd_entries.
38
+ [CustomDigits] I have this as "3479ACEFHJKLMNPRTUVWXYabcdefghijkmnopqrstuvwxyz".
39
+ [Custom] I have this as "Custom".
60
40
 
61
41
  == LICENSE:
62
42
 
@@ -1,14 +1,17 @@
1
1
  #!/usr/bin/env ruby
2
+ module Gtk2PasswordApp
3
+ VERSION = '5.2.1'
4
+ end
2
5
 
3
- if a0 = ARGV.shift
4
- if ['-v', '--version'].include?(a0)
5
- require 'gtk2passwordapp/version'
6
- puts Gtk2PasswordApp::VERSION
7
- exit 0
8
- end
6
+ begin
7
+ if a1 = ARGV.shift
8
+ if ['-v', '--version'].include?(a1)
9
+ puts Gtk2PasswordApp::VERSION
10
+ exit 0
11
+ end
9
12
 
10
- if ['-h', '--help'].include?(a0)
11
- puts <<-HELP
13
+ if ['-h', '--help'].include?(a1)
14
+ puts <<-HELP
12
15
  Usage:
13
16
  gtk2pwdV [:options]
14
17
  gtk2pwdV --nogui [<pattern>]
@@ -18,62 +21,47 @@ Options:
18
21
  Notes:
19
22
  With the --nogui option,
20
23
  one can give a pattern to filter by account names.
21
- On the first run, --nogui can be used to export
22
- version's 4 password data into version's 5 password data.
23
- Expected file is:
24
+ Expected passwords data file is:
24
25
  ~/.cache/gtk3app/gtk2passwordapp/gtk2pwdV.dat
25
- HELP
26
- exit 0
27
- end
26
+ HELP
27
+ exit 0
28
+ end
28
29
 
29
- if a0 == '--nogui'
30
- require 'pp'
31
- require 'yaml_zlib_blowfish'
32
- print "Enter password: "
33
- PWD = $stdin.gets.strip
34
- system('clear; clear')
35
- F1 = File.expand_path('~/.cache/gtk3app/gtk2passwordapp/gtk2pwdV.dat')
36
- unless File.exist?(F1)
37
- F0 = File.expand_path('~/.cache/gtk3app/gtk2passwordapp/passwords.dat')
38
- if File.exist?(F0)
39
- class YZB < YamlZlibBlowfish
40
- def initialize(passphrase)
41
- key = Digest::SHA256.digest(passphrase)[0..15]
42
- @cipher = OpenSSL::Cipher::BF.new(:CBC)
43
- @cipher.key = key
44
- end
45
- end
46
- begin
47
- YamlZlibBlowfish.new(PWD).dump(F1, YZB.new(PWD).load(F0))
48
- $stderr.puts "Auto-exported:"
49
- $stderr.puts "\t#{F0} =>"
50
- $stderr.puts "\t#{F1}"
51
- rescue OpenSSL::Cipher::CipherError
52
- $stderr.puts "Bad password"
53
- exit 65
54
- end
55
- else
56
- $stderr.puts "No passwords file found."
57
- $stderr.puts "Expected: #{F1}"
30
+ if a1 == '--nogui'
31
+ dat = File.expand_path('~/.cache/gtk3app/gtk2passwordapp/gtk2pwdV.dat')
32
+ raise "Passwords data file missing: #{dat}" unless File.exist? dat
33
+ require 'pp'
34
+ require 'yaml_zlib_blowfish'
35
+ require 'base_convert'
36
+ system('clear; clear')
37
+ print "Enter password: "
38
+ pwd = $stdin.gets.strip
39
+ system('clear; clear')
40
+ print "Enter salt: "
41
+ pwd << $stdin.gets.strip
42
+ system('clear; clear')
43
+ pwd = BaseConvert::FromTo.new(:hex, :qgraph).convert Digest::SHA256.hexdigest pwd
44
+ begin
45
+ lst = YamlZlibBlowfish.new(pwd).load(dat)
46
+ rescue OpenSSL::Cipher::CipherError
47
+ $stderr.puts "Bad password"
48
+ exit 65
49
+ end
50
+ if pattern = ARGV.shift
51
+ pattern = Regexp.new(pattern, Regexp::IGNORECASE)
52
+ end
53
+ if ARGV.empty? # if ARGV is not empty, it's bad usage.
54
+ pp (pattern)? lst.select{|k,v|pattern.match(k)} : lst
55
+ exit 0
58
56
  end
59
57
  end
60
- begin
61
- LIST = YamlZlibBlowfish.new(PWD).load(F1)
62
- rescue OpenSSL::Cipher::CipherError
63
- $stderr.puts "Bad password"
64
- exit 65
65
- end
66
- if pattern = ARGV.shift
67
- pattern = Regexp.new(pattern, Regexp::IGNORECASE)
68
- end
69
- unless ARGV.shift
70
- pp (pattern)? LIST.select{|k,v|pattern.match(k)} : LIST
71
- exit 0
72
- end
73
- end
74
58
 
75
- $stderr.puts "Please match usage."
76
- exit 64
59
+ $stderr.puts "Please match usage."
60
+ exit 64
61
+ end
62
+ rescue RuntimeError
63
+ $stderr.puts $!
64
+ exit 66
77
65
  end
78
66
 
79
67
  require 'gtk2passwordapp'
@@ -1 +1 @@
1
- 5.1.0
1
+ 5.2.1
@@ -2,13 +2,13 @@
2
2
  require 'gtk3app'
3
3
 
4
4
  # Helper Gems.
5
+ require 'base32'
6
+ require 'totp'
5
7
  require 'yaml_zlib_blowfish'
6
8
  require 'super_random'
7
9
  require 'base_convert'
8
- require 'helpema'
9
10
 
10
11
  # This Gem.
11
- require_relative 'gtk2passwordapp/version.rb'
12
12
  require_relative 'gtk2passwordapp/config.rb'
13
13
  require_relative 'gtk2passwordapp/such_parts.rb'
14
14
  require_relative 'gtk2passwordapp/account.rb'
@@ -8,12 +8,12 @@ module Gtk2PasswordApp
8
8
  a0 = Rafini::Empty::ARRAY
9
9
 
10
10
  CONFIG = {
11
+ Salt: s0, # Password Salt
12
+ MinPwdLen: 14,
13
+ TOTP: /^[A-Z2-7]{16,}$/,
11
14
 
12
15
  # Password Data File
13
16
  PwdFile: "#{XDG['CACHE']}/gtk3app/gtk2passwordapp/gtk2pwdV.dat",
14
- # Shared Secret File
15
- # Consider using a file found in a removable flashdrive.
16
- SharedSecretFile: "#{XDG['CACHE']}/gtk3app/gtk2passwordapp/key.ssss",
17
17
  BackupFile: "#{ENV['HOME']}/Dropbox/gtk2pwdV.bak",
18
18
 
19
19
  # Mark Recent Selections
@@ -22,14 +22,11 @@ module Gtk2PasswordApp
22
22
  # Mark Old Passwords
23
23
  TooOld: 60*60*24*365, # Year
24
24
 
25
- # Timeout for qr-code read.
26
- QrcTimeOut: 15,
27
-
28
25
  # Password Generators
29
26
  Random: 'Random',
30
27
  AlphaNumeric: 'Alpha-Numeric',
31
- Custom: 'Caps',
32
- CustomDigits: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
28
+ Custom: 'Custom',
29
+ CustomDigits: '3479ACEFHJKLMNPRTUVWXYabcdefghijkmnopqrstuvwxyz',
33
30
 
34
31
  # Button Labels
35
32
  Go: 'Go',
@@ -126,7 +123,7 @@ module Gtk2PasswordApp
126
123
  about_dialog: {
127
124
  set_program_name: 'Password Manager',
128
125
  set_version: VERSION.semantic(0..1),
129
- set_copyright: '(c) 2014 CarlosJHR64',
126
+ set_copyright: '(c) 2017 CarlosJHR64',
130
127
  set_comments: 'A Gtk3App Password Manager',
131
128
  set_website: 'https://github.com/carlosjhr64/gtk2passwordapp',
132
129
  set_website_label: 'See it at GitHub!',
@@ -149,32 +149,20 @@ class Gtk2PwdV
149
149
  end
150
150
  end
151
151
 
152
+ def rehash(pwd)
153
+ pwd << CONFIG[:Salt] if pwd.length < CONFIG[:MinPwdLen]
154
+ BaseConvert::FromTo.new(:hex, :qgraph).convert Digest::SHA256.hexdigest(pwd)
155
+ end
156
+
152
157
  def process_pwd_entries(entry1, entry2)
153
158
  begin
154
- pwd1 = entry1.text.strip
155
- if pwd1 == '' and pwd = Helpema::ZBar.qrcode(CONFIG[:QrcTimeOut])
156
- if pwd.include?("\n")
157
- pwd1 = BaseConvert::FromTo.new(:hex, :qgraph).convert Digest::SHA256.hexdigest pwd
158
- else
159
- pwd1 = pwd
160
- end
161
- end
162
- raise 'No password given.' if pwd1 == ''
159
+ pwd = entry1.text.strip
160
+ raise 'No password given.' if pwd == ''
163
161
  if entry2
164
- raise 'Passwords did not match' unless entry2.text.strip==pwd1
165
- @accounts.save pwd1
162
+ raise 'Passwords did not match' unless entry2.text.strip==pwd
163
+ @accounts.save rehash pwd
166
164
  else
167
- if pwd1=~/^\d+\-[\dabcdef]+$/ # then we probably have a shared secret...
168
- if File.exist? CONFIG[:SharedSecretFile] # and looks like we really do...
169
- pwd0 = File.read(CONFIG[:SharedSecretFile]).strip
170
- pwd = Helpema::SSSS.combine(pwd0, pwd1)
171
- pwd1 = pwd unless pwd=='' # but maybe not.
172
- end
173
- end
174
- if salt = CONFIG[:Salt]
175
- pwd1 = BaseConvert::FromTo.new(:hex, :qgraph).convert Digest::SHA256.hexdigest(pwd1+salt)
176
- end
177
- @accounts.load pwd1
165
+ @accounts.load rehash pwd
178
166
  end
179
167
  true
180
168
  rescue StandardError
@@ -253,8 +241,9 @@ class Gtk2PwdV
253
241
  CONFIG[:FIELDS].each do |field, text|
254
242
  entry = Such::PromptedLabel.new @page, :hbox!
255
243
  entry.prompt_Label.text = text
256
- entry.prompted_Label.text = @account.method(field).call
257
- entry.prompted_Label.set_alignment(*CONFIG[:FIELD_ALIGNMENT])
244
+ (_=entry.prompted_Label).text = @account.method(field).call
245
+ _.set_alignment(*CONFIG[:FIELD_ALIGNMENT])
246
+ _.selectable = true
258
247
  entries[field] = entry
259
248
  end
260
249
  return entries
@@ -303,9 +292,18 @@ class Gtk2PwdV
303
292
  when clip_box.b_Button # Previous
304
293
  copy2clipboard @account.previous, @account.password
305
294
  when clip_box.c_Button # Show
306
- label.text == hidden ?
307
- label.text = @account.password :
308
- label.text = hidden
295
+ case label.text
296
+ when hidden
297
+ pwd = @account.password
298
+ if pwd=~/^[A-Z2-7]+$/
299
+ pwd = TOTP.passwords(pwd)[1].to_s
300
+ end
301
+ label.text = pwd
302
+ when @account.password
303
+ label.text = hidden
304
+ else
305
+ label.text = @account.password
306
+ end
309
307
  end
310
308
  end
311
309
  clip_box.labels :Current, :Previous, :Show
@@ -353,7 +351,7 @@ class Gtk2PwdV
353
351
 
354
352
  # cb and sb will be a CheckButton and SpinButton respectively.
355
353
  cb = sb = nil
356
- password = @account ? @account.password : ''
354
+ password = (mode==:edit)? @account.password : ''
357
355
  truncate = Proc.new do |p|
358
356
  password = p
359
357
  if cb.active?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gtk2passwordapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 5.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - carlosjhr64
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-23 00:00:00.000000000 Z
11
+ date: 2017-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yaml_zlib_blowfish
@@ -30,6 +30,26 @@ dependencies:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 1.0.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: base_convert
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '2.2'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 2.2.0
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '2.2'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 2.2.0
33
53
  - !ruby/object:Gem::Dependency
34
54
  name: gtk3app
35
55
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +59,7 @@ dependencies:
39
59
  version: '2.0'
40
60
  - - ">="
41
61
  - !ruby/object:Gem::Version
42
- version: 2.0.0
62
+ version: 2.0.1
43
63
  type: :runtime
44
64
  prerelease: false
45
65
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,67 +69,67 @@ dependencies:
49
69
  version: '2.0'
50
70
  - - ">="
51
71
  - !ruby/object:Gem::Version
52
- version: 2.0.0
72
+ version: 2.0.1
53
73
  - !ruby/object:Gem::Dependency
54
- name: super_random
74
+ name: base32
55
75
  requirement: !ruby/object:Gem::Requirement
56
76
  requirements:
57
77
  - - "~>"
58
78
  - !ruby/object:Gem::Version
59
- version: '1.0'
60
- - - ">="
79
+ version: '0.3'
80
+ - - '='
61
81
  - !ruby/object:Gem::Version
62
- version: 1.0.0
82
+ version: 0.3.2
63
83
  type: :runtime
64
84
  prerelease: false
65
85
  version_requirements: !ruby/object:Gem::Requirement
66
86
  requirements:
67
87
  - - "~>"
68
88
  - !ruby/object:Gem::Version
69
- version: '1.0'
70
- - - ">="
89
+ version: '0.3'
90
+ - - '='
71
91
  - !ruby/object:Gem::Version
72
- version: 1.0.0
92
+ version: 0.3.2
73
93
  - !ruby/object:Gem::Dependency
74
- name: base_convert
94
+ name: totp
75
95
  requirement: !ruby/object:Gem::Requirement
76
96
  requirements:
77
97
  - - "~>"
78
98
  - !ruby/object:Gem::Version
79
- version: '2.0'
80
- - - ">="
99
+ version: '1.0'
100
+ - - '='
81
101
  - !ruby/object:Gem::Version
82
- version: 2.0.0
102
+ version: 1.0.0
83
103
  type: :runtime
84
104
  prerelease: false
85
105
  version_requirements: !ruby/object:Gem::Requirement
86
106
  requirements:
87
107
  - - "~>"
88
108
  - !ruby/object:Gem::Version
89
- version: '2.0'
90
- - - ">="
109
+ version: '1.0'
110
+ - - '='
91
111
  - !ruby/object:Gem::Version
92
- version: 2.0.0
112
+ version: 1.0.0
93
113
  - !ruby/object:Gem::Dependency
94
- name: helpema
114
+ name: super_random
95
115
  requirement: !ruby/object:Gem::Requirement
96
116
  requirements:
97
117
  - - "~>"
98
118
  - !ruby/object:Gem::Version
99
- version: '0.2'
119
+ version: '1.0'
100
120
  - - ">="
101
121
  - !ruby/object:Gem::Version
102
- version: 0.2.0
122
+ version: 1.0.0
103
123
  type: :runtime
104
124
  prerelease: false
105
125
  version_requirements: !ruby/object:Gem::Requirement
106
126
  requirements:
107
127
  - - "~>"
108
128
  - !ruby/object:Gem::Version
109
- version: '0.2'
129
+ version: '1.0'
110
130
  - - ">="
111
131
  - !ruby/object:Gem::Version
112
- version: 0.2.0
132
+ version: 1.0.0
113
133
  description: |
114
134
  Ruby-Gnome Password Manager.
115
135
 
@@ -132,7 +152,6 @@ files:
132
152
  - lib/gtk2passwordapp/config.rb
133
153
  - lib/gtk2passwordapp/gtk2pwdv.rb
134
154
  - lib/gtk2passwordapp/such_parts.rb
135
- - lib/gtk2passwordapp/version.rb
136
155
  homepage: https://github.com/carlosjhr64/gtk2passwordapp
137
156
  licenses:
138
157
  - MIT
@@ -154,9 +173,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
173
  - !ruby/object:Gem::Version
155
174
  version: '0'
156
175
  requirements:
157
- - 'ruby: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]'
176
+ - 'ruby: ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]'
158
177
  rubyforge_project:
159
- rubygems_version: 2.6.11
178
+ rubygems_version: 2.6.13
160
179
  signing_key:
161
180
  specification_version: 4
162
181
  summary: Ruby-Gnome Password Manager.
@@ -1,3 +0,0 @@
1
- module Gtk2PasswordApp
2
- VERSION = '5.1.0'
3
- end