mpw 3.2.1 → 4.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ff318ce8061073b24eabf8281fe0788d18013fc
4
- data.tar.gz: 16c7121ac2fba8ce8815756c6de92434aed846f0
3
+ metadata.gz: 449a8603fbd577dd5cb93ef7beefb0b8e9c45825
4
+ data.tar.gz: 763ee9163b7d0abac719853bdf48fa3b4a10ec7d
5
5
  SHA512:
6
- metadata.gz: 67d566ca822ca103f1e3e1dd13dacfadfa2e78f8550751cb64f54df182fcc101f54eadab2d5682731025c7ecff4cbff56e698701ded4906b2fee25608d0db6c6
7
- data.tar.gz: c248a9fd67592cb63fe4957946941c38bf2939cad89171074a4c1125a4e417a26060bf2c61d3f39a5c3b7f41f7122c22d5458560b61618f570568e2c2daeedbe
6
+ metadata.gz: f843a0c0918d63864f01c7929736f75f60bbe97ac3de0b0588b10bc90b50e87abf7f155622653c19947caa11648ac1147e88a38ff8a8756593020fb976d10d50
7
+ data.tar.gz: 571dc0eb3daa1d425f4ceae5137f1cfc41017828335d6b8fe081428c9d6bd7713badfee3cec0cc49fe45512305bcb176555c6c412c1dc8e13100b35e609b14e5
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
1
  Gemfile.lock
2
+ *.gem
data/.travis.yml ADDED
@@ -0,0 +1,14 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.4.0
4
+ - 2.3.3
5
+ - 2.2.6
6
+ - 2.1.10
7
+ install:
8
+ - bundle install
9
+ - gem install 'test-unit'
10
+ - echo 9999 > VERSION
11
+ - gem build mpw.gemspec
12
+ - gem install mpw-9999.gem
13
+ script:
14
+ - ruby ./test/tests.rb
data/CHANGELOG.md ADDED
@@ -0,0 +1,56 @@
1
+ # CHANGELOG
2
+ ## v4.0.0
3
+
4
+ * feature: set default wallet
5
+ * add option for generate a random password when you update an item
6
+ * fix encryption when you share an existing wallet
7
+ * several bugs fix
8
+
9
+ ## v4.0.0-beta1
10
+
11
+ * add manage share key with new interface
12
+
13
+ ## v4.0.0-beta
14
+
15
+ * new interface with a table
16
+ * new command line interface
17
+ * use text editor for add or update an item
18
+ * fix generate gpg key with RSA
19
+ * several bugs fix
20
+ * add unit tests
21
+
22
+ ## v3.2.1
23
+
24
+ * fix bug when add a new item
25
+
26
+ ## v3.2.0
27
+
28
+ * add support OTP
29
+ * fix bug in synchronize
30
+ * improve interface
31
+
32
+ ## v3.1.0
33
+
34
+ * add clipboard
35
+ * can change gpg version
36
+ * minor change in interface
37
+ * several bugs fix
38
+
39
+ ## v3.0.0
40
+
41
+ * new storage format
42
+ * new share system
43
+ * remove MPW server
44
+
45
+ ## v2.0.0
46
+
47
+ * change format csv to yaml
48
+ * easy install with gem
49
+ * add sync with ftp and ssh
50
+ * many improvement
51
+
52
+ ## v1.1.0
53
+
54
+ * Add sync with MPW Server
55
+ * Add MPW Server
56
+ * Fix minors bugs
data/Gemfile CHANGED
@@ -1,10 +1,10 @@
1
1
  source 'https://rubygems.org'
2
- gem 'highline'
3
- gem 'i18n'
4
- gem 'locale'
5
- gem 'gpgme'
6
- gem 'colorize'
7
- gem 'net-ssh'
8
- gem 'net-scp'
9
- gem 'clipboard'
10
- gem 'rotp'
2
+ gem "i18n", "~> 0.7", ">= 0.7.0"
3
+ gem "gpgme", "~> 2.0", ">= 2.0.12"
4
+ gem "highline", "~> 1.7", ">= 1.7.8"
5
+ gem "locale", "~> 2.1", ">= 2.1.2"
6
+ gem "colorize", "~> 0.8", ">= 0.8.1"
7
+ gem "net-ssh", "~> 3.2", ">= 3.2.0"
8
+ gem "net-sftp", "~> 2.1", ">= 2.1.2"
9
+ gem "clipboard", "~> 1.1", ">= 1.1.1"
10
+ gem "rotp", "~> 3.1", ">= 3.1.0"
data/README.md CHANGED
@@ -1,128 +1,147 @@
1
- # Manage your passwords!
1
+ # MPW: Manage your passwords!
2
+ [![Version](https://img.shields.io/badge/latest_version-4.0.0-green.svg)](https://github.com/nishiki/manage-password/releases)
3
+ [![Build Status](https://travis-ci.org/nishiki/manage-password.svg?branch=master)](https://travis-ci.org/nishiki/manage-password)
4
+ [![License](https://img.shields.io/badge/license-GPL--2.0-blue.svg)](https://github.com/nishiki/manage-password/blob/master/LICENSE)
2
5
 
3
- MPW is a little software which stores your passwords in an GPG encrypted file.
4
- MPW can synchronize your password with SSH or FTP.
6
+ mpw is a little software which stores your passwords in [GnuPG](http://www.gnupg.org/) encrypted files.
5
7
 
6
- # Installation
8
+ ## Features
7
9
 
8
- This program work with ruby >= 2.0
10
+ * generate random password
11
+ * generate OTP code
12
+ * copy your login, password or otp in clipboard
13
+ * manage many wallets
14
+ * synchronize your passwords with SSH or FTP.
15
+ * share a wallet with others GPG keys
9
16
 
10
- * install ruby and rubygems on your computer
11
- * install xclip
12
- * gem install mpw
17
+ ## Install
13
18
 
14
- # How to use
19
+ On debian or ubuntu:
20
+ ```
21
+ apt install ruby ruby-dev xclip
22
+ gem install mpw
23
+ ```
24
+
25
+ ## How to use
26
+ ### First steps
27
+
28
+ Initialize your first wallet:
29
+ ```
30
+ mpw config --init user@host.com
31
+ ```
15
32
 
16
- * Show help
33
+ Add your first item:
17
34
  ```
18
- mpw --help
35
+ mpw add
19
36
  ```
20
37
 
21
- * Setup a new config file
38
+ And list your items:
22
39
  ```
23
- mpw --setup
24
- mpw --setup --config /path/conf/file.cfg
40
+ mpw list
41
+ ```
42
+ or search an item with
43
+ ```
44
+ mpw list --pattern Da
45
+ mpw list --group bank
25
46
  ```
26
47
 
27
- * Create and setup a new wallet
48
+ Output:
28
49
  ```
29
- mpw --setup-wallet --wallet new_wallet_name
30
- mpw --setup-wallet --wallet new_wallet_name --config /path/conf/file.cfg
50
+ Bank
51
+ ==============================================================================
52
+ ID | Host | User | Protocol | Port | OTP | Comment
53
+ ==============================================================================
54
+ 1 | bank.com | 1234456 | https | | X |
55
+
56
+ Linux
57
+ ==============================================================================
58
+ ID | Host | User | Protocol | Port | OTP | Comment
59
+ ==============================================================================
60
+ 2 | linuxfr.org | example | https | | | Da Linux French Site
61
+
31
62
  ```
32
63
 
33
- * Add a GPG key in wallet
64
+ Copy a password, login or OTP code:
34
65
  ```
35
- mpw --add --key root@localhost.local
36
- mpw --add --key root@localhost.local --config /path/conf/file.cfg
37
- mpw --add --key root@localhost.local --wallet wallet_name
38
- mpw --add --key root@localhost.local --config /path/conf/file.cfg --wallet wallet_name
66
+ mpw copy -p linuxfr
39
67
  ```
40
68
 
41
- * Add a new GPG key in wallet
69
+ Update an item:
42
70
  ```
43
- mpw --add --key root@localhost.local --file /path/gpg/file.pub
44
- mpw --add --key root@localhost.local --file /path/gpg/file.pub --config /path/conf/file.cfg
45
- mpw --add --key root@localhost.local --file /path/gpg/file.pub --wallet wallet_name
46
- mpw --add --key root@localhost.local --file /path/gpg/file.pub --config /path/conf/file.cfg --wallet wallet_name
71
+ mpw update -p linuxfr
47
72
  ```
48
73
 
49
- * Delete a GPG key in wallet
74
+ Delete an item:
50
75
  ```
51
- mpw --delete --key root@localhost.local
52
- mpw --delete --key root@localhost.local --wallet wallet_name
53
- mpw --delete --key root@localhost.local --wallet wallet_name --config /path/conf/file.cfg
76
+ mpw delete -p linuxfr
54
77
  ```
55
78
 
56
- * Add a new item in wallet
79
+ ### Manage wallets
80
+
81
+ List all available wallets:
57
82
  ```
58
- mpw --add
59
- mpw --add --config /path/conf/file.cfg
60
- mpw --add --wallet wallet_name
61
- mpw --add --config /path/conf/file.cfg --wallet wallet_name
83
+ mpw wallet --list
62
84
  ```
63
85
 
64
- * Update an item
86
+ Create an other wallet:
65
87
  ```
66
- mpw --update --id uniq_id
67
- mpw --update --id uniq_id --config /path/conf/file.cfg
68
- mpw --update --id uniq_id --wallet wallet_name
69
- mpw --update --id uniq_id --config /path/conf/file.cfg --wallet wallet_name
88
+ mpw config --wallet work --init user@host.com
70
89
  ```
71
90
 
72
- * Delete an item
91
+ List all GPG keys in wallet:
73
92
  ```
74
- mpw --delete --id uniq_id
75
- mpw --delete --id uniq_id --config /path/conf/file.cfg
76
- mpw --delete --id uniq_id --wallet wallet_name
77
- mpw --delete --id uniq_id --config /path/conf/file.cfg --wallet wallet_name
93
+ mpw wallet --list-keys [--wallet NAME]
78
94
  ```
79
95
 
80
- * Show an item
96
+ Share with an other GPG key:
81
97
  ```
82
- mpw --show 'string to search'
83
- mpw --show 'string to search' --config /path/conf/file.cfg
84
- mpw --show 'string to search' --wallet wallet_name
85
- mpw --show 'string to search' --config /path/conf/file.cfg --wallet wallet_name
86
- mpw --show 'string to search' --group group_name
87
- mpw --show 'string to search' --group group_name --config /path/conf/file.cfg
88
- mpw --show 'string to search' --group group_name --wallet wallet_name
89
- mpw --show 'string to search' --group group_name --config /path/conf/file.cfg --wallet wallet_name
98
+ mpw wallet --add-gpg-key test42@localhost.com
99
+ or
100
+ mpw wallet --add-gpg-key /path/to/file
90
101
  ```
91
102
 
92
- * Export data in YAML file
103
+ Remove a GPG key:
93
104
  ```
94
- mpw --export --file /path/file/to/export.yml
95
- mpw --export --file /path/file/to/export.yml --config /path/conf/file.cfg
96
- mpw --export --file /path/file/to/export.yml --wallet wallet_name
97
- mpw --export --file /path/file/to/export.yml --config /path/conf/file.cfg --wallet wallet_name
105
+ mpw wallet --delete-gpg-key test42@localhost.com
98
106
  ```
99
107
 
100
- * Import data from YAML file
108
+ Add synchronize:
101
109
  ```
102
- mpw --import --file /path/file/to/export.yml
103
- mpw --import --file /path/file/to/export.yml --config /path/conf/file.cfg
104
- mpw --import --file /path/file/to/export.yml --wallet wallet_name
105
- mpw --import --file /path/file/to/export.yml --config /path/conf/file.cfg --wallet wallet_name
110
+ mpw wallet --protocol ssh --host example.com --user test --path /remote/path --password
106
111
  ```
107
112
 
108
- Format file to import:
113
+ ### Export and import data
114
+
115
+ You can export your data in yaml file with your passwords in clear text:
109
116
  ```
117
+ mpw export --file export.yml
118
+ ```
119
+
120
+ Import data from an yaml file:
121
+ ```
122
+ mpw import --file import.yml
123
+ ```
124
+
125
+ Example yaml file for mpw:
126
+
127
+ ```
128
+ ---
110
129
  1:
111
- name: Website perso
112
- group: Perso
113
- host: localhost.local
114
- protocol: ftp
115
- user: test
116
- password: letoortue
117
- port: 21
118
- comment: Mysuper website
119
- 2:
120
- name: Linuxfr
121
- group: Pro
122
- host: Linuxfr.org
130
+ host: bank.com
131
+ user: 123456
132
+ group: Bank
133
+ password: secret
123
134
  protocol: https
124
- user: test
125
- password: coucou
126
135
  port:
136
+ otp_key: 1afg34
127
137
  comment:
138
+ 2:
139
+ host: linuxfr.org
140
+ user: example
141
+ group:
142
+ password: 'complex %- password'
143
+ protocol: https
144
+ port:
145
+ otp_key:
146
+ comment: Da Linux French Site
128
147
  ```
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.2.1
1
+ 4.0.0
data/bin/mpw CHANGED
@@ -18,13 +18,10 @@
18
18
 
19
19
  $: << File.expand_path('../../lib', __FILE__)
20
20
 
21
- require 'optparse'
22
21
  require 'locale'
23
22
  require 'set'
24
23
  require 'i18n'
25
- require 'mpw/mpw'
26
- require 'mpw/config'
27
- require 'mpw/cli'
24
+ require 'colorize'
28
25
 
29
26
  # --------------------------------------------------------- #
30
27
  # Set local
@@ -45,195 +42,28 @@ I18n.locale = lang.to_sym
45
42
  # Options
46
43
  # --------------------------------------------------------- #
47
44
 
48
- options_password = {}
49
- options = {}
50
- options[:force] = false
51
- options[:otp] = false
52
- options[:sync] = true
53
- options[:clipboard] = true
54
- options[:editor] = false
55
- options[:group] = nil
56
- options[:config] = nil
57
- options[:wallet] = nil
45
+ bin_dir = File.dirname(__FILE__)
46
+ command = "#{bin_dir}/mpw-#{ARGV[0]}"
47
+
48
+ if Dir.glob("#{bin_dir}/mpw-*").include?("#{command}")
49
+ begin
50
+ Kernel.load(command)
51
+ rescue OptionParser::ParseError => e
52
+ puts "#{I18n.t('display.error')}: #{e}".red
53
+ end
54
+ else
55
+ puts "#{I18n.t('option.usage')}: mpw COMMAND [options]\n\n"
56
+ puts 'Commands:'
57
+ puts " add #{I18n.t('command.add')}"
58
+ puts " config #{I18n.t('command.config')}"
59
+ puts " copy #{I18n.t('command.copy')}"
60
+ puts " delete #{I18n.t('command.delete')}"
61
+ puts " export #{I18n.t('command.export')}"
62
+ puts " genpwd #{I18n.t('command.genpwd')}"
63
+ puts " import #{I18n.t('command.import')}"
64
+ puts " list #{I18n.t('command.list')}"
65
+ puts " update #{I18n.t('command.update')}"
66
+ puts " wallet #{I18n.t('command.wallet')}"
58
67
 
59
- OptionParser.new do |opts|
60
- opts.banner = "#{I18n.t('option.usage')}: mpw [options]"
61
-
62
- opts.on('-a', '--add', I18n.t('option.add')) do
63
- options[:add] = true
64
- end
65
-
66
- opts.on('-A', '--show-all', I18n.t('option.show_all')) do
67
- options[:type] = nil
68
- options[:show] = ''
69
- end
70
-
71
- opts.on('-c', '--config CONFIG', I18n.t('option.config')) do |config|
72
- options[:config] = config
73
- end
74
-
75
- opts.on('-C', '--no-clipboard', I18n.t('option.clipboard')) do
76
- options[:clipboard] = false
77
- end
78
-
79
- opts.on('-d', '--delete', I18n.t('option.remove')) do
80
- options[:delete] = true
81
- end
82
-
83
- opts.on('-e', '--export', I18n.t('option.export')) do
84
- options[:export] = true
85
- end
86
-
87
- opts.on('-E', '--editor', I18n.t('option.editor')) do
88
- options[:editor] = true
89
- end
90
-
91
- opts.on('-f', '--file FILE', I18n.t('option.file')) do |file|
92
- options[:file] = file
93
- end
94
-
95
- opts.on('-F', '--force', I18n.t('option.force')) do
96
- options[:force] = true
97
- end
98
-
99
- opts.on('-g', '--group GROUP', I18n.t('option.group')) do |group|
100
- options[:group] = group
101
- end
102
-
103
- opts.on('-G', '--generate-password [LENGTH]', I18n.t('option.generate_password')) do |length|
104
- options_password[:length] = length
105
- end
106
-
107
- opts.on('-h', '--help', I18n.t('option.help')) do
108
- puts opts
109
- exit 0
110
- end
111
-
112
- opts.on('-i', '--id ID', I18n.t('option.id')) do |id|
113
- options[:id] = id
114
- end
115
-
116
- opts.on('-I', '--import', I18n.t('option.import')) do
117
- options[:import] = true
118
- end
119
-
120
- opts.on('-k', '--key KEY', I18n.t('option.key')) do |key|
121
- options[:key] = key
122
- end
123
-
124
- opts.on('-n', '--numeric', I18n.t('option.numeric')) do
125
- options_password[:numeric] = true
126
- end
127
-
128
- opts.on('-N', '--no-sync', I18n.t('option.no_sync')) do
129
- options[:sync] = false
130
- end
131
-
132
- opts.on('-O', '--otp', I18n.t('option.otp')) do
133
- options[:otp] = true
134
- end
135
-
136
- opts.on('-s', '--show [SEARCH]', I18n.t('option.show')) do |search|
137
- search.nil? ? (options[:show] = '') : (options[:show] = search)
138
- end
139
-
140
- opts.on('-S', '--setup', I18n.t('option.setup')) do
141
- options[:setup] = true
142
- end
143
-
144
- opts.on('-u', '--update', I18n.t('option.update')) do
145
- options[:update] = true
146
- end
147
-
148
- opts.on('-w', '--wallet WALLET', I18n.t('option.wallet')) do |wallet|
149
- options[:wallet] = wallet
150
- end
151
-
152
- opts.on('-W', '--setup-wallet', I18n.t('option.setup_wallet')) do
153
- options[:setup_wallet] = true
154
- end
155
-
156
- opts.on('-x', '--special-chars', I18n.t('option.special_chars')) do
157
- options_password[:special] = true
158
- end
159
-
160
- opts.on('-y', '--alpha', I18n.t('option.alpha')) do
161
- options_password[:alpha] = true
162
- end
163
- end.parse!
164
-
165
- # --------------------------------------------------------- #
166
- # Main
167
- # --------------------------------------------------------- #
168
-
169
- # Generate password
170
- if not options_password.empty?
171
- puts MPW::MPW::password(options_password)
172
- exit 0
173
- end
174
-
175
- begin
176
- config = MPW::Config.new(options[:config])
177
- cli = MPW::Cli.new(config, options[:clipboard], options[:sync], options[:otp])
178
-
179
- # Setup a new config
180
- if not options[:setup].nil?
181
- cli.setup(lang)
182
- exit 0
183
- end
184
-
185
- cli.setup(lang) if not config.is_valid?
186
- cli.setup_gpg_key if not config.check_gpg_key?
187
-
188
- cli.get_wallet(options[:wallet])
189
- cli.decrypt
190
-
191
- # Display the item's informations
192
- if not options[:show].nil?
193
- opts = {search: options[:show],
194
- group: options[:group],
195
- }
196
-
197
- cli.display(opts)
198
-
199
- # Remove an item
200
- elsif not options[:delete].nil? and not options[:id].nil?
201
- cli.delete(options[:id], options[:force])
202
-
203
- # Update an item
204
- elsif not options[:update].nil? and not options[:id].nil?
205
- cli.update(options[:id])
206
-
207
- # Add a new item
208
- elsif not options[:add].nil? and options[:key].nil?
209
- cli.add
210
-
211
- # Add a new public key in wallet
212
- elsif not options[:add].nil? and not options[:key].nil?
213
- cli.add_key(options[:key], options[:file])
214
-
215
- # Delete a public key in wallet
216
- elsif not options[:delete].nil? and not options[:key].nil?
217
- cli.delete_key(options[:key])
218
-
219
- # Export
220
- elsif not options[:export].nil? and not options[:file].nil?
221
- cli.export(options[:file])
222
-
223
- # Add a new item
224
- elsif not options[:import].nil? and not options[:file].nil?
225
- cli.import(options[:file])
226
-
227
- # Setup wallet config
228
- elsif not options[:setup_wallet].nil?
229
- cli.setup_wallet_config
230
-
231
- end
232
-
233
- cli = nil
234
-
235
- exit 0
236
-
237
- rescue SystemExit, Interrupt
238
68
  exit 3
239
69
  end
data/bin/mpw-add ADDED
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/ruby
2
+ # MPW is a software to crypt and manage your passwords
3
+ # Copyright (C) 2016 Adrien Waksberg <mpw@yae.im>
4
+ #
5
+ # This program is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU General Public License
7
+ # as published by the Free Software Foundation; either version 2
8
+ # of the License, or (at your option) any later version.
9
+ #
10
+ # This program is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with this program; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
+
19
+ require 'optparse'
20
+ require 'mpw/config'
21
+ require 'mpw/cli'
22
+
23
+ # --------------------------------------------------------- #
24
+ # Options
25
+ # --------------------------------------------------------- #
26
+
27
+ options = {}
28
+ options[:sync] = true
29
+
30
+ OptionParser.new do |opts|
31
+ opts.banner = "#{I18n.t('option.usage')}: mpw add [options]"
32
+
33
+ opts.on('-c', '--config PATH', I18n.t('option.config')) do |config|
34
+ options[:config] = config
35
+ end
36
+
37
+ opts.on('-h', '--help', I18n.t('option.help')) do
38
+ puts opts
39
+ exit 0
40
+ end
41
+
42
+ opts.on('-n', '--no-sync', I18n.t('option.no_sync')) do
43
+ options[:sync] = false
44
+ end
45
+
46
+ opts.on('-r', '--random', I18n.t('option.random_password')) do
47
+ options[:password] = true
48
+ end
49
+
50
+ opts.on('-w', '--wallet NAME', I18n.t('option.wallet')) do |wallet|
51
+ options[:wallet] = wallet
52
+ end
53
+ end.parse!
54
+
55
+ config = MPW::Config.new(options[:config])
56
+ cli = MPW::Cli.new(config, options[:sync])
57
+
58
+ cli.load_config
59
+ cli.get_wallet(options[:wallet])
60
+ cli.decrypt
61
+ cli.add(options[:password])