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 +4 -4
 - data/.gitignore +1 -0
 - data/.travis.yml +14 -0
 - data/CHANGELOG.md +56 -0
 - data/Gemfile +9 -9
 - data/README.md +99 -80
 - data/VERSION +1 -1
 - data/bin/mpw +23 -193
 - data/bin/mpw-add +61 -0
 - data/bin/mpw-config +108 -0
 - data/bin/mpw-copy +71 -0
 - data/bin/mpw-delete +66 -0
 - data/bin/mpw-export +70 -0
 - data/bin/mpw-genpwd +50 -0
 - data/bin/mpw-import +61 -0
 - data/bin/mpw-list +66 -0
 - data/bin/mpw-update +70 -0
 - data/bin/mpw-wallet +116 -0
 - data/i18n/en.yml +70 -32
 - data/i18n/fr.yml +70 -32
 - data/lib/mpw/cli.rb +333 -220
 - data/lib/mpw/config.rb +53 -40
 - data/lib/mpw/item.rb +13 -13
 - data/lib/mpw/mpw.rb +75 -98
 - data/mpw.gemspec +9 -9
 - data/templates/add_form.erb +9 -0
 - data/templates/update_form.erb +17 -0
 - data/test/files/fixtures.yml +0 -4
 - data/test/init.rb +19 -0
 - data/test/test_config.rb +64 -0
 - data/test/test_item.rb +42 -88
 - data/test/test_mpw.rb +88 -139
 - data/test/test_translate.rb +31 -0
 - data/test/tests.rb +4 -1
 - metadata +96 -27
 - data/CHANGELOG +0 -13
 - data/test/files/test_import.csv +0 -3
 - data/test/files/test_import.yml +0 -23
 
    
        data/bin/mpw-config
    ADDED
    
    | 
         @@ -0,0 +1,108 @@ 
     | 
|
| 
      
 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 
     | 
    
         
            +
            values  = {}
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            OptionParser.new do |opts|
         
     | 
| 
      
 31 
     | 
    
         
            +
            	opts.banner = "#{I18n.t('option.usage')}: mpw config [options]"
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            	opts.on('-c', '--config PATH', I18n.t('option.config')) do |config|
         
     | 
| 
      
 34 
     | 
    
         
            +
            		options[:config] = config
         
     | 
| 
      
 35 
     | 
    
         
            +
            	end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            	opts.on('-d', '--default-wallet NAME', I18n.t('option.default_wallet')) do |default_wallet|
         
     | 
| 
      
 38 
     | 
    
         
            +
            		values[:default_wallet] = default_wallet
         
     | 
| 
      
 39 
     | 
    
         
            +
            	end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            	opts.on('-g', '--gpg-exe PATH', I18n.t('option.gpg_exe')) do |gpg_exe|
         
     | 
| 
      
 42 
     | 
    
         
            +
            		values[:gpg_exe] = gpg_exe
         
     | 
| 
      
 43 
     | 
    
         
            +
            	end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
            	opts.on('-h', '--help', I18n.t('option.help')) do
         
     | 
| 
      
 46 
     | 
    
         
            +
            		puts opts
         
     | 
| 
      
 47 
     | 
    
         
            +
            		exit 0
         
     | 
| 
      
 48 
     | 
    
         
            +
            	end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            	opts.on('-i', '--init GPG_KEY', I18n.t('option.init')) do |gpg_key|
         
     | 
| 
      
 51 
     | 
    
         
            +
            		options[:init]   = true
         
     | 
| 
      
 52 
     | 
    
         
            +
            		values[:gpg_key] = gpg_key
         
     | 
| 
      
 53 
     | 
    
         
            +
            	end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
            	opts.on('-k', '--key GPG_KEY', I18n.t('option.gpg_key')) do |gpg_key|
         
     | 
| 
      
 56 
     | 
    
         
            +
            		values[:gpg_key] = gpg_key
         
     | 
| 
      
 57 
     | 
    
         
            +
            	end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
            	opts.on('-L', '--lang LANG', I18n.t('option.lang')) do |lang|
         
     | 
| 
      
 60 
     | 
    
         
            +
            		values[:lang] = lang
         
     | 
| 
      
 61 
     | 
    
         
            +
            	end
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
            	opts.on('-w', '--wallet-dir PATH', I18n.t('option.wallet_dir')) do |wallet_dir|
         
     | 
| 
      
 64 
     | 
    
         
            +
            		values[:wallet_dir] = wallet_dir
         
     | 
| 
      
 65 
     | 
    
         
            +
            	end
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
            	opts.on('-l', '--length NUMBER', I18n.t('option.length')) do |length|
         
     | 
| 
      
 68 
     | 
    
         
            +
            		values[:pwd_length] = length.to_i
         
     | 
| 
      
 69 
     | 
    
         
            +
            	end
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
            	opts.on('-n', '--numeric', I18n.t('option.numeric')) do
         
     | 
| 
      
 72 
     | 
    
         
            +
            		values[:pwd_numeric] = true
         
     | 
| 
      
 73 
     | 
    
         
            +
            	end
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
            	opts.on('-N', '--disable-numeric', I18n.t('option.disable_numeric')) do
         
     | 
| 
      
 76 
     | 
    
         
            +
            		values[:pwd_numeric] = false
         
     | 
| 
      
 77 
     | 
    
         
            +
            	end
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
            	opts.on('-s', '--special-chars', I18n.t('option.special_chars')) do
         
     | 
| 
      
 80 
     | 
    
         
            +
            		values[:pwd_special] = true
         
     | 
| 
      
 81 
     | 
    
         
            +
            	end
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
            	opts.on('-S', '--disable_special-chars', I18n.t('option.special_chars')) do
         
     | 
| 
      
 84 
     | 
    
         
            +
            		values[:pwd_special] = false
         
     | 
| 
      
 85 
     | 
    
         
            +
            	end
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
            	opts.on('-a', '--alpha', I18n.t('option.alpha')) do
         
     | 
| 
      
 88 
     | 
    
         
            +
            		values[:pwd_alpha] = true
         
     | 
| 
      
 89 
     | 
    
         
            +
            	end
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
            	opts.on('-A', '--disable-alpha', I18n.t('option.disable_alpha')) do
         
     | 
| 
      
 92 
     | 
    
         
            +
            		values[:pwd_alpha] = false
         
     | 
| 
      
 93 
     | 
    
         
            +
            	end
         
     | 
| 
      
 94 
     | 
    
         
            +
            end.parse!
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
            config = MPW::Config.new(options[:config])
         
     | 
| 
      
 97 
     | 
    
         
            +
            cli    = MPW::Cli.new(config, nil)
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
            if options.has_key?(:init)
         
     | 
| 
      
 100 
     | 
    
         
            +
            	cli.setup(values)
         
     | 
| 
      
 101 
     | 
    
         
            +
            	cli.load_config
         
     | 
| 
      
 102 
     | 
    
         
            +
            	cli.get_wallet
         
     | 
| 
      
 103 
     | 
    
         
            +
            	cli.setup_gpg_key(values[:gpg_key])
         
     | 
| 
      
 104 
     | 
    
         
            +
            	cli.setup_wallet_config
         
     | 
| 
      
 105 
     | 
    
         
            +
            else
         
     | 
| 
      
 106 
     | 
    
         
            +
            	cli.load_config
         
     | 
| 
      
 107 
     | 
    
         
            +
            	cli.set_config(values)
         
     | 
| 
      
 108 
     | 
    
         
            +
            end
         
     | 
    
        data/bin/mpw-copy
    ADDED
    
    | 
         @@ -0,0 +1,71 @@ 
     | 
|
| 
      
 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 
     | 
    
         
            +
            options[:clipboard] = true
         
     | 
| 
      
 30 
     | 
    
         
            +
            values              = {}
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            OptionParser.new do |opts|
         
     | 
| 
      
 33 
     | 
    
         
            +
            	opts.banner = "#{I18n.t('option.usage')}: mpw copy [options]"
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            	opts.on('-c', '--config PATH', I18n.t('option.config')) do |config|
         
     | 
| 
      
 36 
     | 
    
         
            +
            		options[:config] = config
         
     | 
| 
      
 37 
     | 
    
         
            +
            	end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            	opts.on('-d', '--disable-clipboard', I18n.t('option.clipboard')) do
         
     | 
| 
      
 40 
     | 
    
         
            +
            		options[:clipboard] = false
         
     | 
| 
      
 41 
     | 
    
         
            +
            	end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
            	opts.on('-g', '--group NAME', I18n.t('option.group')) do |group|
         
     | 
| 
      
 44 
     | 
    
         
            +
            		values[:group] = group
         
     | 
| 
      
 45 
     | 
    
         
            +
            	end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
            	opts.on('-h', '--help', I18n.t('option.help')) do
         
     | 
| 
      
 48 
     | 
    
         
            +
            		puts opts
         
     | 
| 
      
 49 
     | 
    
         
            +
            		exit 0
         
     | 
| 
      
 50 
     | 
    
         
            +
            	end
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            	opts.on('-n', '--no-sync', I18n.t('option.no_sync')) do
         
     | 
| 
      
 53 
     | 
    
         
            +
            		options[:sync] = false
         
     | 
| 
      
 54 
     | 
    
         
            +
            	end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
            	opts.on('-p', '--pattern PATTERN', I18n.t('option.pattern')) do |pattern|
         
     | 
| 
      
 57 
     | 
    
         
            +
            		values[:pattern] = pattern
         
     | 
| 
      
 58 
     | 
    
         
            +
            	end
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
            	opts.on('-w', '--wallet NAME', I18n.t('option.wallet')) do |wallet|
         
     | 
| 
      
 61 
     | 
    
         
            +
            		options[:wallet] = wallet
         
     | 
| 
      
 62 
     | 
    
         
            +
            	end
         
     | 
| 
      
 63 
     | 
    
         
            +
            end.parse!
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
            config = MPW::Config.new(options[:config])
         
     | 
| 
      
 66 
     | 
    
         
            +
            cli    = MPW::Cli.new(config, options[:sync])
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
            cli.load_config
         
     | 
| 
      
 69 
     | 
    
         
            +
            cli.get_wallet(options[:wallet])
         
     | 
| 
      
 70 
     | 
    
         
            +
            cli.decrypt
         
     | 
| 
      
 71 
     | 
    
         
            +
            cli.copy(options[:clipboard], values)
         
     | 
    
        data/bin/mpw-delete
    ADDED
    
    | 
         @@ -0,0 +1,66 @@ 
     | 
|
| 
      
 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 
     | 
    
         
            +
            values         = {}
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            OptionParser.new do |opts|
         
     | 
| 
      
 32 
     | 
    
         
            +
            	opts.banner = "#{I18n.t('option.usage')}: mpw delete [options]"
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            	opts.on('-c', '--config PATH', I18n.t('option.config')) do |config|
         
     | 
| 
      
 35 
     | 
    
         
            +
            		options[:config] = config
         
     | 
| 
      
 36 
     | 
    
         
            +
            	end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            	opts.on('-g', '--group NAME', I18n.t('option.group')) do |group|
         
     | 
| 
      
 39 
     | 
    
         
            +
            		values[:group] = group
         
     | 
| 
      
 40 
     | 
    
         
            +
            	end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            	opts.on('-h', '--help', I18n.t('option.help')) do
         
     | 
| 
      
 43 
     | 
    
         
            +
            		puts opts
         
     | 
| 
      
 44 
     | 
    
         
            +
            		exit 0
         
     | 
| 
      
 45 
     | 
    
         
            +
            	end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
            	opts.on('-n', '--no-sync', I18n.t('option.no_sync')) do
         
     | 
| 
      
 48 
     | 
    
         
            +
            		options[:sync] = false
         
     | 
| 
      
 49 
     | 
    
         
            +
            	end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            	opts.on('-p', '--pattern PATTERN', I18n.t('option.pattern')) do |pattern|
         
     | 
| 
      
 52 
     | 
    
         
            +
            		values[:pattern] = pattern
         
     | 
| 
      
 53 
     | 
    
         
            +
            	end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
            	opts.on('-w', '--wallet NAME', I18n.t('option.wallet')) do |wallet|
         
     | 
| 
      
 56 
     | 
    
         
            +
            		options[:wallet] = wallet
         
     | 
| 
      
 57 
     | 
    
         
            +
            	end
         
     | 
| 
      
 58 
     | 
    
         
            +
            end.parse!
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
            config = MPW::Config.new(options[:config])
         
     | 
| 
      
 61 
     | 
    
         
            +
            cli    = MPW::Cli.new(config, options[:sync])
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
            cli.load_config
         
     | 
| 
      
 64 
     | 
    
         
            +
            cli.get_wallet(options[:wallet])
         
     | 
| 
      
 65 
     | 
    
         
            +
            cli.decrypt
         
     | 
| 
      
 66 
     | 
    
         
            +
            cli.delete(values)
         
     | 
    
        data/bin/mpw-export
    ADDED
    
    | 
         @@ -0,0 +1,70 @@ 
     | 
|
| 
      
 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 
     | 
    
         
            +
            values         = {}
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            OptionParser.new do |opts|
         
     | 
| 
      
 32 
     | 
    
         
            +
            	opts.banner = "#{I18n.t('option.usage')}: mpw wallet [options]"
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            	opts.on('-c', '--config PATH', I18n.t('option.config')) do |config|
         
     | 
| 
      
 35 
     | 
    
         
            +
            		options[:config] = config
         
     | 
| 
      
 36 
     | 
    
         
            +
            	end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            	opts.on('-f', '--file PATH', I18n.t('option.file_export')) do |file|
         
     | 
| 
      
 39 
     | 
    
         
            +
            		options[:file] = file
         
     | 
| 
      
 40 
     | 
    
         
            +
            	end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            	opts.on('-g', '--group GROUP', I18n.t('option.group')) do |group|
         
     | 
| 
      
 43 
     | 
    
         
            +
            		values[:group] = group
         
     | 
| 
      
 44 
     | 
    
         
            +
            	end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            	opts.on('-h', '--help', I18n.t('option.help')) do
         
     | 
| 
      
 47 
     | 
    
         
            +
            		puts opts
         
     | 
| 
      
 48 
     | 
    
         
            +
            		exit 0
         
     | 
| 
      
 49 
     | 
    
         
            +
            	end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            	opts.on('-n', '--no-sync', I18n.t('option.no_sync')) do
         
     | 
| 
      
 52 
     | 
    
         
            +
            		options[:sync] = false
         
     | 
| 
      
 53 
     | 
    
         
            +
            	end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
            	opts.on('-p', '--pattern PATTERN', I18n.t('option.pattern')) do |pattern|
         
     | 
| 
      
 56 
     | 
    
         
            +
            		values[:pattern] = pattern
         
     | 
| 
      
 57 
     | 
    
         
            +
            	end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
            	opts.on('-w', '--wallet NAME', I18n.t('option.wallet')) do |wallet|
         
     | 
| 
      
 60 
     | 
    
         
            +
            		options[:wallet] = wallet
         
     | 
| 
      
 61 
     | 
    
         
            +
            	end
         
     | 
| 
      
 62 
     | 
    
         
            +
            end.parse!
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
            config = MPW::Config.new(options[:config])
         
     | 
| 
      
 65 
     | 
    
         
            +
            cli    = MPW::Cli.new(config, options[:sync])
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
            cli.load_config
         
     | 
| 
      
 68 
     | 
    
         
            +
            cli.get_wallet(options[:wallet])
         
     | 
| 
      
 69 
     | 
    
         
            +
            cli.decrypt
         
     | 
| 
      
 70 
     | 
    
         
            +
            cli.export(options[:file], values)
         
     | 
    
        data/bin/mpw-genpwd
    ADDED
    
    | 
         @@ -0,0 +1,50 @@ 
     | 
|
| 
      
 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/mpw'
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            options = {}
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            OptionParser.new do |opts|
         
     | 
| 
      
 25 
     | 
    
         
            +
            	opts.banner = "#{I18n.t('option.usage')}: mpw passwd [options]"
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            	opts.on('-h', '--help', I18n.t('option.help')) do
         
     | 
| 
      
 28 
     | 
    
         
            +
            		puts opts
         
     | 
| 
      
 29 
     | 
    
         
            +
            		exit 0
         
     | 
| 
      
 30 
     | 
    
         
            +
            	end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            	opts.on('-l', '--length NUMBER', I18n.t('option.length')) do |length|
         
     | 
| 
      
 33 
     | 
    
         
            +
            		options[:length] = length.to_i
         
     | 
| 
      
 34 
     | 
    
         
            +
            	end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            	opts.on('-n', '--numeric', I18n.t('option.numeric')) do
         
     | 
| 
      
 37 
     | 
    
         
            +
            		options[:numeric] = true
         
     | 
| 
      
 38 
     | 
    
         
            +
            	end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
            	opts.on('-s', '--special-chars', I18n.t('option.special_chars')) do
         
     | 
| 
      
 41 
     | 
    
         
            +
            		options[:special] = true
         
     | 
| 
      
 42 
     | 
    
         
            +
            	end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            	opts.on('-a', '--alpha', I18n.t('option.alpha')) do
         
     | 
| 
      
 45 
     | 
    
         
            +
            		options[:alpha] = true
         
     | 
| 
      
 46 
     | 
    
         
            +
            	end
         
     | 
| 
      
 47 
     | 
    
         
            +
            end.parse!
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
            puts MPW::MPW::password(options)
         
     | 
| 
      
 50 
     | 
    
         
            +
            exit 0
         
     | 
    
        data/bin/mpw-import
    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 import [options]"
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            	opts.on('-c', '--config PATH', I18n.t('option.config')) do |config|
         
     | 
| 
      
 34 
     | 
    
         
            +
            		options[:config] = config
         
     | 
| 
      
 35 
     | 
    
         
            +
            	end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            	opts.on('-f', '--file PATH', I18n.t('option.file_import')) do |file|
         
     | 
| 
      
 38 
     | 
    
         
            +
            		options[:file] = file
         
     | 
| 
      
 39 
     | 
    
         
            +
            	end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            	opts.on('-h', '--help', I18n.t('option.help')) do
         
     | 
| 
      
 42 
     | 
    
         
            +
            		puts opts
         
     | 
| 
      
 43 
     | 
    
         
            +
            		exit 0
         
     | 
| 
      
 44 
     | 
    
         
            +
            	end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            	opts.on('-n', '--no-sync', I18n.t('option.no_sync')) do
         
     | 
| 
      
 47 
     | 
    
         
            +
            		options[:sync] = false
         
     | 
| 
      
 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.import(options[:file])
         
     | 
    
        data/bin/mpw-list
    ADDED
    
    | 
         @@ -0,0 +1,66 @@ 
     | 
|
| 
      
 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 
     | 
    
         
            +
            values         = {}
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            OptionParser.new do |opts|
         
     | 
| 
      
 32 
     | 
    
         
            +
            	opts.banner = "#{I18n.t('option.usage')}: mpw list [options]"
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            	opts.on('-c', '--config PATH', I18n.t('option.config')) do |config|
         
     | 
| 
      
 35 
     | 
    
         
            +
            		options[:config] = config
         
     | 
| 
      
 36 
     | 
    
         
            +
            	end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            	opts.on('-g', '--group NAME', I18n.t('option.group')) do |group|
         
     | 
| 
      
 39 
     | 
    
         
            +
            		values[:group] = group
         
     | 
| 
      
 40 
     | 
    
         
            +
            	end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            	opts.on('-h', '--help', I18n.t('option.help')) do
         
     | 
| 
      
 43 
     | 
    
         
            +
            		puts opts
         
     | 
| 
      
 44 
     | 
    
         
            +
            		exit 0
         
     | 
| 
      
 45 
     | 
    
         
            +
            	end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
            	opts.on('-p', '--pattern PATTERN', I18n.t('option.pattern')) do |pattern|
         
     | 
| 
      
 48 
     | 
    
         
            +
            		values[:pattern] = pattern
         
     | 
| 
      
 49 
     | 
    
         
            +
            	end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            	opts.on('-n', '--no-sync', I18n.t('option.no_sync')) do
         
     | 
| 
      
 52 
     | 
    
         
            +
            		options[:sync] = false
         
     | 
| 
      
 53 
     | 
    
         
            +
            	end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
            	opts.on('-w', '--wallet NAME', I18n.t('option.wallet')) do |wallet|
         
     | 
| 
      
 56 
     | 
    
         
            +
            		options[:wallet] = wallet
         
     | 
| 
      
 57 
     | 
    
         
            +
            	end
         
     | 
| 
      
 58 
     | 
    
         
            +
            end.parse!
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
            config = MPW::Config.new(options[:config])
         
     | 
| 
      
 61 
     | 
    
         
            +
            cli    = MPW::Cli.new(config, options[:sync])
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
            cli.load_config
         
     | 
| 
      
 64 
     | 
    
         
            +
            cli.get_wallet(options[:wallet])
         
     | 
| 
      
 65 
     | 
    
         
            +
            cli.decrypt
         
     | 
| 
      
 66 
     | 
    
         
            +
            cli.list(values)
         
     | 
    
        data/bin/mpw-update
    ADDED
    
    | 
         @@ -0,0 +1,70 @@ 
     | 
|
| 
      
 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 
     | 
    
         
            +
            values         = {}
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            OptionParser.new do |opts|
         
     | 
| 
      
 32 
     | 
    
         
            +
            	opts.banner = "#{I18n.t('option.usage')}: mpw update [options]"
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            	opts.on('-c', '--config PATH', I18n.t('option.config')) do |config|
         
     | 
| 
      
 35 
     | 
    
         
            +
            		options[:config] = config
         
     | 
| 
      
 36 
     | 
    
         
            +
            	end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            	opts.on('-g', '--group NAME', I18n.t('option.group')) do |group|
         
     | 
| 
      
 39 
     | 
    
         
            +
            		values[:group] = group
         
     | 
| 
      
 40 
     | 
    
         
            +
            	end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            	opts.on('-h', '--help', I18n.t('option.help')) do
         
     | 
| 
      
 43 
     | 
    
         
            +
            		puts opts
         
     | 
| 
      
 44 
     | 
    
         
            +
            		exit 0
         
     | 
| 
      
 45 
     | 
    
         
            +
            	end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
            	opts.on('-n', '--no-sync', I18n.t('option.no_sync')) do
         
     | 
| 
      
 48 
     | 
    
         
            +
            		options[:sync] = false
         
     | 
| 
      
 49 
     | 
    
         
            +
            	end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            	opts.on('-p', '--pattern PATTERN', I18n.t('option.pattern')) do |pattern|
         
     | 
| 
      
 52 
     | 
    
         
            +
            		values[:pattern] = pattern
         
     | 
| 
      
 53 
     | 
    
         
            +
            	end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
            	opts.on('-r', '--random', I18n.t('option.random_password')) do
         
     | 
| 
      
 56 
     | 
    
         
            +
            		options[:password] = true
         
     | 
| 
      
 57 
     | 
    
         
            +
            	end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
            	opts.on('-w', '--wallet NAME', I18n.t('option.wallet')) do |wallet|
         
     | 
| 
      
 60 
     | 
    
         
            +
            		options[:wallet] = wallet
         
     | 
| 
      
 61 
     | 
    
         
            +
            	end
         
     | 
| 
      
 62 
     | 
    
         
            +
            end.parse!
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
            config = MPW::Config.new(options[:config])
         
     | 
| 
      
 65 
     | 
    
         
            +
            cli    = MPW::Cli.new(config, options[:sync])
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
            cli.load_config
         
     | 
| 
      
 68 
     | 
    
         
            +
            cli.get_wallet(options[:wallet])
         
     | 
| 
      
 69 
     | 
    
         
            +
            cli.decrypt
         
     | 
| 
      
 70 
     | 
    
         
            +
            cli.update(options[:password], values)
         
     | 
    
        data/bin/mpw-wallet
    ADDED
    
    | 
         @@ -0,0 +1,116 @@ 
     | 
|
| 
      
 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]   = {}
         
     | 
| 
      
 29 
     | 
    
         
            +
            options[:delete] = false
         
     | 
| 
      
 30 
     | 
    
         
            +
            values           = {}
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            OptionParser.new do |opts|
         
     | 
| 
      
 33 
     | 
    
         
            +
            	opts.banner = "#{I18n.t('option.usage')}: mpw wallet [options]"
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            	opts.on('-a', '--add-gpg-key NAME', I18n.t('option.add_gpg_key')) do |gpg_key|
         
     | 
| 
      
 36 
     | 
    
         
            +
            		options[:gpg_key] = gpg_key
         
     | 
| 
      
 37 
     | 
    
         
            +
            	end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            	opts.on('-c', '--config PATH', I18n.t('option.config')) do |config|
         
     | 
| 
      
 40 
     | 
    
         
            +
            		options[:config] = config
         
     | 
| 
      
 41 
     | 
    
         
            +
            	end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
            	opts.on('-d', '--delete-gpg-key NAME', I18n.t('option.delete_gpg_key')) do |gpg_key|
         
     | 
| 
      
 44 
     | 
    
         
            +
            		options[:gpg_key] = gpg_key
         
     | 
| 
      
 45 
     | 
    
         
            +
            		options[:delete]  = true
         
     | 
| 
      
 46 
     | 
    
         
            +
            	end
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            	opts.on('-h', '--help', I18n.t('option.help')) do
         
     | 
| 
      
 49 
     | 
    
         
            +
            		puts opts
         
     | 
| 
      
 50 
     | 
    
         
            +
            		exit 0
         
     | 
| 
      
 51 
     | 
    
         
            +
            	end
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
            	opts.on('--host NAME', I18n.t('option.host')) do |host|
         
     | 
| 
      
 54 
     | 
    
         
            +
            		values[:host] = host
         
     | 
| 
      
 55 
     | 
    
         
            +
            	end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
            	opts.on('-l', '--list', I18n.t('option.list')) do
         
     | 
| 
      
 58 
     | 
    
         
            +
            		options[:list] = true
         
     | 
| 
      
 59 
     | 
    
         
            +
            	end
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
            	opts.on('-L', '--list-keys', I18n.t('option.list_keys')) do
         
     | 
| 
      
 62 
     | 
    
         
            +
            		options[:list_keys] = true
         
     | 
| 
      
 63 
     | 
    
         
            +
            	end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
            	opts.on('-n', '--no-sync', I18n.t('option.no_sync')) do
         
     | 
| 
      
 66 
     | 
    
         
            +
            		options[:sync] = false
         
     | 
| 
      
 67 
     | 
    
         
            +
            	end
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
            	opts.on('--password', I18n.t('option.password')) do
         
     | 
| 
      
 70 
     | 
    
         
            +
            		values[:password] = true
         
     | 
| 
      
 71 
     | 
    
         
            +
            	end
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
            	opts.on('--path PATH', I18n.t('option.path')) do |path|
         
     | 
| 
      
 74 
     | 
    
         
            +
            		values[:path] = path
         
     | 
| 
      
 75 
     | 
    
         
            +
            	end
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
            	opts.on('--port NUMBER', I18n.t('option.port')) do |port|
         
     | 
| 
      
 78 
     | 
    
         
            +
            		values[:port] = port
         
     | 
| 
      
 79 
     | 
    
         
            +
            	end
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
            	opts.on('--protocol NAME', I18n.t('option.protocol')) do |protocol|
         
     | 
| 
      
 82 
     | 
    
         
            +
            		values[:protocol] = protocol
         
     | 
| 
      
 83 
     | 
    
         
            +
            	end
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
            	opts.on('--user NAME', I18n.t('option.user')) do |user|
         
     | 
| 
      
 86 
     | 
    
         
            +
            		values[:user] = user
         
     | 
| 
      
 87 
     | 
    
         
            +
            	end
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
            	opts.on('-w', '--wallet NAME', I18n.t('option.wallet')) do |wallet|
         
     | 
| 
      
 90 
     | 
    
         
            +
            		options[:wallet] = wallet
         
     | 
| 
      
 91 
     | 
    
         
            +
            	end
         
     | 
| 
      
 92 
     | 
    
         
            +
            end.parse!
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
            config = MPW::Config.new(options[:config])
         
     | 
| 
      
 95 
     | 
    
         
            +
            cli    = MPW::Cli.new(config, options[:sync])
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
            cli.load_config
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
            if not options[:list].nil?
         
     | 
| 
      
 100 
     | 
    
         
            +
            	cli.list_wallet
         
     | 
| 
      
 101 
     | 
    
         
            +
            else
         
     | 
| 
      
 102 
     | 
    
         
            +
            	cli.get_wallet(options[:wallet])
         
     | 
| 
      
 103 
     | 
    
         
            +
            	cli.decrypt
         
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
      
 105 
     | 
    
         
            +
            	if not options[:list_keys].nil?
         
     | 
| 
      
 106 
     | 
    
         
            +
            		cli.list_keys
         
     | 
| 
      
 107 
     | 
    
         
            +
            	elsif not options[:gpg_key].nil?
         
     | 
| 
      
 108 
     | 
    
         
            +
            		if options[:delete]
         
     | 
| 
      
 109 
     | 
    
         
            +
            			cli.delete_key(options[:gpg_key])
         
     | 
| 
      
 110 
     | 
    
         
            +
            		else
         
     | 
| 
      
 111 
     | 
    
         
            +
            			cli.add_key(options[:gpg_key])
         
     | 
| 
      
 112 
     | 
    
         
            +
            		end
         
     | 
| 
      
 113 
     | 
    
         
            +
            	elsif not values.empty?
         
     | 
| 
      
 114 
     | 
    
         
            +
            		cli.setup_wallet_config(values)
         
     | 
| 
      
 115 
     | 
    
         
            +
            	end
         
     | 
| 
      
 116 
     | 
    
         
            +
            end
         
     |