ssbx 0.1.2 → 0.1.3
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +5 -0
- data/exe/ssbx +44 -2
- data/lib/ssbx/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9cb66100bc7199a9b69abb8d686ea30d9ff9664292bda63e90063dd19c06f55
|
4
|
+
data.tar.gz: c4adf4de9493da85efd300ccdb2e7ca9f9baedf5e518d9c33848913a74a155ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37225c672b7f967a002e622a1f062dff500de37094bde5a2121c9971a3b67a3399f498af5a47ddc3533181fc15de790056eee841c75ba0c1cbd8f4a61d9cdc13
|
7
|
+
data.tar.gz: c96925a8183462ddd419111b098f7e36680d0ee36f66986e3f99aabf707cf4e09b986eba5532376affb21caa48de728d5815ecccea7ece0851ea2fcac89e8454
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -46,6 +46,11 @@ Then use `ssbx` to view or edit a file.
|
|
46
46
|
# Edit file data and re-encrypt the file.
|
47
47
|
ssbx -f f1.enc -e
|
48
48
|
|
49
|
+
# Rotate passwords.
|
50
|
+
cp ~/.ssbx.yaml tmpconfig
|
51
|
+
# Edit ~/.ssbx.yaml to contain a new password.
|
52
|
+
ssbx -f f1.enc --config tmpconfig -o - | ssbx -f f2.enc --set=-
|
53
|
+
|
49
54
|
|
50
55
|
## Development
|
51
56
|
|
data/exe/ssbx
CHANGED
@@ -34,6 +34,15 @@ OptionParser.new do |opts|
|
|
34
34
|
CONFIG['edit'] = true
|
35
35
|
end
|
36
36
|
|
37
|
+
opts.on('--init-config', "Configure ~/.ssbx.yaml.") do
|
38
|
+
CONFIG['config'] = true
|
39
|
+
end
|
40
|
+
|
41
|
+
opts.on('-c', '--config=file', "Merge another config file YAML into this one.") do |f|
|
42
|
+
c = YAML::load(File.read(f))
|
43
|
+
CONFIG.merge! c
|
44
|
+
end
|
45
|
+
|
37
46
|
opts.on('-d', '--delete=user', String, "Delete user. May be used multiple times.") do |u|
|
38
47
|
CONFIG['delete_users'] << u
|
39
48
|
end
|
@@ -59,6 +68,37 @@ OptionParser.new do |opts|
|
|
59
68
|
end
|
60
69
|
end.parse! ARGV
|
61
70
|
|
71
|
+
if CONFIG['config']
|
72
|
+
print "User name? [#{ENV['USER']}]: "
|
73
|
+
CONFIG['user'] = STDIN.readline.chomp
|
74
|
+
CONFIG['user'] = ENV['USER'] if CONFIG['user'] == ''
|
75
|
+
|
76
|
+
require 'io/console'
|
77
|
+
STDIN.echo = false
|
78
|
+
print "Password: "
|
79
|
+
p = begin
|
80
|
+
STDIN.readline.chomp
|
81
|
+
ensure
|
82
|
+
STDIN.echo = true
|
83
|
+
puts ''
|
84
|
+
end
|
85
|
+
CONFIG['pass'] = p unless p == ''
|
86
|
+
|
87
|
+
print "Editor? [#{ENV['EDITOR']}]: "
|
88
|
+
e = STDIN.readline.chomp
|
89
|
+
CONFIG['editor'] = e unless e == ''
|
90
|
+
|
91
|
+
require 'yaml'
|
92
|
+
File.open(default_config, 'wb') do |io|
|
93
|
+
io.write(YAML::dump(
|
94
|
+
CONFIG.select do |k,v|
|
95
|
+
k !~ /^delete_users|add_users|config|verbose$/
|
96
|
+
end
|
97
|
+
))
|
98
|
+
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
62
102
|
if CONFIG['verbose']
|
63
103
|
require 'pp'
|
64
104
|
pp CONFIG
|
@@ -90,9 +130,11 @@ end
|
|
90
130
|
if CONFIG['set']
|
91
131
|
f = Ssbx::File.new
|
92
132
|
bx = Ssbx::Box.new(f)
|
93
|
-
data =
|
133
|
+
data = Ssbx::Util.read(CONFIG['set']) do |io|
|
134
|
+
io.read
|
135
|
+
end
|
94
136
|
Ssbx::Util.write(CONFIG['file']) do |io|
|
95
|
-
bx.write(io,
|
137
|
+
bx.write(io, CONFIG['user'], CONFIG['pass'], data)
|
96
138
|
end
|
97
139
|
end
|
98
140
|
|
data/lib/ssbx/version.rb
CHANGED