keybox 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +13 -4
- data/README +3 -0
- data/bin/keybox +9 -3
- data/bin/kpg +9 -3
- data/lib/keybox.rb +8 -14
- data/lib/keybox/application/base.rb +8 -6
- data/lib/keybox/application/password_generator.rb +13 -11
- data/lib/keybox/application/password_safe.rb +31 -14
- data/lib/keybox/gemspec.rb +52 -0
- data/lib/keybox/highline_util.rb +1 -1
- data/lib/keybox/specification.rb +128 -0
- data/lib/keybox/storage/container.rb +0 -1
- data/lib/keybox/string_generator.rb +1 -1
- data/lib/keybox/version.rb +21 -0
- data/{data → resources}/chargrams.txt +0 -0
- data/{data → resources}/dark_bg.color_scheme.yaml +0 -0
- data/{data → resources}/light_bg.color_scheme.yaml +0 -0
- data/spec/base_app_spec.rb +1 -1
- data/spec/convert_csv_spec.rb +2 -3
- data/spec/entry_spec.rb +1 -1
- data/spec/keybox_app_spec.rb +25 -24
- data/spec/kpg_app_spec.rb +1 -1
- data/spec/password_hash_spec.rb +2 -1
- data/spec/randomizer_spec.rb +1 -1
- data/spec/spec_helper.rb +21 -0
- data/spec/storage_container_spec.rb +1 -7
- data/spec/storage_record_spec.rb +1 -1
- data/spec/string_generator_spec.rb +2 -1
- data/spec/uuid_spec.rb +2 -1
- metadata +50 -42
- data/vendor/highline/highline.rb +0 -744
- data/vendor/highline/highline/color_scheme.rb +0 -120
- data/vendor/highline/highline/import.rb +0 -43
- data/vendor/highline/highline/menu.rb +0 -395
- data/vendor/highline/highline/question.rb +0 -462
- data/vendor/highline/highline/system_extensions.rb +0 -125
data/CHANGES
CHANGED
@@ -1,5 +1,14 @@
|
|
1
|
-
=
|
2
|
-
|
1
|
+
= Changelog
|
2
|
+
|
3
|
+
=== Version 1.2.0 - 2007-09-09
|
4
|
+
|
5
|
+
* Added Feature [#11796] Change initial setup prompts to NOT have colorized output and ask the user what color scheme is appropriate for them
|
6
|
+
* Update to use HighLine 1.4.0
|
7
|
+
* general code cleanup
|
8
|
+
* rework rake tasks to keep in line with other projects
|
9
|
+
* switch to webby for site generation
|
10
|
+
|
11
|
+
=== Version 1.1.1 - 2007-06-21
|
3
12
|
|
4
13
|
* update all tests to use latest RSpec syntax
|
5
14
|
* Fixed Bug [#8231] storage::container.find() does not work for anything but AccountEntry classes
|
@@ -9,7 +18,7 @@
|
|
9
18
|
* Fixed Bug [#11684] apostrophe's in additional information cause errors
|
10
19
|
* Updated to using HighLine 1.2.9 (fixes Bug #9827)
|
11
20
|
|
12
|
-
=== Version 1.1.0
|
21
|
+
=== Version 1.1.0 - 2007-01-27
|
13
22
|
|
14
23
|
* keybox now uses HighLine for terminal input/output
|
15
24
|
* Added --color SCHEME option to support custom colorized output
|
@@ -18,7 +27,7 @@
|
|
18
27
|
* Fixed configuration bug where command line options were not
|
19
28
|
correctly overwriting default options.
|
20
29
|
|
21
|
-
=== Version 1.0.0
|
30
|
+
=== Version 1.0.0 - 2007-01-14
|
22
31
|
|
23
32
|
* Initial public release
|
24
33
|
* +keybox+ - Full basic functionality
|
data/README
CHANGED
@@ -92,6 +92,9 @@ applications.
|
|
92
92
|
* webgen >= 0.4.1
|
93
93
|
* highline >= 1.2.6
|
94
94
|
|
95
|
+
To run the RSpec test, you have to remove the termios library if it is installed.
|
96
|
+
stdin, stdout, and stderr are redirected and this doesn't play well with termios in highline.
|
97
|
+
|
95
98
|
== INSTALL:
|
96
99
|
|
97
100
|
* gem install keybox
|
data/bin/keybox
CHANGED
@@ -6,9 +6,15 @@
|
|
6
6
|
#----------------------------------------------------------------------
|
7
7
|
# bootstrap
|
8
8
|
#----------------------------------------------------------------------
|
9
|
-
|
10
|
-
require 'keybox'
|
11
|
-
require 'keybox/application/password_safe'
|
9
|
+
begin
|
10
|
+
require 'keybox'
|
11
|
+
require 'keybox/application/password_safe'
|
12
|
+
rescue LoadError
|
13
|
+
path = File.expand_path(File.join(File.dirname(__FILE__),"..","lib"))
|
14
|
+
raise if $:.include? path
|
15
|
+
$: << path
|
16
|
+
retry
|
17
|
+
end
|
12
18
|
|
13
19
|
#----------------------------------------------------------------------
|
14
20
|
# instantiate the program and pass it the commandline parameters
|
data/bin/kpg
CHANGED
@@ -6,9 +6,15 @@
|
|
6
6
|
#----------------------------------------------------------------------
|
7
7
|
# bootstrap
|
8
8
|
#----------------------------------------------------------------------
|
9
|
-
|
10
|
-
require 'keybox'
|
11
|
-
require 'keybox/application/password_generator'
|
9
|
+
begin
|
10
|
+
require 'keybox'
|
11
|
+
require 'keybox/application/password_generator'
|
12
|
+
rescue LoadError
|
13
|
+
path = File.expand_path(File.join(File.dirname(__FILE__),"..","lib"))
|
14
|
+
raise if $:.include? path
|
15
|
+
$: << path
|
16
|
+
retry
|
17
|
+
end
|
12
18
|
|
13
19
|
#----------------------------------------------------------------------
|
14
20
|
# instantiate the program and pass it the commandline parameters
|
data/lib/keybox.rb
CHANGED
@@ -1,22 +1,16 @@
|
|
1
1
|
module Keybox
|
2
|
-
APP_ROOT_DIR
|
3
|
-
APP_LIB_DIR
|
4
|
-
|
5
|
-
APP_VENDOR_DIR
|
6
|
-
|
7
|
-
VERSION = [1,1,1].freeze
|
8
|
-
AUTHOR = "Jeremy Hinegardner".freeze
|
9
|
-
AUTHOR_EMAIL= "jeremy@hinegardner.org".freeze
|
10
|
-
HOMEPAGE = "http://keybox.rubyforge.org".freeze
|
11
|
-
COPYRIGHT = "2006, 2007 #{AUTHOR}".freeze
|
12
|
-
DESCRIPTION = <<DESC
|
13
|
-
Keybox is a set of command line applications and ruby libraries for
|
14
|
-
secure password storage and password generation.
|
15
|
-
DESC
|
2
|
+
APP_ROOT_DIR = File.dirname(File.expand_path(File.join(__FILE__,".."))).freeze
|
3
|
+
APP_LIB_DIR = File.join(APP_ROOT_DIR,"lib").freeze
|
4
|
+
APP_RESOURCE_DIR = File.join(APP_ROOT_DIR,"resources").freeze
|
5
|
+
APP_VENDOR_DIR = File.join(APP_ROOT_DIR,"vendor").freeze
|
6
|
+
APP_BIN_DIR = File.join(APP_ROOT_DIR,"bin").freeze
|
16
7
|
end
|
17
8
|
|
18
9
|
$: << Keybox::APP_LIB_DIR
|
19
10
|
|
11
|
+
require 'keybox/version'
|
12
|
+
require 'keybox/specification'
|
13
|
+
require 'keybox/gemspec'
|
20
14
|
require 'keybox/cipher'
|
21
15
|
require 'keybox/digest'
|
22
16
|
require 'keybox/entry'
|
@@ -89,11 +89,13 @@ module Keybox
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def default_options
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
92
|
+
if not @default_options then
|
93
|
+
@default_options = OpenStruct.new
|
94
|
+
@default_options.debug = 0
|
95
|
+
@default_options.show_version = false
|
96
|
+
@default_options.show_help = false
|
97
|
+
end
|
98
|
+
return @default_options
|
97
99
|
end
|
98
100
|
|
99
101
|
def configuration_file_options
|
@@ -121,7 +123,7 @@ module Keybox
|
|
121
123
|
@stderr.puts @error_message
|
122
124
|
exit 1
|
123
125
|
elsif @parsed_options.show_version then
|
124
|
-
@highline.say "#{@parser.program_name}: version #{Keybox::VERSION
|
126
|
+
@highline.say "#{@parser.program_name}: version #{Keybox::VERSION}"
|
125
127
|
exit 0
|
126
128
|
elsif @parsed_options.show_help then
|
127
129
|
@highline.say @parser.to_s
|
@@ -75,17 +75,19 @@ module Keybox
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def default_options
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
78
|
+
if not @default_options then
|
79
|
+
@default_options = OpenStruct.new
|
80
|
+
@default_options.debug = 0
|
81
|
+
@default_options.show_version = false
|
82
|
+
@default_options.show_help = false
|
83
|
+
@default_options.algorithm = :random
|
84
|
+
@default_options.number_to_generate = 6
|
85
|
+
@default_options.min_length = 8
|
86
|
+
@default_options.max_length = 10
|
87
|
+
@default_options.use_symbols = options_to_symbol_sets(["all"])
|
88
|
+
@default_options.require_symbols = options_to_symbol_sets([])
|
89
|
+
end
|
90
|
+
return @default_options
|
89
91
|
end
|
90
92
|
|
91
93
|
def options_to_symbol_sets(args)
|
@@ -19,7 +19,7 @@ module Keybox
|
|
19
19
|
DEFAULT_DIRECTORY = File.join(home_directory,".keybox")
|
20
20
|
DEFAULT_DB = File.join(DEFAULT_DIRECTORY,"database.yaml")
|
21
21
|
DEFAULT_CONFIG = File.join(DEFAULT_DIRECTORY,"config.yaml")
|
22
|
-
DEFAULT_COLOR_SCHEME = :
|
22
|
+
DEFAULT_COLOR_SCHEME = :none
|
23
23
|
|
24
24
|
ACTION_LIST = %w(add delete edit show list master-password)
|
25
25
|
|
@@ -113,15 +113,17 @@ module Keybox
|
|
113
113
|
end
|
114
114
|
|
115
115
|
def default_options
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
116
|
+
if not @default_options then
|
117
|
+
@default_options = OpenStruct.new
|
118
|
+
@default_options.debug = 0
|
119
|
+
@default_options.show_help = false
|
120
|
+
@default_options.show_version = false
|
121
|
+
@default_options.config_file = Keybox::Application::PasswordSafe::DEFAULT_CONFIG
|
122
|
+
@default_options.db_file = Keybox::Application::PasswordSafe::DEFAULT_DB
|
123
|
+
@default_options.use_password_hash_for_url = false
|
124
|
+
@default_options.color_scheme = Keybox::Application::PasswordSafe::DEFAULT_COLOR_SCHEME
|
125
|
+
end
|
126
|
+
return @default_options
|
125
127
|
end
|
126
128
|
|
127
129
|
# load options from the configuration file, if the file
|
@@ -136,6 +138,7 @@ module Keybox
|
|
136
138
|
# if the file is 0 bytes, then this is illegal and needs
|
137
139
|
# to be overwritten.
|
138
140
|
if not File.exists?(file_path) or File.size(file_path) == 0 then
|
141
|
+
determine_color_scheme
|
139
142
|
FileUtils.mkdir_p(File.dirname(file_path))
|
140
143
|
File.open(file_path,"w") do |f|
|
141
144
|
YAML.dump(default_options.marshal_dump,f)
|
@@ -144,6 +147,20 @@ module Keybox
|
|
144
147
|
options = YAML.load_file(file_path) || Hash.new
|
145
148
|
end
|
146
149
|
|
150
|
+
# determine the color scheme to store in the initial creation of the configuration
|
151
|
+
# file. We ask the user which of the color schemes will work best for them.
|
152
|
+
def determine_color_scheme
|
153
|
+
@default_options.color_scheme = @highline.choose do |menu|
|
154
|
+
menu.layout = :one_line
|
155
|
+
menu.select_by = :name
|
156
|
+
menu.header = nil
|
157
|
+
menu.prompt = "What color scheme would you like? "
|
158
|
+
menu.choice("none") { :none }
|
159
|
+
menu.choice("dark terminal background") { :dark_bg }
|
160
|
+
menu.choice("light terminal background") { :light_bg }
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
147
164
|
#
|
148
165
|
# load the given color scheme. If the scheme cannot be
|
149
166
|
# found it will default to the +:none+ scheme which has no
|
@@ -160,7 +177,7 @@ module Keybox
|
|
160
177
|
# dark_bg.color_scheme.yaml
|
161
178
|
def load_color_scheme
|
162
179
|
if @options.color_scheme != :none then
|
163
|
-
search_directories = [ Keybox::
|
180
|
+
search_directories = [ Keybox::APP_RESOURCE_DIR, File.dirname(@options.config_file) ]
|
164
181
|
scheme_basename = "#{@options.color_scheme.to_s}.color_scheme.yaml"
|
165
182
|
scheme_path = nil
|
166
183
|
|
@@ -204,7 +221,7 @@ module Keybox
|
|
204
221
|
|
205
222
|
else
|
206
223
|
# if we don't have a file then set the color
|
207
|
-
# scheme to
|
224
|
+
# scheme to :none and we're done
|
208
225
|
@options.color_scheme = :none
|
209
226
|
::HighLine.color_scheme = ::HighLine::ColorScheme.new(NONE_SCHEME)
|
210
227
|
end
|
@@ -267,7 +284,6 @@ module Keybox
|
|
267
284
|
hsay "-" * 40, :separator_bar
|
268
285
|
hsay entry, :normal
|
269
286
|
hsay "-" * 40, :separator_bar
|
270
|
-
|
271
287
|
|
272
288
|
gathered = hagree "Is this information correct? (y/n)"
|
273
289
|
end
|
@@ -463,9 +479,10 @@ module Keybox
|
|
463
479
|
if @actions.size == 0 then
|
464
480
|
@actions << [:list, ".*"]
|
465
481
|
end
|
482
|
+
|
466
483
|
action, param = *@actions.shift
|
467
484
|
self.send(action, param)
|
468
|
-
|
485
|
+
|
469
486
|
if @db.modified? then
|
470
487
|
hsay "Database modified, saving.", :information
|
471
488
|
@db.save
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'keybox/specification'
|
3
|
+
require 'keybox/version'
|
4
|
+
require 'rake'
|
5
|
+
|
6
|
+
module Keybox
|
7
|
+
SPEC = Keybox::Specification.new do |spec|
|
8
|
+
spec.name = "keybox"
|
9
|
+
spec.version = Keybox::VERSION
|
10
|
+
spec.rubyforge_project = "keybox"
|
11
|
+
spec.author = "Jeremy Hinegardner"
|
12
|
+
spec.email = "jeremy@hinegardner.org"
|
13
|
+
spec.homepage = "http://keybox.rubyforge.org"
|
14
|
+
|
15
|
+
spec.summary = "Secure pasword storage."
|
16
|
+
spec.description = <<-DESC
|
17
|
+
A set of command line applications and ruby libraries for
|
18
|
+
secure password storage and password generation.
|
19
|
+
DESC
|
20
|
+
|
21
|
+
spec.extra_rdoc_files = FileList["CHANGES", "COPYING", "README"]
|
22
|
+
spec.has_rdoc = true
|
23
|
+
spec.rdoc_main = "README"
|
24
|
+
spec.rdoc_options = [ "--line-numbers" , "--inline-source" ]
|
25
|
+
|
26
|
+
spec.test_files = FileList["spec/**/*.rb"]
|
27
|
+
spec.default_executable = "#{spec.name}"
|
28
|
+
spec.executables = Dir.entries(Keybox::APP_BIN_DIR).delete_if { |f| f =~ /\A\./ }
|
29
|
+
spec.files = spec.test_files + spec.extra_rdoc_files +
|
30
|
+
FileList["lib/**/*.rb", "resources/**/*", "data/**/*"]
|
31
|
+
|
32
|
+
spec.add_dependency("highline", ">= 1.4.0")
|
33
|
+
|
34
|
+
spec.required_ruby_version = ">= 1.8.5"
|
35
|
+
|
36
|
+
spec.platform = Gem::Platform::RUBY
|
37
|
+
|
38
|
+
spec.remote_user = "jjh"
|
39
|
+
spec.local_site_dir = "doc"
|
40
|
+
spec.local_rdoc_dir = "doc/rdoc"
|
41
|
+
spec.remote_rdoc_dir = "rdoc/"
|
42
|
+
spec.local_coverage_dir = "doc/coverage"
|
43
|
+
|
44
|
+
spec.remote_site_dir = ""
|
45
|
+
|
46
|
+
spec.post_install_message = "\e[1m\e[31m\e[40mTry `keybox --help` for more information\e[0m"
|
47
|
+
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
|
data/lib/keybox/highline_util.rb
CHANGED
@@ -0,0 +1,128 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rubygems/specification'
|
3
|
+
require 'rake'
|
4
|
+
|
5
|
+
module Keybox
|
6
|
+
# Add some additional items to Gem::Specification
|
7
|
+
# A Keybox::Specification adds additional pieces of information the
|
8
|
+
# typical gem specification
|
9
|
+
class Specification
|
10
|
+
|
11
|
+
RUBYFORGE_ROOT = "/var/www/gforge-projects/"
|
12
|
+
|
13
|
+
# user that accesses remote site
|
14
|
+
attr_accessor :remote_user
|
15
|
+
|
16
|
+
# remote host, default 'rubyforge.org'
|
17
|
+
attr_accessor :remote_host
|
18
|
+
|
19
|
+
# name the rdoc main
|
20
|
+
attr_accessor :rdoc_main
|
21
|
+
|
22
|
+
# local directory in development holding the generated rdoc
|
23
|
+
# default 'doc'
|
24
|
+
attr_accessor :local_rdoc_dir
|
25
|
+
|
26
|
+
# remote directory for storing rdoc, default 'doc'
|
27
|
+
attr_accessor :remote_rdoc_dir
|
28
|
+
|
29
|
+
# local directory for coverage report
|
30
|
+
attr_accessor :local_coverage_dir
|
31
|
+
|
32
|
+
# remote directory for storing coverage reports
|
33
|
+
# This defaults to 'coverage'
|
34
|
+
attr_accessor :remote_coverage_dir
|
35
|
+
|
36
|
+
# local directory for generated website, default +site/public+
|
37
|
+
attr_accessor :local_site_dir
|
38
|
+
|
39
|
+
# remote directory relative to +remote_root+ for the website.
|
40
|
+
# website.
|
41
|
+
attr_accessor :remote_site_dir
|
42
|
+
|
43
|
+
# is a .tgz to be created?, default 'true'
|
44
|
+
attr_accessor :need_tar
|
45
|
+
|
46
|
+
# is a .zip to be created, default 'true'
|
47
|
+
attr_accessor :need_zip
|
48
|
+
|
49
|
+
|
50
|
+
def initialize
|
51
|
+
@remote_user = nil
|
52
|
+
@remote_host = "rubyforge.org"
|
53
|
+
|
54
|
+
@rdoc_main = "README"
|
55
|
+
@local_rdoc_dir = "doc"
|
56
|
+
@remote_rdoc_dir = "doc"
|
57
|
+
@local_coverage_dir = "coverage"
|
58
|
+
@remote_coverage_dir = "coverage"
|
59
|
+
@local_site_dir = "site/public"
|
60
|
+
@remote_site_dir = "."
|
61
|
+
|
62
|
+
@need_tar = true
|
63
|
+
@need_zip = true
|
64
|
+
|
65
|
+
@spec = Gem::Specification.new
|
66
|
+
|
67
|
+
yield self if block_given?
|
68
|
+
|
69
|
+
# update rdoc options to take care of the rdoc_main if it is
|
70
|
+
# there, and add a default title if one is not given
|
71
|
+
if not @spec.rdoc_options.include?("--main") then
|
72
|
+
@spec.rdoc_options.concat(["--main", rdoc_main])
|
73
|
+
end
|
74
|
+
|
75
|
+
if not @spec.rdoc_options.include?("--title") then
|
76
|
+
@spec.rdoc_options.concat(["--title","'#{name} -- #{summary}'"])
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# if this gets set then it overwrites what would be the
|
81
|
+
# rubyforge default. If rubyforge project is not set then use
|
82
|
+
# name. If rubyforge project and name are set, but they are
|
83
|
+
# different then assume that name is a subproject of the
|
84
|
+
# rubyforge project
|
85
|
+
def remote_root
|
86
|
+
if rubyforge_project.nil? or
|
87
|
+
rubyforge_project == name then
|
88
|
+
return RUBYFORGE_ROOT + "#{name}/"
|
89
|
+
else
|
90
|
+
return RUBYFORGE_ROOT + "#{rubyforge_project}/#{name}/"
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
# rdoc files is the same as what would be generated during gem
|
95
|
+
# installation. That is, everything in the require paths plus
|
96
|
+
# the extra_rdoc_files
|
97
|
+
#
|
98
|
+
def rdoc_files
|
99
|
+
flist = extra_rdoc_files.dup
|
100
|
+
@spec.require_paths.each do |rp|
|
101
|
+
flist << FileList["#{rp}/**/*.rb"]
|
102
|
+
end
|
103
|
+
flist.flatten.uniq
|
104
|
+
end
|
105
|
+
|
106
|
+
# calculate the remote directories
|
107
|
+
def remote_root_location
|
108
|
+
"#{remote_user}@#{remote_host}:#{remote_root}"
|
109
|
+
end
|
110
|
+
|
111
|
+
def remote_rdoc_location
|
112
|
+
remote_root_location + @remote_rdoc_dir
|
113
|
+
end
|
114
|
+
|
115
|
+
def remote_coverage_location
|
116
|
+
remote_root_loation + @remote_coverage_dir
|
117
|
+
end
|
118
|
+
|
119
|
+
def remote_site_location
|
120
|
+
remote_root_location + @remote_site_dir
|
121
|
+
end
|
122
|
+
|
123
|
+
# we delegate any other calls to spec
|
124
|
+
def method_missing(method_id,*params,&block)
|
125
|
+
@spec.send method_id, *params, &block
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|