gtk2passwordapp 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gtk2passwordapp/appconfig.rb +62 -17
- data/lib/gtk2passwordapp.rb +2 -2
- metadata +10 -35
@@ -123,26 +123,71 @@ module Configuration
|
|
123
123
|
COMMAND_LINE_MSG2 = "Warning: selected passwords will be shown.\nEnter Account pattern:"
|
124
124
|
end
|
125
125
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
126
|
+
# Set OTP to true if you're going to use a one time pad
|
127
|
+
OTP = false
|
128
|
+
|
129
|
+
# Here you can modify how you store your passphrase for your passwords.
|
130
|
+
# It's now set up as a one time pad.
|
131
|
+
# Modify CYPHER to your remove-able media
|
132
|
+
# You'll need to create the directory in the media... make it rwx'able only by the user if possible.
|
133
|
+
CYPHER = '/media/3263-6638/.gtk2passwordapp-2/cypher.pad' # remove-able media
|
134
|
+
KEY = "#{Gtk2AppLib::USERDIR}/key.pad"
|
135
|
+
|
136
|
+
# Where do you want to backup your password files?
|
137
|
+
# This assumes you have a DropBox directory set up
|
138
|
+
BACKUP = File.expand_path('~/Dropbox/Backups/passwords.dat')
|
139
|
+
|
140
|
+
# Here you can set up your backup.
|
141
|
+
# The commented out section is set up to use DropBox
|
142
|
+
def self.passwords_updated(password=nil)
|
143
|
+
# Update your pad...
|
144
|
+
Gtk2Password.set_password_to_pad(password) if password && OTP
|
145
|
+
begin
|
146
|
+
if File.exist?(BACKUP) then
|
147
|
+
FileUtils.cp Configuration::PASSWORDS_FILE, BACKUP
|
148
|
+
end
|
149
|
+
Gtk2AppLib::DIALOGS.quick_message("Passwords Data Saved.",{:TITLE => 'Saved',:SCROLLED_WINDOW => false})
|
150
|
+
rescue Exception
|
151
|
+
Gtk2AppLib::DIALOGS.quick_message("Warning: Could not create backup.",{:TITLE => 'Warning',:SCROLLED_WINDOW => false})
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
def self.xor_cypher(key,cypher)
|
156
|
+
password = ''
|
157
|
+
cypher = cypher.bytes.inject([],:push)
|
158
|
+
key = key.bytes.inject([],:push)
|
159
|
+
ksize = key.length
|
160
|
+
cypher.length.times {|n| password += (cypher[n] ^ key[n.modulo ksize]).chr }
|
161
|
+
return password
|
136
162
|
end
|
137
163
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
164
|
+
def self.get_password_from_pad
|
165
|
+
password = ''
|
166
|
+
if File.exist?(KEY) && File.exist?(CYPHER) then
|
167
|
+
key = File.read(KEY)
|
168
|
+
cypher = File.read(CYPHER)
|
169
|
+
password = Gtk2Password.xor_cypher(key,cypher)
|
170
|
+
end
|
145
171
|
return password
|
146
172
|
end
|
147
173
|
|
174
|
+
def self.set_password_to_pad(password)
|
175
|
+
if File.exist?(File.dirname(CYPHER)) then
|
176
|
+
key = 0.upto(password.length).inject(''){|k,c| k+(rand(256)).chr }
|
177
|
+
# Note that the media may ignore 0600
|
178
|
+
File.open(CYPHER,'w',0600){|fh| fh.print Gtk2Password.xor_cypher(key,password) }
|
179
|
+
File.open(KEY,'w',0600){|fh| fh.print key }
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
def self.get_password(prompt,title=prompt,otp=false)
|
184
|
+
if password = Gtk2AppLib::DIALOGS.entry( prompt, {:TITLE=>title, :Entry => [{:visibility= => false},'activate']} ) then
|
185
|
+
if OTP then
|
186
|
+
# to use the pad, the user just presses OK to pass an empty string.
|
187
|
+
password = Gtk2Password.get_password_from_pad unless password.length > 0
|
188
|
+
Gtk2Password.set_password_to_pad(password) if otp && password.length > 0
|
189
|
+
end
|
190
|
+
end
|
191
|
+
return password
|
192
|
+
end
|
148
193
|
end
|
data/lib/gtk2passwordapp.rb
CHANGED
@@ -42,7 +42,7 @@ module Gtk2Password
|
|
42
42
|
def initialize(program)
|
43
43
|
@program = program
|
44
44
|
@passwords = Gtk2Password::Passwords.new(Configuration::PASSWORDS_FILE) do |prompt|
|
45
|
-
Gtk2Password.get_password(prompt) || exit
|
45
|
+
Gtk2Password.get_password(prompt,prompt,Gtk2Password::OTP) || exit
|
46
46
|
end
|
47
47
|
@passwords.expired = Configuration::PASSWORD_EXPIRED
|
48
48
|
@modified = false
|
@@ -243,7 +243,7 @@ module Gtk2Password
|
|
243
243
|
return if !pwd2
|
244
244
|
end
|
245
245
|
@passwords.save!(pwd1)
|
246
|
-
Gtk2Password.passwords_updated
|
246
|
+
Gtk2Password.passwords_updated(pwd1)
|
247
247
|
end
|
248
248
|
end
|
249
249
|
|
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.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,56 +9,30 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: crypt-tea
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirement: &11586400 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - =
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: 1.3.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - '='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 1.3.0
|
24
|
+
version_requirements: *11586400
|
30
25
|
- !ruby/object:Gem::Dependency
|
31
26
|
name: gtk2applib
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ~>
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '15.3'
|
38
|
-
type: :runtime
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
requirement: &11585860 !ruby/object:Gem::Requirement
|
41
28
|
none: false
|
42
29
|
requirements:
|
43
30
|
- - ~>
|
44
31
|
- !ruby/object:Gem::Version
|
45
32
|
version: '15.3'
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: gtk2
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ! '>='
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
54
33
|
type: :runtime
|
55
34
|
prerelease: false
|
56
|
-
version_requirements:
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
35
|
+
version_requirements: *11585860
|
62
36
|
description: ! 'A Ruby-Gnome password manager.
|
63
37
|
|
64
38
|
Uses crypt-tea''s Tiny Encryption Algorithm to encrypt the datafile.
|
@@ -100,9 +74,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
74
|
- - ! '>='
|
101
75
|
- !ruby/object:Gem::Version
|
102
76
|
version: '0'
|
103
|
-
requirements:
|
77
|
+
requirements:
|
78
|
+
- gtk2
|
104
79
|
rubyforge_project:
|
105
|
-
rubygems_version: 1.8.
|
80
|
+
rubygems_version: 1.8.11
|
106
81
|
signing_key:
|
107
82
|
specification_version: 3
|
108
83
|
summary: Ruby-Gnome Password Manager
|