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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ac01c3e11dac6e4e8ef24b14e88dbb64164dd6fd81c34c7e0408c90b26838dd
4
- data.tar.gz: 5c0bf89484444b8b72c1e5a07df573364f75b315f8abe099ef81236a0b277055
3
+ metadata.gz: a9cb66100bc7199a9b69abb8d686ea30d9ff9664292bda63e90063dd19c06f55
4
+ data.tar.gz: c4adf4de9493da85efd300ccdb2e7ca9f9baedf5e518d9c33848913a74a155ea
5
5
  SHA512:
6
- metadata.gz: e28b74015ab982982ad09ab7c7e5f914acb249f8f61f3fa221d2e572ed2f52758d4622777c9000079f5e19a052ac45e1ae585f73feb4fe4e7559bf7d6d4cbdfb
7
- data.tar.gz: ced2414f90e641209126b2205f49eb10d8d3f0822f75198e963739d5d0d2c57e5093c61c043e02dd83edbf4bd92de9b3fc835adf3f2f3e8438fc121ce954e4b5
6
+ metadata.gz: 37225c672b7f967a002e622a1f062dff500de37094bde5a2121c9971a3b67a3399f498af5a47ddc3533181fc15de790056eee841c75ba0c1cbd8f4a61d9cdc13
7
+ data.tar.gz: c96925a8183462ddd419111b098f7e36680d0ee36f66986e3f99aabf707cf4e09b986eba5532376affb21caa48de728d5815ecccea7ece0851ea2fcac89e8454
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ssbx (0.1.1)
4
+ ssbx (0.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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 = File.read(CONFIG['set'])
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, u, p, data)
137
+ bx.write(io, CONFIG['user'], CONFIG['pass'], data)
96
138
  end
97
139
  end
98
140
 
data/lib/ssbx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ssbx
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ssbx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam