gtk2passwordapp 2.4.0 → 2.5.0
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.
- data/README.txt +26 -11
- data/bin/gtk2passwordapp2 +38 -4
- data/lib/gtk2passwordapp/appconfig.rb +51 -43
- data/lib/gtk2passwordapp/rnd.rb +15 -3
- metadata +6 -6
data/README.txt
CHANGED
@@ -5,17 +5,32 @@ Uses crypt-tea's Tiny Encryption Algorithm to encrypt the datafile.
|
|
5
5
|
Features random password generator and clipboard use.
|
6
6
|
|
7
7
|
|
8
|
-
To add an account, enter the new account name in the "Account:" entry/combo box.
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
8
|
+
To add an account, enter the new account name in the "Account:" entry/combo box.
|
9
|
+
For the account, write the associated url, a note about the account, and the username in the appropriate entry boxes.
|
10
|
+
|
11
|
+
To set a new password, either enter the password in the "Password:" entry box,
|
12
|
+
or generate it by pressing "Random", "Alpha-Numeric", "Numeric", "Letters", or "All-Caps".
|
13
|
+
One can set the password length generated with the spin-box.
|
14
|
+
To make the password generated visible, un-check the check button.
|
15
|
+
|
16
|
+
Once one has edited the account, clicking the "Update Account" button finalizes the record.
|
17
|
+
Note, however, that the change is not yet permanent and saved on disk.
|
18
|
+
To delete an account, select the account in the entry/combo box, and the press the "Delete Account" button.
|
19
|
+
Once one is done with all updates, one then needs to press "Save To Disk".
|
20
|
+
Clicking the "Close" button or closing the window without "Save To Disk" will ignore all of the sessions updates.
|
21
|
+
|
22
|
+
The "Clip Current Password" button copies the current password to the primary clipboard.
|
23
|
+
The "Clip Previous Password" button copies the previous (old) password to the primary clipboard.
|
24
|
+
The "Change Data File Password" button will allow one the change the master password.
|
25
|
+
Do not forget the master password!
|
26
|
+
|
27
|
+
Right click most anywhere on the app's window for the main menu.
|
28
|
+
"Close" will dock the application and has the same effect as the "Close" button.
|
29
|
+
|
30
|
+
Left click on the docked icon to bring back the editor window.
|
31
|
+
Right click on the docked icon to select one of the accounts to load the password and username to the clipboard.
|
32
|
+
The password is copied to the primary clipboard and will paste on middle mouse button click.
|
33
|
+
Right click on an entry box to paste the username (via the clipboard's menu).
|
19
34
|
|
20
35
|
For full documentation and comments, see
|
21
36
|
https://sites.google.com/site/gtk2applib/home/gtk2applib-applications/gtk2passwordapp
|
data/bin/gtk2passwordapp2
CHANGED
@@ -7,10 +7,42 @@ if (nogui = ARGV.include?('--no-gui')) || (ARGV.include?('--dump')) then
|
|
7
7
|
# Have to assume things...
|
8
8
|
pwfile = File.expand_path('~/.gtk2passwordapp-2/passwords.dat')
|
9
9
|
raise "Need #{pwfile}" unless File.exist?(pwfile)
|
10
|
-
|
10
|
+
# Note: user may want to send stdout to a file,
|
11
|
+
# so commicating with user via stderr.
|
12
|
+
$stderr.print "Warning: password will be shown.\nPassword: "
|
11
13
|
pwd = $stdin.gets.strip
|
14
|
+
if pwd.length == 3 then
|
15
|
+
begin
|
16
|
+
otpr = `which otpr`
|
17
|
+
if otpr.length > 0 then
|
18
|
+
bucket = ''
|
19
|
+
while bucket == '' do
|
20
|
+
$stderr.print "Bucket: "
|
21
|
+
bucket = $stdin.gets.strip
|
22
|
+
$stderr.puts "Need Google Cloud Storage's bucket name. (Ctrl-C to break)" if bucket.length == 0
|
23
|
+
end
|
24
|
+
$stderr.print "Pad Name('gtk2passwordapp'): "
|
25
|
+
padname = $stdin.gets.strip
|
26
|
+
padname = 'gtk2passwordapp' if padname.length == 0
|
27
|
+
$stderr.puts "otpr #{bucket} #{padname} /media/NotAvailable/tmp.pad"
|
28
|
+
IO.popen( "otpr #{bucket} #{padname} /media/NotAvailable/tmp.pad", 'w+' ) do |pipe|
|
29
|
+
if pipe.gets then # asks for pin
|
30
|
+
pipe.puts pwd # give pin
|
31
|
+
pwd = pipe.gets.strip # get password
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
rescue Exception
|
36
|
+
# user probably wanted out of the loop
|
37
|
+
$stderr.puts
|
38
|
+
end
|
39
|
+
# Sending master password to standard out.
|
40
|
+
# The assumption here is that the user is doing a recovery...
|
41
|
+
# Why else would the user be using this --no-gui?
|
42
|
+
$stdout.puts pwd
|
43
|
+
end
|
12
44
|
if nogui then
|
13
|
-
$stderr.print "Warning: selected passwords will be shown.\nEnter Account pattern:"
|
45
|
+
$stderr.print "Warning: selected passwords will be shown.\nEnter Account pattern: "
|
14
46
|
pattern = Regexp.new( $stdin.gets.strip, Regexp::IGNORECASE )
|
15
47
|
end
|
16
48
|
begin
|
@@ -18,18 +50,20 @@ if (nogui = ARGV.include?('--no-gui')) || (ARGV.include?('--dump')) then
|
|
18
50
|
passwords.load
|
19
51
|
if $options=~/-dump/ then
|
20
52
|
require 'pp'
|
53
|
+
# puts to stdout
|
21
54
|
pp passwords
|
22
55
|
else
|
23
56
|
passwords.accounts.each do |account|
|
24
57
|
if account =~ pattern then
|
25
58
|
password = passwords.password_of(account)
|
26
59
|
username = passwords.username_of(account)
|
27
|
-
puts
|
60
|
+
# puts to stdout
|
61
|
+
$stdout.puts [account,username,password].join("\n\t")
|
28
62
|
end
|
29
63
|
end
|
30
64
|
end
|
31
65
|
rescue Exception
|
32
|
-
puts $!
|
66
|
+
$stderr.puts $!
|
33
67
|
end
|
34
68
|
exit
|
35
69
|
end
|
@@ -118,71 +118,79 @@ module Configuration
|
|
118
118
|
AGAIN = 'Again' # for when verifying new passwords.
|
119
119
|
RETRY = 'Retry' # for when you got your password wrong.
|
120
120
|
|
121
|
+
# These are the --no-gui dialogs...
|
122
|
+
COMMAND_LINE_MSG1 = "Warning: password will be shown.\nPassword:"
|
123
|
+
COMMAND_LINE_MSG2 = "Warning: selected passwords will be shown.\nEnter Account pattern:"
|
121
124
|
end
|
122
125
|
|
123
|
-
# Set OTP to true if you're going to use
|
126
|
+
# Set OTP to true if you're going to use otpr (search for it in rubygems.org)
|
124
127
|
OTP = false
|
125
128
|
|
126
|
-
#
|
127
|
-
|
128
|
-
#
|
129
|
-
|
130
|
-
CYPHER = '/media/3263-6638/.gtk2passwordapp-2/cypher.pad' # remove-able media
|
131
|
-
KEY = "#{Gtk2AppLib::USERDIR}/key.pad"
|
129
|
+
# arguments for otpr
|
130
|
+
BUCKET = 'YourBucket' # <== put the name of your google cloud storage bucket here.
|
131
|
+
PADNAME = 'gtk2passwordapp' # <== suggested pad name, you can change it.
|
132
|
+
OTPBACKUP = '/media/1234-5678/.gtk2passwordapp-2/cipher.pad' # <== edit to your backup file on removable media.
|
132
133
|
|
133
|
-
#
|
134
|
-
|
135
|
-
BACKUP = File.expand_path('~/Dropbox/Backups/passwords.dat')
|
134
|
+
# Do yoy have a custom backup script to run?
|
135
|
+
BACKUPSCRIPT = nil # File.expand_path('~/bin/backup')
|
136
136
|
|
137
|
-
# Here you can
|
138
|
-
# The commented out section is set up to use DropBox
|
137
|
+
# Here you can edit in your own backups.
|
139
138
|
def self.passwords_updated(password=nil)
|
140
|
-
# Update your pad...
|
141
|
-
Gtk2Password.set_password_to_pad(password) if password && OTP
|
142
139
|
begin
|
143
|
-
|
144
|
-
|
145
|
-
|
140
|
+
# you might want to backup your passwords file here
|
141
|
+
# here, backup is a custom script to backup passwords.dat
|
142
|
+
system("#{BACKUPSCRIPT} passwords &") if BACKUPSCRIPT
|
143
|
+
Gtk2Password.set_password_to_pad(password) if password && OTP
|
144
|
+
# you might want to backup your otp here
|
145
|
+
# here, backup is a custom script to backup the .otpr directory
|
146
|
+
system("#{BACKUPSCRIPT} otpr &") if BACKUPSCRIPT
|
146
147
|
Gtk2AppLib::DIALOGS.quick_message("Passwords Data Saved.",{:TITLE => 'Saved',:SCROLLED_WINDOW => false})
|
147
148
|
rescue Exception
|
148
|
-
Gtk2AppLib::DIALOGS.quick_message("Warning:
|
149
|
+
Gtk2AppLib::DIALOGS.quick_message("Warning: #{$!}",{:TITLE => 'Warning',:SCROLLED_WINDOW => false})
|
149
150
|
end
|
150
151
|
end
|
151
152
|
|
152
|
-
def self.
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
def self.get_password_from_pad
|
162
|
-
password = ''
|
163
|
-
if File.exist?(KEY) && File.exist?(CYPHER) then
|
164
|
-
key = File.read(KEY)
|
165
|
-
cypher = File.read(CYPHER)
|
166
|
-
password = Gtk2Password.xor_cypher(key,cypher)
|
153
|
+
def self.set_password_to_pad(password)
|
154
|
+
begin
|
155
|
+
IO.popen("otpr --new #{BUCKET} #{PADNAME} #{OTPBACKUP}",'w+') do |pipe|
|
156
|
+
raise "WUT?" unless pipe.gets.strip == 'Password:'
|
157
|
+
pipe.puts password
|
158
|
+
return pipe.gets.strip
|
159
|
+
end
|
160
|
+
rescue Exception
|
161
|
+
return ''
|
167
162
|
end
|
168
|
-
return password
|
169
163
|
end
|
170
164
|
|
171
|
-
def self.
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
165
|
+
def self.get_password_from_pad(pin)
|
166
|
+
begin
|
167
|
+
IO.popen("otpr #{BUCKET} #{PADNAME} #{OTPBACKUP}",'w+') do |pipe|
|
168
|
+
raise "WUT?" unless pipe.gets.strip == 'Pin:'
|
169
|
+
pipe.puts pin
|
170
|
+
return pipe.gets.strip
|
171
|
+
end
|
172
|
+
rescue Exception
|
173
|
+
return ''
|
177
174
|
end
|
178
175
|
end
|
179
176
|
|
180
177
|
def self.get_password(prompt,title=prompt,otp=false)
|
181
178
|
if password = Gtk2AppLib::DIALOGS.entry( prompt, {:TITLE=>title, :Entry => [{:visibility= => false},'activate']} ) then
|
179
|
+
password.strip!
|
182
180
|
if OTP then
|
183
|
-
|
184
|
-
|
185
|
-
|
181
|
+
if password.length == 3 then
|
182
|
+
# the user sent the pin
|
183
|
+
password = Gtk2Password.get_password_from_pad(password)
|
184
|
+
# You might want to back up your otp here
|
185
|
+
# here, backup is a custom written script to backup the .otpr directory
|
186
|
+
system("#{BACKUPSCRIPT} otpr &") if BACKUPSCRIPT
|
187
|
+
elsif otp && password.length > 6 then
|
188
|
+
# the user wants to set a new password
|
189
|
+
Gtk2Password.set_password_to_pad(password)
|
190
|
+
# You might want to backup your otp here
|
191
|
+
# here, backup is a custom written script to backup the .otpr directory
|
192
|
+
system("#{BACKUPSCRIPT} otpr &") if BACKUPSCRIPT
|
193
|
+
end
|
186
194
|
end
|
187
195
|
end
|
188
196
|
return password
|
data/lib/gtk2passwordapp/rnd.rb
CHANGED
@@ -46,8 +46,20 @@ module Gtk2Password
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
begin
|
50
|
+
require 'securerandom'
|
51
|
+
def self.random_number(number)
|
52
|
+
SecureRandom.random_number(number)
|
53
|
+
end
|
54
|
+
rescue Exception
|
55
|
+
$stderr.puts $! unless $quiet
|
56
|
+
def self.random_number(number)
|
57
|
+
rand(number)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
49
61
|
def self.randomize(rnd,number)
|
50
|
-
((rnd +
|
62
|
+
((rnd + Rnd.random_number(number)) % number)
|
51
63
|
end
|
52
64
|
|
53
65
|
def real_random(number)
|
@@ -55,7 +67,7 @@ module Gtk2Password
|
|
55
67
|
if rnd = @bucket.shift then
|
56
68
|
return Rnd.randomize(rnd,number)
|
57
69
|
else
|
58
|
-
return
|
70
|
+
return Rnd.random_number(number)
|
59
71
|
end
|
60
72
|
end
|
61
73
|
|
@@ -68,7 +80,7 @@ module Gtk2Password
|
|
68
80
|
|
69
81
|
def random(number)
|
70
82
|
validate(number)
|
71
|
-
(@bucket)? real_random(number) :
|
83
|
+
(@bucket)? real_random(number) : Rnd.random_number(number)
|
72
84
|
end
|
73
85
|
|
74
86
|
RND = Rnd.new
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gtk2passwordapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: crypt-tea
|
16
|
-
requirement: &
|
16
|
+
requirement: &4052880 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - =
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.3.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *4052880
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: gtk2applib
|
27
|
-
requirement: &
|
27
|
+
requirement: &4052040 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '15.3'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *4052040
|
36
36
|
description: ! 'A Ruby-Gnome password manager.
|
37
37
|
|
38
38
|
Uses crypt-tea''s Tiny Encryption Algorithm to encrypt the datafile.
|