safe 0.5 → 0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README +7 -27
- data/Rakefile +4 -2
- data/Release-Notes.txt +10 -0
- data/bin/safe +18 -14
- data/lib/blowfish.rb +31 -0
- data/lib/safediff.rb +4 -1
- data/lib/safeentry.rb +4 -1
- data/lib/safefile.rb +8 -3
- data/lib/safeutils.rb +6 -5
- data/test/tc_safediff.rb +2 -2
- data/test/tc_safeentry.rb +1 -1
- data/test/tc_safefile.rb +2 -2
- data/test/tc_safeutils.rb +1 -1
- metadata +29 -14
data/README
CHANGED
@@ -33,33 +33,11 @@ bar
|
|
33
33
|
This is a one-time operation.
|
34
34
|
|
35
35
|
== License ==
|
36
|
-
Safe is licensed under the
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
are permitted provided that the following conditions are met:
|
42
|
-
|
43
|
-
* Redistributions of source code must retain the above copyright notice,
|
44
|
-
this list of conditions and the following disclaimer.
|
45
|
-
* Redistributions in binary form must reproduce the above copyright notice,
|
46
|
-
this list of conditions and the following disclaimer in the documentation
|
47
|
-
and/or other materials provided with the distribution.
|
48
|
-
* Neither the name of Rob Warner nor the names of its contributors may be
|
49
|
-
used to endorse or promote products derived from this software without
|
50
|
-
specific prior written permission.
|
51
|
-
|
52
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
53
|
-
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
54
|
-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
55
|
-
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
56
|
-
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
57
|
-
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
58
|
-
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
59
|
-
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
60
|
-
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
61
|
-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
62
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
36
|
+
Safe is licensed under the Eclipse Public License. Copyright (c) 2007, 2010 Rob Warner
|
37
|
+
All rights reserved. This program and the accompanying materials
|
38
|
+
are made available under the terms of the Eclipse Public License v1.0
|
39
|
+
which accompanies this distribution, and is available at
|
40
|
+
http://www.eclipse.org/legal/epl-v10.html
|
63
41
|
|
64
42
|
== Installation ==
|
65
43
|
To install safe, you must have Ruby and Ruby Gems installed. From the command
|
@@ -88,6 +66,8 @@ Windows:
|
|
88
66
|
0.3 -- September 7, 2007
|
89
67
|
0.4 -- April 4, 2008
|
90
68
|
0.5 -- April 6, 2008
|
69
|
+
0.6 -- December 16, 2010
|
70
|
+
0.7 -- February 18, 2011
|
91
71
|
|
92
72
|
See Release-Notes.txt for more information
|
93
73
|
|
data/Rakefile
CHANGED
@@ -7,7 +7,7 @@ gem_spec = Gem::Specification.new do |spec|
|
|
7
7
|
spec.summary = 'A command-line password storage program'
|
8
8
|
spec.description = %{safe safely stores all your user IDs and passwords,
|
9
9
|
encrypted by a password of your choosing.}
|
10
|
-
spec.version = '0.
|
10
|
+
spec.version = '0.7'
|
11
11
|
|
12
12
|
# Author information
|
13
13
|
spec.author = 'Rob Warner'
|
@@ -47,7 +47,9 @@ task :web do
|
|
47
47
|
readme = f.read
|
48
48
|
f.close
|
49
49
|
|
50
|
-
# Transform
|
50
|
+
# Transform as necessary
|
51
|
+
readme.gsub!(/</, '<')
|
52
|
+
readme.gsub!(/>/, '>')
|
51
53
|
readme.gsub!(/===(.*?)===/, '<h1>\1</h1>')
|
52
54
|
readme.gsub!(/==(.*?)==/, '<h2>\1</h2>')
|
53
55
|
readme.gsub!(/\n/, '<br />')
|
data/Release-Notes.txt
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
Safe Release Notes
|
2
2
|
------------------
|
3
|
+
0.7 (February 18, 2011)
|
4
|
+
-----------------------
|
5
|
+
[FIXED] Monkey patch crypt/blowfish so that safe runs under ruby 1.9
|
6
|
+
|
7
|
+
0.6 (December 16, 2010)
|
8
|
+
-----------------------
|
9
|
+
[FIXED] Fix paths for required files to include current directory (1.9)
|
10
|
+
[FIXED] Fix when statements to use then instead of : (1.9)
|
11
|
+
Note that safe still doesn't work under Ruby 1.9, as the Blowfish gem still doesn't work under 1.9
|
12
|
+
|
3
13
|
0.5 (April 6, 2008)
|
4
14
|
-------------------
|
5
15
|
[FIXED] Version number in help output corrected
|
data/bin/safe
CHANGED
@@ -4,7 +4,10 @@
|
|
4
4
|
# safe: Safe Storage for Passwords.
|
5
5
|
# Stores user IDs and passwords, encrypted by a password.
|
6
6
|
#
|
7
|
-
# Copyright (c) 2007, Rob Warner
|
7
|
+
# Copyright (c) 2007, 2011 Rob Warner
|
8
|
+
# rwarner@grailbox.com
|
9
|
+
# http://grailbox.com
|
10
|
+
# @hoop33
|
8
11
|
#
|
9
12
|
# All rights reserved.
|
10
13
|
#
|
@@ -34,14 +37,15 @@
|
|
34
37
|
########################################################################
|
35
38
|
require 'rubygems'
|
36
39
|
require 'optparse'
|
37
|
-
|
38
|
-
require File.join(File.dirname(__FILE__), '..', 'lib', '
|
39
|
-
require File.join(File.dirname(__FILE__), '..', 'lib', '
|
40
|
+
|
41
|
+
require File.join('.', File.dirname(__FILE__), '..', 'lib', 'safeentry')
|
42
|
+
require File.join('.', File.dirname(__FILE__), '..', 'lib', 'safefile')
|
43
|
+
require File.join('.', File.dirname(__FILE__), '..', 'lib', 'safeutils')
|
40
44
|
|
41
45
|
# TODO support list <NAME> without -l flag
|
42
46
|
|
43
47
|
class Safe
|
44
|
-
SAFE_VERSION = '0.
|
48
|
+
SAFE_VERSION = '0.7'
|
45
49
|
|
46
50
|
# Gets the command line
|
47
51
|
def self.get_command_line
|
@@ -92,7 +96,7 @@ class Safe
|
|
92
96
|
def self.run
|
93
97
|
options = get_command_line
|
94
98
|
if options[:action] == 'version'
|
95
|
-
puts "Safe version #{SAFE_VERSION}, Copyright (C)
|
99
|
+
puts "Safe version #{SAFE_VERSION}, Copyright (C) 2011 Rob Warner"
|
96
100
|
else
|
97
101
|
begin
|
98
102
|
dir = SafeUtils::get_safe_dir
|
@@ -100,14 +104,14 @@ class Safe
|
|
100
104
|
|
101
105
|
# Perform the requested action
|
102
106
|
case options[:action]
|
103
|
-
when 'list'
|
104
|
-
when 'add'
|
105
|
-
when 'delete'
|
106
|
-
when 'count'
|
107
|
-
when 'password'
|
108
|
-
when 'import'
|
109
|
-
when 'diff'
|
110
|
-
when 'merge'
|
107
|
+
when 'list' then file.list(options[:name])
|
108
|
+
when 'add' then file.add(options[:name])
|
109
|
+
when 'delete' then file.delete(options[:name])
|
110
|
+
when 'count' then puts file.count
|
111
|
+
when 'password' then file.change_password
|
112
|
+
when 'import' then SafeUtils::import(file, options[:name])
|
113
|
+
when 'diff' then SafeUtils::diff(file, options[:name])
|
114
|
+
when 'merge' then SafeUtils::merge(file, options[:name])
|
111
115
|
end
|
112
116
|
rescue
|
113
117
|
abort $!.message
|
data/lib/blowfish.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
module Crypt
|
2
|
+
class Blowfish
|
3
|
+
def setup_blowfish()
|
4
|
+
@sBoxes = Array.new(4) { |i| INITIALSBOXES[i].clone }
|
5
|
+
@pArray = INITIALPARRAY.clone
|
6
|
+
keypos = 0
|
7
|
+
0.upto(17) { |i|
|
8
|
+
data = 0
|
9
|
+
4.times {
|
10
|
+
data = ((data << 8) | @key[keypos].ord) % ULONG
|
11
|
+
keypos = (keypos.next) % @key.length
|
12
|
+
}
|
13
|
+
@pArray[i] = (@pArray[i] ^ data) % ULONG
|
14
|
+
}
|
15
|
+
l = 0
|
16
|
+
r = 0
|
17
|
+
0.step(17, 2) { |i|
|
18
|
+
l, r = encrypt_pair(l, r)
|
19
|
+
@pArray[i] = l
|
20
|
+
@pArray[i+1] = r
|
21
|
+
}
|
22
|
+
0.upto(3) { |i|
|
23
|
+
0.step(255, 2) { |j|
|
24
|
+
l, r = encrypt_pair(l, r)
|
25
|
+
@sBoxes[i][j] = l
|
26
|
+
@sBoxes[i][j+1] = r
|
27
|
+
}
|
28
|
+
}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/safediff.rb
CHANGED
data/lib/safeentry.rb
CHANGED
data/lib/safefile.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
########################################################################
|
2
2
|
# safefile.rb
|
3
|
-
# Copyright (c) 2007, Rob Warner
|
3
|
+
# Copyright (c) 2007, 2011 Rob Warner
|
4
|
+
# rwarner@grailbox.com
|
5
|
+
# http://grailbox.com
|
6
|
+
# @hoop33
|
4
7
|
#
|
5
8
|
# All rights reserved.
|
6
9
|
#
|
@@ -29,11 +32,13 @@
|
|
29
32
|
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
33
|
########################################################################
|
31
34
|
require 'rubygems'
|
32
|
-
require 'crypt/blowfish'
|
33
|
-
require 'digest/sha2'
|
34
35
|
require 'rexml/document'
|
35
36
|
require 'fileutils'
|
36
37
|
require 'base64'
|
38
|
+
require 'digest/sha2'
|
39
|
+
require 'crypt/blowfish'
|
40
|
+
|
41
|
+
require File.join(File.dirname(__FILE__), 'blowfish')
|
37
42
|
|
38
43
|
include REXML
|
39
44
|
|
data/lib/safeutils.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
########################################################################
|
2
2
|
# safeutils.rb
|
3
|
-
# Copyright (c) 2007, Rob Warner
|
3
|
+
# Copyright (c) 2007, 2011 Rob Warner
|
4
|
+
# rwarner@grailbox.com
|
5
|
+
# http://grailbox.com
|
6
|
+
# @hoop33
|
4
7
|
#
|
5
8
|
# All rights reserved.
|
6
9
|
#
|
@@ -122,10 +125,8 @@ class SafeUtils
|
|
122
125
|
def SafeUtils.do_merge(safe_file, diffs, override_master = false)
|
123
126
|
diffs.each do |diff|
|
124
127
|
case diff.operation
|
125
|
-
when SafeDiff::
|
126
|
-
when SafeDiff::
|
127
|
-
safe_file.insert(diff.other.name, diff.other.id, diff.other.password)
|
128
|
-
when SafeDiff::CHANGE: # Update safe file
|
128
|
+
when SafeDiff::OTHER then safe_file.insert(diff.other.name, diff.other.id, diff.other.password)
|
129
|
+
when SafeDiff::CHANGE then # Update safe file
|
129
130
|
if override_master || replace_master?(diff)
|
130
131
|
safe_file.insert(diff.other.name, diff.other.id, diff.other.password)
|
131
132
|
end
|
data/test/tc_safediff.rb
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
# http://www.eclipse.org/legal/epl-v10.html
|
8
8
|
########################################################################
|
9
9
|
|
10
|
-
require File.join(File.dirname(__FILE__), '..', 'lib', 'safediff')
|
10
|
+
require File.join('.', File.dirname(__FILE__), '..', 'lib', 'safediff')
|
11
11
|
require 'test/unit'
|
12
12
|
|
13
13
|
class SafeDiffTest < Test::Unit::TestCase
|
@@ -49,4 +49,4 @@ class SafeDiffTest < Test::Unit::TestCase
|
|
49
49
|
assert_equal diff.operation, SafeDiff::CHANGE
|
50
50
|
assert_equal diff.to_s, "#{SafeDiff::CHANGE}\n< #{e1.to_s}\n---\n> #{e5.to_s}\n"
|
51
51
|
end
|
52
|
-
end
|
52
|
+
end
|
data/test/tc_safeentry.rb
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
# http://www.eclipse.org/legal/epl-v10.html
|
8
8
|
########################################################################
|
9
9
|
|
10
|
-
require File.join(File.dirname(__FILE__), '..', 'lib', 'safeentry')
|
10
|
+
require File.join('.', File.dirname(__FILE__), '..', 'lib', 'safeentry')
|
11
11
|
require 'test/unit'
|
12
12
|
|
13
13
|
class SafeDirTest < Test::Unit::TestCase
|
data/test/tc_safefile.rb
CHANGED
@@ -7,8 +7,8 @@
|
|
7
7
|
# http://www.eclipse.org/legal/epl-v10.html
|
8
8
|
########################################################################
|
9
9
|
|
10
|
-
require File.join(File.dirname(__FILE__), '..', 'lib', 'safefile')
|
11
|
-
require File.join(File.dirname(__FILE__), '..', 'lib', 'safeentry')
|
10
|
+
require File.join('.', File.dirname(__FILE__), '..', 'lib', 'safefile')
|
11
|
+
require File.join('.', File.dirname(__FILE__), '..', 'lib', 'safeentry')
|
12
12
|
require 'test/unit'
|
13
13
|
require 'fileutils'
|
14
14
|
|
data/test/tc_safeutils.rb
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
# http://www.eclipse.org/legal/epl-v10.html
|
8
8
|
########################################################################
|
9
9
|
|
10
|
-
require File.join(File.dirname(__FILE__), '..', 'lib', 'safeutils')
|
10
|
+
require File.join('.', File.dirname(__FILE__), '..', 'lib', 'safeutils')
|
11
11
|
require 'test/unit'
|
12
12
|
require 'fileutils'
|
13
13
|
|
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: safe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease:
|
5
|
+
version: "0.7"
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Rob Warner
|
@@ -9,28 +10,34 @@ autorequire:
|
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
12
|
|
12
|
-
date:
|
13
|
+
date: 2011-02-18 00:00:00 -05:00
|
13
14
|
default_executable: safe
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: crypt
|
17
|
-
|
18
|
-
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
19
21
|
requirements:
|
20
22
|
- - ">="
|
21
23
|
- !ruby/object:Gem::Version
|
22
24
|
version: 1.1.4
|
23
|
-
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
24
27
|
- !ruby/object:Gem::Dependency
|
25
28
|
name: highline
|
26
|
-
|
27
|
-
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
28
32
|
requirements:
|
29
33
|
- - ">="
|
30
34
|
- !ruby/object:Gem::Version
|
31
35
|
version: 1.4.0
|
32
|
-
|
33
|
-
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id002
|
38
|
+
description: |-
|
39
|
+
safe safely stores all your user IDs and passwords,
|
40
|
+
encrypted by a password of your choosing.
|
34
41
|
email: rwarner@grailbox.com
|
35
42
|
executables:
|
36
43
|
- safe
|
@@ -40,6 +47,7 @@ extra_rdoc_files: []
|
|
40
47
|
|
41
48
|
files:
|
42
49
|
- README
|
50
|
+
- lib/blowfish.rb
|
43
51
|
- lib/safediff.rb
|
44
52
|
- lib/safeentry.rb
|
45
53
|
- lib/safefile.rb
|
@@ -47,31 +55,38 @@ files:
|
|
47
55
|
- index.html
|
48
56
|
- Rakefile
|
49
57
|
- Release-Notes.txt
|
50
|
-
|
58
|
+
- test/tc_safediff.rb
|
59
|
+
- test/tc_safeentry.rb
|
60
|
+
- test/tc_safefile.rb
|
61
|
+
- test/tc_safeutils.rb
|
62
|
+
- bin/safe
|
63
|
+
has_rdoc: true
|
51
64
|
homepage: http://safe.rubyforge.org/
|
65
|
+
licenses: []
|
66
|
+
|
52
67
|
post_install_message:
|
53
68
|
rdoc_options: []
|
54
69
|
|
55
70
|
require_paths:
|
56
71
|
- lib
|
57
72
|
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
58
74
|
requirements:
|
59
75
|
- - ">="
|
60
76
|
- !ruby/object:Gem::Version
|
61
77
|
version: "0"
|
62
|
-
version:
|
63
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
64
80
|
requirements:
|
65
81
|
- - ">="
|
66
82
|
- !ruby/object:Gem::Version
|
67
83
|
version: "0"
|
68
|
-
version:
|
69
84
|
requirements: []
|
70
85
|
|
71
86
|
rubyforge_project: safe
|
72
|
-
rubygems_version: 1.0
|
87
|
+
rubygems_version: 1.5.0
|
73
88
|
signing_key:
|
74
|
-
specification_version:
|
89
|
+
specification_version: 3
|
75
90
|
summary: A command-line password storage program
|
76
91
|
test_files:
|
77
92
|
- test/tc_safediff.rb
|