gtk2passwordapp 1.6.0 → 1.7.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 CHANGED
@@ -24,4 +24,6 @@ It's used to "salt" the password... without it, one will not be able to decrypt
24
24
  For full documentation and comments, see
25
25
  https://sites.google.com/site/gtk2applib/home/gtk2applib-applications/gtk2passwordapp
26
26
 
27
+ For a command line access to your passwords, use --no-gui option.
28
+
27
29
  carlosjhr64@gmail.com
data/bin/gtk2passwordapp CHANGED
@@ -4,6 +4,23 @@ gem 'gtk2applib', '~> 15.3'
4
4
  require 'gtk2applib'
5
5
  require 'gtk2passwordapp'
6
6
 
7
+ if $options=~/-no-gui/ then
8
+ puts "Warning: password will be shown."
9
+ print "Salt:"
10
+ salt = $stdin.gets.strip
11
+ passwords = Gtk2Password::Passwords.new(salt)
12
+ puts "Warning: selected passwords will be shown."
13
+ print "Enter Account pattern:"
14
+ pattern = Regexp.new( $stdin.gets.strip, Regexp::IGNORECASE )
15
+ passwords.accounts.each do |account|
16
+ if account =~ pattern then
17
+ password = passwords.password_of(account)
18
+ puts "\t\"" + account + "\"\t\t" + password
19
+ end
20
+ end
21
+ exit
22
+ end
23
+
7
24
  program = Gtk2AppLib::Program.new( Gtk2Password::ABOUT )
8
25
 
9
26
  begin
@@ -1,5 +1,6 @@
1
1
  require 'yaml'
2
2
  require 'rubygems'
3
+ gem 'crypt-tea','= 1.3.0'
3
4
  begin
4
5
  require 'crypt_tea'
5
6
  rescue Exception
@@ -1,4 +1,5 @@
1
- require 'gtk2passwordapp/passwords_data.rb'
1
+ require 'gtk2passwordapp/passwords_data'
2
+ require 'gtk2passwordapp/rnd'
2
3
  module Gtk2Password
3
4
  # Passwords subclasses PasswordsData :P
4
5
  class Passwords < PasswordsData
@@ -7,7 +8,7 @@ class Passwords < PasswordsData
7
8
  passphrase = ''
8
9
 
9
10
  IOCrypt::LENGTH.times do
10
- passphrase += (rand(94)+33).chr
11
+ passphrase += (Rnd::RND.random(94)+33).chr
11
12
  end
12
13
  File.open(@pfile,'w'){|fh| fh.write passphrase }
13
14
  File.chmod(0600, @pfile)
@@ -50,8 +51,8 @@ class Passwords < PasswordsData
50
51
  end
51
52
 
52
53
  attr_reader :pfile
53
- def initialize
54
- @pwd = Passwords._get_salt('Short Password')
54
+ def initialize(pwd=nil)
55
+ @pwd = pwd || Passwords._get_salt('Short Password')
55
56
  @pfile = nil
56
57
  @pph = get_passphrase
57
58
  super(@pwd+@pph)
@@ -60,6 +61,7 @@ class Passwords < PasswordsData
60
61
  # Yes, load passwords file.
61
62
  self.load
62
63
  else
64
+ raise "bad salt" if pwd
63
65
  # No, check if there is a file....
64
66
  if has_datafile? # then
65
67
  # Yes, it's got a datafile. Ask for password again.
@@ -0,0 +1,60 @@
1
+ module Gtk2Password
2
+ # This class combines realrand with rand such that
3
+ # if either one is honest, we'll get honest random numbers.
4
+ class Rnd
5
+ begin
6
+ raise "no command line realrand" if $options =~ /-no-gui/
7
+ gem 'realrand', '~> 1.0'
8
+ require 'random/online'
9
+ REALRAND = true
10
+ rescue Exception
11
+ $stderr.puts $!
12
+ REALRAND = false
13
+ end
14
+
15
+ def initialize
16
+ @bucket = []
17
+ @refilling = false
18
+ self.refill if REALRAND
19
+ end
20
+
21
+ def refill
22
+ return if @refilling
23
+ @refilling = true
24
+ Thread.new do
25
+ begin
26
+ Timeout.timeout(60) do
27
+ generator1 = Random::RandomOrg.new
28
+ @bucket += generator1.randnum(200, 0, 2657849) # 2657850 % <75,10,58,26,94>
29
+ end
30
+ rescue Exception
31
+ $stderr.puts $!
32
+ $stderr.puts "Failed to fill the bucket"
33
+ ensure
34
+ @refilling = false
35
+ end
36
+ end
37
+ end
38
+
39
+ def random(n)
40
+ if ![75,10,58,26,94].include?(n) then
41
+ $stderr.puts "Did not code for that number"
42
+ exit # seriously messed up! :))
43
+ end
44
+ if REALRAND then
45
+ refill if @bucket.length < 100
46
+ if rnd = @bucket.shift then
47
+ rnd = ((rnd + rand(n)) % n)
48
+ return rnd
49
+ else
50
+ return rand(n)
51
+ end
52
+ else
53
+ return rand(n)
54
+ end
55
+ raise "Should not get here"
56
+ end
57
+
58
+ RND = Rnd.new
59
+ end
60
+ end
@@ -1,4 +1,6 @@
1
1
  require 'gtk2passwordapp/passwords'
2
+ require 'gtk2passwordapp/rnd'
3
+
2
4
  module Gtk2Password
3
5
 
4
6
  ABOUT = {
@@ -7,7 +9,7 @@ module Gtk2Password
7
9
  'website' => 'https://sites.google.com/site/gtk2applib/home/gtk2applib-applications/gtk2passwordapp',
8
10
  'website-label' => 'Ruby-Gnome Password Manager',
9
11
  'license' => 'GPL',
10
- 'copyright' => '2011-04-26 13:57:20',
12
+ 'copyright' => '2011-06-19 21:49:32',
11
13
  }
12
14
 
13
15
  PRIMARY = Gtk::Clipboard.get((Configuration::SWITCH_CLIPBOARDS)? Gdk::Selection::CLIPBOARD: Gdk::Selection::PRIMARY)
@@ -147,14 +149,14 @@ module Gtk2Password
147
149
  when @gui[:random_button]
148
150
  suggestion = ''
149
151
  pwdlength.value.to_i.times do
150
- suggestion += (rand(94)+33).chr
152
+ suggestion += (Rnd::RND.random(94)+33).chr
151
153
  end
152
154
  @gui[:password_entry].text = suggestion
153
155
 
154
156
  when @gui[:alpha_button]
155
157
  suggestion = ''
156
158
  while suggestion.length < pwdlength.value.to_i do
157
- chr = (rand(75)+48).chr
159
+ chr = (Rnd::RND.random(75)+48).chr
158
160
  suggestion += chr if chr =~/\w/
159
161
  end
160
162
  @gui[:password_entry].text = suggestion
@@ -162,7 +164,7 @@ module Gtk2Password
162
164
  when @gui[:numeric_button]
163
165
  suggestion = ''
164
166
  pwdlength.value.to_i.times do
165
- chr = (rand(10)+48).chr
167
+ chr = (Rnd::RND.random(10)+48).chr
166
168
  suggestion += chr
167
169
  end
168
170
  @gui[:password_entry].text = suggestion
@@ -170,7 +172,7 @@ module Gtk2Password
170
172
  when @gui[:letters_button]
171
173
  suggestion = ''
172
174
  while suggestion.length < pwdlength.value.to_i do
173
- chr = (rand(58)+65).chr
175
+ chr = (Rnd::RND.random(58)+65).chr
174
176
  suggestion += chr if chr =~/[A-Z]/i
175
177
  end
176
178
  @gui[:password_entry].text = suggestion
@@ -178,7 +180,7 @@ module Gtk2Password
178
180
  when @gui[:caps_button]
179
181
  suggestion = ''
180
182
  pwdlength.value.to_i.times do
181
- chr = (rand(26)+65).chr
183
+ chr = (Rnd::RND.random(26)+65).chr
182
184
  suggestion += chr
183
185
  end
184
186
  @gui[:password_entry].text = suggestion
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gtk2passwordapp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 6
8
+ - 7
9
9
  - 0
10
- version: 1.6.0
10
+ version: 1.7.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - carlosjhr64@gmail.com
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-26 00:00:00 -07:00
19
- default_executable: gtk2passwordapp
18
+ date: 2011-06-19 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: crypt-tea
@@ -24,13 +23,14 @@ dependencies:
24
23
  requirement: &id001 !ruby/object:Gem::Requirement
25
24
  none: false
26
25
  requirements:
27
- - - ~>
26
+ - - "="
28
27
  - !ruby/object:Gem::Version
29
- hash: 9
28
+ hash: 27
30
29
  segments:
31
30
  - 1
32
31
  - 3
33
- version: "1.3"
32
+ - 0
33
+ version: 1.3.0
34
34
  type: :runtime
35
35
  version_requirements: *id001
36
36
  - !ruby/object:Gem::Dependency
@@ -62,6 +62,7 @@ extra_rdoc_files: []
62
62
 
63
63
  files:
64
64
  - ./lib/gtk2passwordapp.rb
65
+ - ./lib/gtk2passwordapp/rnd.rb
65
66
  - ./lib/gtk2passwordapp/passwords.rb
66
67
  - ./lib/gtk2passwordapp/passwords_data.rb
67
68
  - ./lib/gtk2passwordapp/iocrypt.rb
@@ -70,7 +71,6 @@ files:
70
71
  - ./pngs/icon.png
71
72
  - README.txt
72
73
  - bin/gtk2passwordapp
73
- has_rdoc: false
74
74
  homepage: https://sites.google.com/site/gtk2applib/home/gtk2applib-applications/gtk2passwordapp
75
75
  licenses: []
76
76
 
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - gtk2
102
102
  rubyforge_project:
103
- rubygems_version: 1.5.2
103
+ rubygems_version: 1.8.4
104
104
  signing_key:
105
105
  specification_version: 3
106
106
  summary: Ruby-Gnome Password Manager