gtk2passwordapp 4.4.0 → 6.1.210203

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
- SHA1:
3
- metadata.gz: 93d76cfb003e1b930d9d2deeaa22c24260456542
4
- data.tar.gz: 4e55b73f5c0701b353b72dac3560a386c10a60a8
2
+ SHA256:
3
+ metadata.gz: db7fd389f209b9af0b4bb99dc470661a29db4aaef522bc1d7af7772cd5350902
4
+ data.tar.gz: ea3b9775f225679abcc7d376846eefcd58f83fa6204e95081006b3160b08b8e5
5
5
  SHA512:
6
- metadata.gz: 7bb5d79bb06b3caf17e83a90f720dda4c77b538f542745e218d6470e1e4c0ccd43e87470d8b4919c1d48ce529549d0d9bb1f10aac46de2661c7b228aa3062000
7
- data.tar.gz: 02b752a61ab739a41addf33e3bc8b7b2141e94548b3f8770bd9aa31af2eaa902f0b05f3a631d39bd2913b4ac218755e6c38efd3ec32696838d3aa84bdb40a718
6
+ metadata.gz: 15b63889540dd08e81e76214d238f286828b84678044b0b65e878bd5c72559b8cbc0bbe739c725e89b457fa9b0b3bffc54eacefa41a6b67c90a77e501ebdb2df
7
+ data.tar.gz: 71b67bc91467440f6c14002f322a5b284b1744f357e0d19b3df85c88a4449f6418b4e77d224e67f4c13856c4a605c9f4101b289d347b240c46a28d7039069dcf
data/README.md ADDED
@@ -0,0 +1,108 @@
1
+ # Gtk2PasswordApp
2
+
3
+ * [VERSION 6.1.210203](https://github.com/carlosjhr64/gtk2passwordapp/releases)
4
+ * [github](https://github.com/carlosjhr64/gtk2passwordapp)
5
+ * [rubygems](https://rubygems.org/gems/gtk2passwordapp)
6
+
7
+ ![gui](test/gui.png)
8
+
9
+ ## Description:
10
+
11
+ Ruby-Gnome Password Manager.
12
+
13
+ Uses Blowfish to encrypt the datafile.
14
+ Features random password generator, clipboard use, and TOTP.
15
+
16
+ ## Install:
17
+
18
+ ```shell
19
+ $ gem install gtk2passwordapp
20
+ ```
21
+
22
+ ## Help:
23
+
24
+ ```shell
25
+ $ gtk2passwordapp --help
26
+ Usage:
27
+ gtk2passwordapp [:gui+]
28
+ gtk2passwordapp :cli [<pattern> [<file>]]
29
+ gtk2passwordapp :info
30
+ Gui:
31
+ --minime Real minime
32
+ --notoggle Minime wont toggle decorated and keep above
33
+ --notdercorated Dont decorate window
34
+ Cli:
35
+ --nogui
36
+ Info:
37
+ -v --version Show version and exit
38
+ -h --help Show help and exit
39
+ # Notes #
40
+ With the --nogui cli-option,
41
+ one can give a pattern to filter by account names.
42
+ Default passwords data file is:
43
+ ~/.cache/gtk3app/gtk2passwordapp/dump.yzb
44
+ ```
45
+
46
+ ## Gui:
47
+
48
+ Mouse clicks on logo:
49
+
50
+ 1. `Right` to get the passwords list and select.
51
+ 2. `Center` to reset the master password.
52
+ 3. `Left` to get the application menu.
53
+
54
+ When you select an account,
55
+ the username/password will be in clipboard/primary for a few seconds.
56
+
57
+ View Account page:
58
+
59
+ * click on password to toggle visibility.
60
+ * click on secret to toggle TOTP(secret is password).
61
+ * `Current` button will put username/password in clipboard/primary for a few seconds.
62
+ * `Previous` button will put password/previous in clipboard/primary for a few seconds.
63
+
64
+ ## Configuration:
65
+
66
+ ```shell
67
+ $ ls ~/.config/gtk3app/gtk2passwordapp/config-?.?.rbon
68
+ ```
69
+
70
+ * Salt: If your master password length is under 14(LongPwd), it'll append this Salt.
71
+ * TooOld: I have this set for a year (in seconds).
72
+ * PwdFile: passwords file... you'll want include this file in your back-ups.
73
+
74
+ If you're upgrading from `gtk2pwdV`,
75
+ copy your passwords files to the new file name:
76
+
77
+ ```shell
78
+ $ cp ~/.cache/gtk3app/gtk2passwordapp/gtk2pwdV.dat ~/.cache/gtk3app/gtk2passwordapp/dump.yzb
79
+ ```
80
+
81
+ And remember to set your `Salt:` in the configuration file.
82
+ The configuration file is created upon the first run of `gtk2passwordapp`, so
83
+ you'll need to do that first.
84
+
85
+ ## LICENSE:
86
+
87
+ (The MIT License)
88
+
89
+ Copyright (c) 2021 CarlosJHR64
90
+
91
+ Permission is hereby granted, free of charge, to any person obtaining
92
+ a copy of this software and associated documentation files (the
93
+ 'Software'), to deal in the Software without restriction, including
94
+ without limitation the rights to use, copy, modify, merge, publish,
95
+ distribute, sublicense, and/or sell copies of the Software, and to
96
+ permit persons to whom the Software is furnished to do so, subject to
97
+ the following conditions:
98
+
99
+ The above copyright notice and this permission notice shall be
100
+ included in all copies or substantial portions of the Software.
101
+
102
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
103
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
104
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
105
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
106
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
107
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
108
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/bin/gtk2passwordapp CHANGED
@@ -1,123 +1,19 @@
1
1
  #!/usr/bin/env ruby
2
- require 'rafini'
3
- using Rafini::Exception
4
- using Rafini::Array
5
- using Rafini::String
6
-
7
- begin
8
- nogui = ARGV.include?('--no-gui')
9
- hlp = ['-h', '--help'].any?{|_|ARGV.include?(_)}
10
- vrs = ['-v', '--version'].any?{|_|ARGV.include?(_)}
11
- if nogui or hlp or vrs
12
- # Going to proceed on need only basis, which may break some conventions...
13
-
14
- # Get the version.
15
- require 'gtk2passwordapp/version'
16
- mod = Gtk2passwordapp
17
- version = mod::VERSION
18
- if vrs
19
- puts version
20
- exit
2
+ require 'gtk2passwordapp'
3
+ class Gtk2PasswordApp
4
+ begin
5
+ case ARGV
6
+ in [/^(-v)|(--version)$/]
7
+ puts VERSION
8
+ in [/^(-h)|(--help)$/]
9
+ puts HELP
10
+ in ['--nogui', *args]
11
+ Gtk2PasswordApp.cli
12
+ Gtk2PasswordApp.run(*args)
13
+ else
14
+ Gtk2PasswordApp.gui
15
+ Gtk2PasswordApp.run
21
16
  end
22
-
23
- vbs = ARGV.any?{|_|['-V', '--verbose'].include?(_)}
24
-
25
- # Get the config.
26
- require 'xdg'
27
- require 'gtk2passwordapp/config'
28
- config = mod::CONFIG
29
- if hlp and !vbs
30
- # Note that this will be the original help without any of the user's edit.
31
- puts config[:Help]
32
- exit
33
- end
34
-
35
- # Where are the user's data?
36
- require 'user_space'
37
- require 'yaml'
38
- UserSpace::OPTIONS[:parser] = YAML
39
- UserSpace::OPTIONS[:ext] = 'yml'
40
- UserSpace::OPTIONS[:config] = "config-#{version.semantic(0..1)}"
41
- appdir = mod::APPDIR
42
- appname = File.join 'gtk3app', mod.name.downcase
43
- user_space = UserSpace.new(appname: appname, appdir: appdir)
44
- user_space.install unless user_space.version == version
45
- user_space.configures(config)
46
-
47
- if hlp # and vbs
48
- # Presumably, the user may have edited the help and is requesting this version.
49
- puts config[:Help]
50
- exit
51
- end
52
-
53
- # It's possible that the password file it not there.
54
- pwd_file = config[:PwdFile]
55
- raise "Could not find passwords data file." unless File.exist? pwd_file
56
-
57
- # Going to get and verify the password.
58
- require 'io/console' # Standard library
59
- pwd0 = nil
60
- print 'Password: '
61
- pwd = $stdin.noecho(&:gets).strip
62
- while pwd != pwd0
63
- exit if pwd == ''
64
- pwd0 = pwd
65
- puts
66
- print 'Again: '
67
- pwd = $stdin.noecho(&:gets).strip
68
- end
69
- puts
70
-
71
- # Ready to read the passwords file.
72
- require 'yaml_zlib_blowfish'
73
- require 'gtk2passwordapp/account'
74
- require 'gtk2passwordapp/accounts'
75
- accounts = Gtk2passwordapp::Accounts.new(pwd_file, pwd)
76
- accounts.load
77
-
78
- # Does the user want a data dump?
79
- if ARGV.include? '--dump'
80
- puts
81
- # Remember that ARGV is at least ['--no-gui'].
82
- pattern = (ARGV.last[0]=='-')? nil : Regexp.new(ARGV.last)
83
- now = Time.now.to_i
84
- accounts.names.each do |name|
85
- next if pattern and not pattern=~name
86
- account = accounts.get(name)
87
- puts [account.name, account.username, account.password].join("\n\t")
88
- if vbs
89
- puts "\t" + account.url
90
- puts "\t" + account.note
91
- using Rafini::Odometers
92
- puts "\tUpdated " + (now - account.updated).sec2time.to_s + ' ago.'
93
- end
94
- puts
95
- end
96
- exit
97
- end
98
-
99
- # Looks like the user just wants a particular password.
100
- # Get the account name.
101
- unless name = (ARGV.last[0]=='-')? nil : ARGV.last
102
- print 'Account Name: '
103
- name = $stdin.gets.strip
104
- end
105
- # Does the given account exist?
106
- raise "Could not find account \"#{name}\"." unless accounts.data[name]
107
-
108
- # Put the password!
109
- account = accounts.get(name)
110
- password = account.password
111
- puts password
112
-
113
- # And we're done!
114
- exit
115
17
  end
116
- rescue StandardError
117
- $!.puts
118
- exit 1
119
18
  end
120
-
121
- # Run gui!
122
- ARGV.unshift 'gtk2passwordapp' # going to gtk3app
123
- Process.detach spawn "gtk3app #{ARGV.join(' ')}"
19
+ exit
@@ -1,19 +1,56 @@
1
- # This is a Gtk3App.
1
+ class Gtk2PasswordApp
2
+ VERSION = '6.1.210203'
3
+ HELP = <<~HELP
4
+ Usage:
5
+ gtk2passwordapp [:gui+]
6
+ gtk2passwordapp :cli [<pattern> [<file>]]
7
+ gtk2passwordapp :info
8
+ Gui:
9
+ --minime \tReal minime
10
+ --notoggle \tMinime wont toggle decorated and keep above
11
+ --notdercorated\tDont decorate window
12
+ Cli:
13
+ --nogui
14
+ Info:
15
+ -v --version \tShow version and exit
16
+ -h --help \tShow help and exit
17
+ # Notes #
18
+ With the --nogui cli-option,
19
+ one can give a pattern to filter by account names.
20
+ Default passwords data file is:
21
+ ~/.cache/gtk3app/gtk2passwordapp/dump.yzb
22
+ HELP
2
23
 
3
- # Helper Gems.
4
- require 'yaml_zlib_blowfish'
5
- require 'super_random'
6
- require 'base_convert'
7
- require 'helpema'
24
+ def self.cli
25
+ # User using cli may be experiencing system problems.
26
+ begin
27
+ require 'gtk2passwordapp/cli'
28
+ require 'yaml_zlib_blowfish'
29
+ require 'base_convert'
30
+ rescue LoadError
31
+ $stderr.puts 'Missing Gem:'
32
+ $stderr.puts $!.message
33
+ exit 72
34
+ end
35
+ end
8
36
 
9
- # This Gem.
10
- require_relative 'gtk2passwordapp/version.rb'
11
- require_relative 'gtk2passwordapp/config.rb'
12
- require_relative 'gtk2passwordapp/such_parts.rb'
13
- require_relative 'gtk2passwordapp/account.rb'
14
- require_relative 'gtk2passwordapp/accounts.rb'
15
- require_relative 'gtk2passwordapp/gtk2passwordapp.rb'
37
+ def self.gui
38
+ # This is a Gtk3App.
39
+ require 'gtk3app'
16
40
 
41
+ # Helper Gems.
42
+ require 'base32'
43
+ require 'totp'
44
+ require 'yaml_zlib_blowfish'
45
+ require 'super_random'
46
+ require 'base_convert'
47
+
48
+ # This Gem.
49
+ require_relative 'gtk2passwordapp/config.rb'
50
+ require_relative 'gtk2passwordapp/account.rb'
51
+ require_relative 'gtk2passwordapp/accounts.rb'
52
+ require_relative 'gtk2passwordapp/gui.rb'
53
+ end
54
+ end
17
55
  # Requires:
18
56
  #`ruby`
19
- #`gtk3app`
@@ -1,4 +1,4 @@
1
- module Gtk2passwordapp
1
+ class Gtk2PasswordApp
2
2
  class Account
3
3
 
4
4
  PASSWORD = 0
@@ -10,7 +10,7 @@ class Account
10
10
 
11
11
  def initialize(name, data)
12
12
  unless data.has_key?(name)
13
- raise "Account name must be a non-empty String." unless name.class==String and name.length > 0
13
+ raise CONFIG[:BadName] unless name.class==String and name.length > 0
14
14
  data[name] = [ '', '', '', '', '', 0 ]
15
15
  end
16
16
  @name, @data = name, data[name]
@@ -49,7 +49,7 @@ class Account
49
49
  ### WRITTERS ###
50
50
 
51
51
  def password=(password)
52
- raise 'Password must be all graph.' unless password=~/^[[:graph:]]+$/
52
+ raise CONFIG[:BadPassword] unless password=~/^[[:graph:]]*$/
53
53
  if @data[PASSWORD] != password
54
54
  @data[UPDATED] = Time.now.to_i
55
55
  @data[PREVIOUS] = @data[PASSWORD]
@@ -62,12 +62,12 @@ class Account
62
62
  end
63
63
 
64
64
  def username=(username)
65
- raise 'Username must be all graph.' unless username=~/^[[:graph:]]*$/
65
+ raise CONFIG[:BadUsername] unless username=~/^[[:graph:]]*$/
66
66
  @data[USERNAME]=username
67
67
  end
68
68
 
69
69
  def url=(url)
70
- raise 'Must be like http://site' unless url=='' or url=~/^\w+:\/\/\S+$/
70
+ raise CONFIG[:BadUrl] unless url=='' or url=~/^\w+:\/\/\S+$/
71
71
  @data[URL]=url
72
72
  end
73
73
 
@@ -1,4 +1,4 @@
1
- module Gtk2passwordapp
1
+ class Gtk2PasswordApp
2
2
  class Accounts
3
3
 
4
4
  def reset(password)
@@ -6,8 +6,7 @@ class Accounts
6
6
  end
7
7
 
8
8
  attr_reader :data
9
- attr_accessor :dumpfile
10
- def initialize(dumpfile=nil, password=nil)
9
+ def initialize(dumpfile, password=nil)
11
10
  reset(password) if password # sets @yzb
12
11
  @dumpfile = dumpfile
13
12
  @data = {}
@@ -21,7 +20,8 @@ class Accounts
21
20
  def load(password=nil)
22
21
  reset(password) if password
23
22
  data = @yzb.load(@dumpfile)
24
- raise "Decryption error." unless data.class == Hash
23
+ # Sanity check... load will raise CipherError on decription error.
24
+ raise CONFIG[:CipherError] unless data.class == Hash
25
25
  @data = data
26
26
  end
27
27
 
@@ -36,16 +36,17 @@ class Accounts
36
36
  end
37
37
 
38
38
  def delete(account)
39
+ raise CONFIG[:AccountMiss] unless @data.has_key?(account)
39
40
  @data.delete(account)
40
41
  end
41
42
 
42
43
  def get(account)
43
- raise "Account #{account} does NOT exists!" unless @data.has_key?(account)
44
+ raise CONFIG[:AccountMiss] unless @data.has_key?(account)
44
45
  Account.new(account, @data)
45
46
  end
46
47
 
47
48
  def add(account)
48
- raise "Account #{account} exists!" if @data.has_key?(account)
49
+ raise CONFIG[:AccountHit] if @data.has_key?(account)
49
50
  Account.new(account, @data)
50
51
  end
51
52
 
@@ -0,0 +1,35 @@
1
+ class Gtk2PasswordApp
2
+ def self.run(pattern='.', dump=File.expand_path('~/.cache/gtk3app/gtk2passwordapp/dump.yzb'), *trash)
3
+ unless trash.empty?
4
+ $stderr.puts HELP
5
+ $stderr.puts "Please match usage."
6
+ exit 64
7
+ end
8
+ begin
9
+ pattern = Regexp.new pattern, Regexp::IGNORECASE
10
+ rescue RegexpError
11
+ $stderr.puts $!.message
12
+ exit 65
13
+ end
14
+ unless File.exist? dump
15
+ $stderr.puts "Passwords data file missing: #{dump}"
16
+ exit 66
17
+ end
18
+ system('clear; clear')
19
+ print "Enter password: "
20
+ pwd = $stdin.gets.strip
21
+ system('clear; clear')
22
+ print "Enter salt: "
23
+ pwd << $stdin.gets.strip
24
+ system('clear; clear')
25
+ h2q = BaseConvert::FromTo.new base: 16, digits: '0123456789ABCDEF', to_base: 91, to_digits: :qgraph
26
+ pwd = h2q.convert Digest::SHA256.hexdigest(pwd).upcase
27
+ begin
28
+ lst = YamlZlibBlowfish.new(pwd).load(dump)
29
+ rescue OpenSSL::Cipher::CipherError
30
+ $stderr.puts "Bad password+salt"
31
+ exit 65
32
+ end
33
+ pp lst.select{|k,v|pattern.match? k}
34
+ end
35
+ end