gtk2passwordapp 4.3.0 → 6.0.210202

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: 9ad0166a53079b380bceff42dcbef4160f23d271
4
- data.tar.gz: c739839f3fd6fe2279682bdf6edb4df8d9e13a86
2
+ SHA256:
3
+ metadata.gz: 250ac66febc964f13b9cd7b94f04766dbd2563c49a9aad7d38cb08f62271c3bb
4
+ data.tar.gz: d378a500d92273d2d6ad2999b0a49970fe48ffdb3e13babc042a227ee5d14279
5
5
  SHA512:
6
- metadata.gz: 732a5bb7f3a4351e52e03ad3eedcc4da53c7f2a955f4ebe731053dba4bb9ea33dd5512055694c930e250f597d67d0b4870b714bee61297a0672e3ac7a6a1efc0
7
- data.tar.gz: e1066e2984540996d59a114cd6d0036a5c25ad793e7baa6f1a82fa95cfb10931383ad2f8f60ea697603f42448e1b90992671e71cea2ad1c381f47d84c094e238
6
+ metadata.gz: 351ebd133e9a4ff9bc99abb560d2c7063c055ed7403480bedd9edc374ed328b1c9f6eed7ae8e44bfe4e9e7e4c9ba3882dc468abfb3251eec4e3eeab0aa477423
7
+ data.tar.gz: 8d6b45f39397f7ba20e54d04fa01d0839c4995956575541ccaf4001c706eeb34c253e4deb3e04d87beee8027919bdef89258f26c3d48d4bd41c1e7f2ab516cc4
data/README.md ADDED
@@ -0,0 +1,107 @@
1
+ # Gtk2PasswordApp
2
+
3
+ * [VERSION 6.0.210202](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
+ --notoggle Minime wont toggle decorated and keep above
32
+ --notdercorated Dont decorate window
33
+ Cli:
34
+ --nogui
35
+ Info:
36
+ -v --version Show version and exit
37
+ -h --help Show help and exit
38
+ # Notes #
39
+ With the --nogui cli-option,
40
+ one can give a pattern to filter by account names.
41
+ Default passwords data file is:
42
+ ~/.cache/gtk3app/gtk2passwordapp/dump.yzb
43
+ ```
44
+
45
+ ## Gui:
46
+
47
+ Mouse clicks on logo:
48
+
49
+ 1. `Right` to get the passwords list and select.
50
+ 2. `Center` to reset the master password.
51
+ 3. `Left` to get the application menu.
52
+
53
+ When you select an account,
54
+ the username/password will be in clipboard/primary for a few seconds.
55
+
56
+ View Account page:
57
+
58
+ * click on password to toggle visibility.
59
+ * click on secret to toggle TOTP(secret is password).
60
+ * `Current` button will put username/password in clipboard/primary for a few seconds.
61
+ * `Previous` button will put password/previous in clipboard/primary for a few seconds.
62
+
63
+ ## Configuration:
64
+
65
+ ```shell
66
+ $ ls ~/.config/gtk3app/gtk2passwordapp/config-?.?.rbon
67
+ ```
68
+
69
+ * Salt: If your master password length is under 14(LongPwd), it'll append this Salt.
70
+ * TooOld: I have this set for a year (in seconds).
71
+ * PwdFile: passwords file... you'll want include this file in your back-ups.
72
+
73
+ If you're upgrading from `gtk2pwdV`,
74
+ copy your passwords files to the new file name:
75
+
76
+ ```shell
77
+ $ cp ~/.cache/gtk3app/gtk2passwordapp/gtk2pwdV.dat ~/.cache/gtk3app/gtk2passwordapp/dump.yzb
78
+ ```
79
+
80
+ And remember to set your `Salt:` in the configuration file.
81
+ The configuration file is created upon the first run of `gtk2passwordapp`, so
82
+ you'll need to do that first.
83
+
84
+ ## LICENSE:
85
+
86
+ (The MIT License)
87
+
88
+ Copyright (c) 2021 CarlosJHR64
89
+
90
+ Permission is hereby granted, free of charge, to any person obtaining
91
+ a copy of this software and associated documentation files (the
92
+ 'Software'), to deal in the Software without restriction, including
93
+ without limitation the rights to use, copy, modify, merge, publish,
94
+ distribute, sublicense, and/or sell copies of the Software, and to
95
+ permit persons to whom the Software is furnished to do so, subject to
96
+ the following conditions:
97
+
98
+ The above copyright notice and this permission notice shall be
99
+ included in all copies or substantial portions of the Software.
100
+
101
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
102
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
103
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
104
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
105
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
106
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
107
+ 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,55 @@
1
- # This is a Gtk3App.
1
+ class Gtk2PasswordApp
2
+ VERSION = '6.0.210202'
3
+ HELP = <<~HELP
4
+ Usage:
5
+ gtk2passwordapp [:gui+]
6
+ gtk2passwordapp :cli [<pattern> [<file>]]
7
+ gtk2passwordapp :info
8
+ Gui:
9
+ --notoggle \tMinime wont toggle decorated and keep above
10
+ --notdercorated\tDont decorate window
11
+ Cli:
12
+ --nogui
13
+ Info:
14
+ -v --version \tShow version and exit
15
+ -h --help \tShow help and exit
16
+ # Notes #
17
+ With the --nogui cli-option,
18
+ one can give a pattern to filter by account names.
19
+ Default passwords data file is:
20
+ ~/.cache/gtk3app/gtk2passwordapp/dump.yzb
21
+ HELP
2
22
 
3
- # Helper Gems.
4
- require 'yaml_zlib_blowfish'
5
- require 'super_random'
6
- require 'base_convert'
7
- require 'helpema'
23
+ def self.cli
24
+ # User using cli may be experiencing system problems.
25
+ begin
26
+ require 'gtk2passwordapp/cli'
27
+ require 'yaml_zlib_blowfish'
28
+ require 'base_convert'
29
+ rescue LoadError
30
+ $stderr.puts 'Missing Gem:'
31
+ $stderr.puts $!.message
32
+ exit 72
33
+ end
34
+ end
8
35
 
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'
36
+ def self.gui
37
+ # This is a Gtk3App.
38
+ require 'gtk3app'
16
39
 
40
+ # Helper Gems.
41
+ require 'base32'
42
+ require 'totp'
43
+ require 'yaml_zlib_blowfish'
44
+ require 'super_random'
45
+ require 'base_convert'
46
+
47
+ # This Gem.
48
+ require_relative 'gtk2passwordapp/config.rb'
49
+ require_relative 'gtk2passwordapp/account.rb'
50
+ require_relative 'gtk2passwordapp/accounts.rb'
51
+ require_relative 'gtk2passwordapp/gui.rb'
52
+ end
53
+ end
17
54
  # Requires:
18
55
  #`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