gtk2passwordapp 2.7.1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e1f5fbf47b366cf245f90ca03e06a7aa53e4d6be
4
+ data.tar.gz: c5367dcbca6ae0bcd28eceac5c66c37c2bca587a
5
+ SHA512:
6
+ metadata.gz: 9d09e2b32fe1555bed2835a221aad56e542032b86b094136a85840a1b299782298c67e87bfa14d5ad0bc30a02a1b88ba69e7dc59c117e0f78f2b525d3f74dcc3
7
+ data.tar.gz: c9ab09470fda034eb759478005852f5904b0cda5649cfd1871f69912d12d33d2006beea25cbbb489786d2bc6c669360d9bafdc6069a18d219246970393e1815e
data/README.txt CHANGED
@@ -1,7 +1,7 @@
1
1
  Ruby-Gnome Password Manager
2
2
 
3
3
  A Ruby-Gnome password manager.
4
- Uses crypt-tea's Tiny Encryption Algorithm to encrypt the datafile.
4
+ Uses Blowfish to encrypt the datafile.
5
5
  Features random password generator and clipboard use.
6
6
 
7
7
 
@@ -1,54 +1,27 @@
1
1
  #!/usr/bin/env ruby
2
- require 'rubygems'
3
2
 
4
3
  if (nogui = ARGV.include?('--no-gui')) || (ARGV.include?('--dump')) then
4
+
5
5
  require 'gtk2passwordapp/passwords'
6
6
  # Unfortunately, gtk2applib makes this awkard.
7
7
  # Have to assume things...
8
- pwfile = File.expand_path('~/.gtk2passwordapp-2/passwords.dat')
8
+ pwfile = File.expand_path('~/.gtk2passwordapp-3/passwords.dat')
9
9
  raise "Need #{pwfile}" unless File.exist?(pwfile)
10
10
  # Note: user may want to send stdout to a file,
11
11
  # so commicating with user via stderr.
12
12
  $stderr.print "Warning: password will be shown.\nPassword: "
13
13
  pwd = $stdin.gets.strip
14
- if pwd.length == 7 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 -u #{bucket} #{padname}"
28
- IO.popen( "otpr -u #{bucket} #{padname}", '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
14
+
15
+ pattern = nil
44
16
  if nogui then
45
17
  $stderr.print "Warning: selected passwords will be shown.\nEnter Account pattern: "
46
18
  pattern = Regexp.new( $stdin.gets.strip, Regexp::IGNORECASE )
47
19
  end
20
+
48
21
  begin
49
22
  passwords = Gtk2Password::Passwords.new(pwfile, pwd)
50
23
  passwords.load
51
- if $options=~/-dump/ then
24
+ if ARGV.include?('--dump') then
52
25
  require 'pp'
53
26
  # puts to stdout
54
27
  pp passwords
@@ -66,9 +39,9 @@ if (nogui = ARGV.include?('--no-gui')) || (ARGV.include?('--dump')) then
66
39
  $stderr.puts $!
67
40
  end
68
41
  exit
42
+
69
43
  end
70
44
 
71
- gem 'gtk2applib', '~> 15.3'
72
45
  $help = <<EOT
73
46
  \t--no-gui\tcommand line access to passwords
74
47
  \t--dump\t\tpp dump of data
@@ -85,4 +58,3 @@ rescue Exception
85
58
  ensure
86
59
  program.finalize
87
60
  end
88
-
@@ -118,74 +118,53 @@ 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:"
124
121
  end
125
122
 
126
- # Set OTP to true if you're going to use otpr, version 1 (search for it in rubygems.org)
127
- OTP = false
128
-
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.
133
-
134
- # Do yoy have a custom backup script to run?
135
- BACKUPSCRIPT = nil # File.expand_path('~/bin/backup')
136
-
137
123
  # Here you can edit in your own backups.
138
124
  def self.passwords_updated(password=nil)
139
125
  begin
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
147
- Gtk2AppLib::DIALOGS.quick_message("Passwords Data Saved.",{:TITLE => 'Saved',:SCROLLED_WINDOW => false})
126
+ ### you might want to backup your passwords file ###
127
+ # system('cp ~/.gtk2passwordapp-3/passwords.dat ~/Dropbox/Backups/passwords.dat')
128
+ # Gtk2AppLib::DIALOGS.quick_message("Passwords Data Saved.",{:TITLE => 'Saved',:SCROLLED_WINDOW => false})
148
129
  rescue Exception
149
130
  Gtk2AppLib::DIALOGS.quick_message("Warning: #{$!}",{:TITLE => 'Warning',:SCROLLED_WINDOW => false})
150
131
  end
151
132
  end
152
133
 
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 ''
162
- end
163
- end
164
-
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 ''
174
- end
175
- end
176
-
177
134
  def self.get_password(prompt,title=prompt)
178
135
  if password = Gtk2AppLib::DIALOGS.entry( prompt, {:TITLE=>title, :Entry => [{:visibility= => false},'activate']} ) then
179
136
  password.strip!
180
- if OTP then
181
- if password.length == 7 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
- end
188
- end
137
+ ### Do your custom interventions to the password here ###
138
+ ### For example ###
139
+ # if password.length == 0
140
+ # # User wants to enter the password via QR code
141
+ # qrc_png = File.join Gtk2AppLib::USERDIR, 'pngs', 'qrc.png'
142
+ # system("fswebcam -q #{qrc_png}")
143
+ # password = `zbarimg -q --raw #{qrc_png}`.strip
144
+ # system("shred -u #{qrc_png}")
145
+ # end
146
+ # if password =~ /^[23]\-[0123456789abcdef]+$/
147
+ # # User is using a shared secret, assuming 2 of 3....
148
+ # require 'open3'
149
+ # Open3.popen2('ssss-combine -t 2 -Q') do |stdin, stdout, stderr|
150
+ # stdin.puts '1-....' # script's shared secret
151
+ # stdin.puts password # user's shared secret
152
+ # stdin.close
153
+ # # Weird, ssss currently using stderr instead of stdout for output.
154
+ # password = stderr.read.strip.split.last # So get the last line of stderr.
155
+ # end
156
+ # end
157
+ # unless password.length > 7
158
+ # if password.length == 0
159
+ # Gtk2AppLib::DIALOGS.quick_message(
160
+ # "Sorry, could not get password.",
161
+ # {:TITLE => 'No Password',:SCROLLED_WINDOW => false})
162
+ # else
163
+ # Gtk2AppLib::DIALOGS.quick_message(
164
+ # "Warning, weak password!",
165
+ # {:TITLE => 'Weak!',:SCROLLED_WINDOW => false})
166
+ # end
167
+ # end
189
168
  end
190
169
  return password
191
170
  end
@@ -1,30 +1,39 @@
1
1
  require 'yaml'
2
- require 'rubygems'
3
- gem 'crypt-tea','= 1.3.0'
4
- begin
5
- require 'crypt_tea'
6
- rescue Exception
7
- # above is what works, but documentation shows this...
8
- require 'crypt-tea'
9
- end
2
+ require 'zlib'
3
+ require 'openssl'
4
+ require 'digest/sha2'
5
+
6
+ YAML::ENGINE.yamler = 'psych' # ensure it's psych
10
7
 
11
8
  module Gtk2Password
12
- # Wrapper around Crypt::XXTEA
13
- class IOCrypt
14
- LENGTH = 16
15
9
 
10
+ class IOCrypt
16
11
  def initialize(passphrase)
17
- @key = Crypt::XXTEA.new(passphrase[0..(LENGTH-1)])
12
+ @key = Digest::SHA256.digest passphrase
13
+ end
14
+
15
+ def _cipher(mode, data)
16
+ cipher = OpenSSL::Cipher::Cipher.new('bf-cbc').send(mode)
17
+ cipher.key = @key
18
+ cipher.update(data) << cipher.final
19
+ end
20
+
21
+ def _decrypt(e)
22
+ Zlib::Inflate.inflate(_cipher(:decrypt, e))
23
+ end
24
+
25
+ def _encrypt(p)
26
+ _cipher(:encrypt, Zlib::Deflate.deflate(p))
18
27
  end
19
28
 
20
29
  def load(dumpfile)
21
30
  data = nil
22
31
  begin
23
- File.open(dumpfile,'r'){|fh| data = YAML.load( @key.decrypt( fh.read ) ) }
32
+ File.open(dumpfile,'r'){|fh| data = YAML.load( _decrypt( fh.read ) ) }
24
33
  rescue Psych::SyntaxError
25
34
  # assume it's syck
26
35
  YAML::ENGINE.yamler = 'syck'
27
- File.open(dumpfile,'r'){|fh| data = YAML.load( @key.decrypt( fh.read ) ) }
36
+ File.open(dumpfile,'r'){|fh| data = YAML.load( _decrypt( fh.read ) ) }
28
37
  YAML::ENGINE.yamler = 'psych' # make it psych
29
38
  end
30
39
  return data
@@ -32,7 +41,7 @@ class IOCrypt
32
41
 
33
42
  def dump(dumpfile, data)
34
43
  count = nil
35
- File.open(dumpfile,'w') { |fh| count = fh.write( @key.encrypt( YAML.dump( data ) ) ) }
44
+ File.open(dumpfile,'w') { |fh| count = fh.write( _encrypt( YAML.dump( data ) ) ) }
36
45
  return count
37
46
  end
38
47
  end
@@ -13,9 +13,7 @@ class PasswordsData
13
13
  LAST_UPDATE = 5
14
14
 
15
15
  def reset(password)
16
- # MD5 digest length is 16 to match tiny encryption's block length
17
- passphrase = Digest::MD5.digest( password )
18
- @iocrypt = IOCrypt.new(passphrase)
16
+ @iocrypt = IOCrypt.new(password)
19
17
  end
20
18
 
21
19
  attr_reader :data
@@ -4,12 +4,12 @@ require 'gtk2passwordapp/rnd'
4
4
  module Gtk2Password
5
5
 
6
6
  ABOUT = {
7
- 'name' => 'Ruby-Gnome Password Manager II',
7
+ 'name' => 'Ruby-Gnome Password Manager III',
8
8
  'authors' => ['carlosjhr64@gmail.com'],
9
9
  'website' => 'https://sites.google.com/site/gtk2applib/home/gtk2applib-applications/gtk2passwordapp',
10
10
  'website-label' => 'Ruby-Gnome Password Manager',
11
11
  'license' => 'GPL',
12
- 'copyright' => '2011-09-19 12:00:24',
12
+ 'copyright' => '2014-07-29 17:00:00',
13
13
  }
14
14
 
15
15
  PRIMARY = Gtk::Clipboard.get((Configuration::SWITCH_CLIPBOARDS)? Gdk::Selection::CLIPBOARD: Gdk::Selection::PRIMARY)
metadata CHANGED
@@ -1,85 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gtk2passwordapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.1
5
- prerelease:
4
+ version: 3.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - carlosjhr64@gmail.com
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-10 00:00:00.000000000 Z
11
+ date: 2014-07-30 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: crypt-tea
16
- requirement: &12210460 !ruby/object:Gem::Requirement
17
- none: false
14
+ name: gtk2applib
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - =
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: 1.3.0
19
+ version: '15.3'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *12210460
25
- - !ruby/object:Gem::Dependency
26
- name: gtk2applib
27
- requirement: &12380780 !ruby/object:Gem::Requirement
28
- none: false
22
+ version_requirements: !ruby/object:Gem::Requirement
29
23
  requirements:
30
- - - ~>
24
+ - - "~>"
31
25
  - !ruby/object:Gem::Version
32
26
  version: '15.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: gtk2
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.2'
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *12380780
36
- description: ! 'A Ruby-Gnome password manager.
37
-
38
- Uses crypt-tea''s Tiny Encryption Algorithm to encrypt the datafile.
39
-
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.2'
41
+ description: |
42
+ A Ruby-Gnome password manager.
43
+ Uses Blowfish to encrypt the datafile.
40
44
  Features random password generator and clipboard use.
41
-
42
- '
43
45
  email: carlosjhr64@gmail.com
44
46
  executables:
45
- - gtk2passwordapp2
47
+ - gtk2passwordapp3
46
48
  extensions: []
47
49
  extra_rdoc_files: []
48
50
  files:
49
- - ./lib/gtk2passwordapp/appconfig.rb
50
- - ./lib/gtk2passwordapp/iocrypt.rb
51
- - ./lib/gtk2passwordapp/passwords.rb
52
- - ./lib/gtk2passwordapp/passwords_data.rb
53
- - ./lib/gtk2passwordapp/rnd.rb
54
- - ./lib/gtk2passwordapp.rb
55
- - ./pngs/icon.png
56
- - ./pngs/logo.png
51
+ - "./lib/gtk2passwordapp.rb"
52
+ - "./lib/gtk2passwordapp/appconfig.rb"
53
+ - "./lib/gtk2passwordapp/iocrypt.rb"
54
+ - "./lib/gtk2passwordapp/passwords.rb"
55
+ - "./lib/gtk2passwordapp/passwords_data.rb"
56
+ - "./lib/gtk2passwordapp/rnd.rb"
57
+ - "./pngs/icon.png"
58
+ - "./pngs/logo.png"
57
59
  - README.txt
58
- - bin/gtk2passwordapp2
60
+ - bin/gtk2passwordapp3
59
61
  homepage: https://sites.google.com/site/gtk2applib/home/gtk2applib-applications/gtk2passwordapp
60
- licenses: []
62
+ licenses:
63
+ - GPL
64
+ metadata: {}
61
65
  post_install_message:
62
66
  rdoc_options: []
63
67
  require_paths:
64
68
  - lib
65
69
  required_ruby_version: !ruby/object:Gem::Requirement
66
- none: false
67
70
  requirements:
68
- - - ! '>='
71
+ - - ">="
69
72
  - !ruby/object:Gem::Version
70
73
  version: '0'
71
74
  required_rubygems_version: !ruby/object:Gem::Requirement
72
- none: false
73
75
  requirements:
74
- - - ! '>='
76
+ - - ">="
75
77
  - !ruby/object:Gem::Version
76
78
  version: '0'
77
- requirements:
78
- - gtk2
79
+ requirements: []
79
80
  rubyforge_project:
80
- rubygems_version: 1.8.11
81
+ rubygems_version: 2.2.0
81
82
  signing_key:
82
- specification_version: 3
83
+ specification_version: 4
83
84
  summary: Ruby-Gnome Password Manager
84
85
  test_files: []
85
- has_rdoc: false