mirror of
https://github.com/nishiki/manage-password.git
synced 2024-11-26 23:33:03 +00:00
remove all sync
This commit is contained in:
parent
2e6d111b69
commit
871b1dcbed
16 changed files with 20 additions and 421 deletions
|
@ -11,7 +11,6 @@ mpw is a little software which stores your passwords in [GnuPG](http://www.gnupg
|
||||||
* generate OTP code
|
* generate OTP code
|
||||||
* copy your login, password or otp in clipboard
|
* copy your login, password or otp in clipboard
|
||||||
* manage many wallets
|
* manage many wallets
|
||||||
* synchronize your passwords with SSH or FTP.
|
|
||||||
* share a wallet with others GPG keys
|
* share a wallet with others GPG keys
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
@ -105,11 +104,6 @@ Remove a GPG key:
|
||||||
mpw wallet --delete-gpg-key test42@localhost.com
|
mpw wallet --delete-gpg-key test42@localhost.com
|
||||||
```
|
```
|
||||||
|
|
||||||
Add synchronize:
|
|
||||||
```
|
|
||||||
mpw wallet --protocol ssh --host example.com --user test --path /remote/path --password
|
|
||||||
```
|
|
||||||
|
|
||||||
### Export and import data
|
### Export and import data
|
||||||
|
|
||||||
You can export your data in yaml file with your passwords in clear text:
|
You can export your data in yaml file with your passwords in clear text:
|
||||||
|
|
|
@ -25,7 +25,6 @@ require 'mpw/cli'
|
||||||
# --------------------------------------------------------- #
|
# --------------------------------------------------------- #
|
||||||
|
|
||||||
options = {}
|
options = {}
|
||||||
options[:sync] = true
|
|
||||||
|
|
||||||
OptionParser.new do |opts|
|
OptionParser.new do |opts|
|
||||||
opts.banner = "#{I18n.t('option.usage')}: mpw add [options]"
|
opts.banner = "#{I18n.t('option.usage')}: mpw add [options]"
|
||||||
|
@ -39,10 +38,6 @@ OptionParser.new do |opts|
|
||||||
exit 0
|
exit 0
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('-n', '--no-sync', I18n.t('option.no_sync')) do
|
|
||||||
options[:sync] = false
|
|
||||||
end
|
|
||||||
|
|
||||||
opts.on('-r', '--random', I18n.t('option.random_password')) do
|
opts.on('-r', '--random', I18n.t('option.random_password')) do
|
||||||
options[:password] = true
|
options[:password] = true
|
||||||
end
|
end
|
||||||
|
@ -53,7 +48,7 @@ OptionParser.new do |opts|
|
||||||
end.parse!
|
end.parse!
|
||||||
|
|
||||||
config = MPW::Config.new(options[:config])
|
config = MPW::Config.new(options[:config])
|
||||||
cli = MPW::Cli.new(config, options[:sync])
|
cli = MPW::Cli.new(config)
|
||||||
|
|
||||||
cli.load_config
|
cli.load_config
|
||||||
cli.get_wallet(options[:wallet])
|
cli.get_wallet(options[:wallet])
|
||||||
|
|
|
@ -25,7 +25,6 @@ require 'mpw/cli'
|
||||||
# --------------------------------------------------------- #
|
# --------------------------------------------------------- #
|
||||||
|
|
||||||
options = {}
|
options = {}
|
||||||
options[:sync] = true
|
|
||||||
options[:clipboard] = true
|
options[:clipboard] = true
|
||||||
values = {}
|
values = {}
|
||||||
|
|
||||||
|
@ -49,10 +48,6 @@ OptionParser.new do |opts|
|
||||||
exit 0
|
exit 0
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('-n', '--no-sync', I18n.t('option.no_sync')) do
|
|
||||||
options[:sync] = false
|
|
||||||
end
|
|
||||||
|
|
||||||
opts.on('-p', '--pattern PATTERN', I18n.t('option.pattern')) do |pattern|
|
opts.on('-p', '--pattern PATTERN', I18n.t('option.pattern')) do |pattern|
|
||||||
values[:pattern] = pattern
|
values[:pattern] = pattern
|
||||||
end
|
end
|
||||||
|
@ -63,7 +58,7 @@ OptionParser.new do |opts|
|
||||||
end.parse!
|
end.parse!
|
||||||
|
|
||||||
config = MPW::Config.new(options[:config])
|
config = MPW::Config.new(options[:config])
|
||||||
cli = MPW::Cli.new(config, options[:sync])
|
cli = MPW::Cli.new(config)
|
||||||
|
|
||||||
cli.load_config
|
cli.load_config
|
||||||
cli.get_wallet(options[:wallet])
|
cli.get_wallet(options[:wallet])
|
||||||
|
|
|
@ -25,7 +25,6 @@ require 'mpw/cli'
|
||||||
# --------------------------------------------------------- #
|
# --------------------------------------------------------- #
|
||||||
|
|
||||||
options = {}
|
options = {}
|
||||||
options[:sync] = true
|
|
||||||
values = {}
|
values = {}
|
||||||
|
|
||||||
OptionParser.new do |opts|
|
OptionParser.new do |opts|
|
||||||
|
@ -44,10 +43,6 @@ OptionParser.new do |opts|
|
||||||
exit 0
|
exit 0
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('-n', '--no-sync', I18n.t('option.no_sync')) do
|
|
||||||
options[:sync] = false
|
|
||||||
end
|
|
||||||
|
|
||||||
opts.on('-p', '--pattern PATTERN', I18n.t('option.pattern')) do |pattern|
|
opts.on('-p', '--pattern PATTERN', I18n.t('option.pattern')) do |pattern|
|
||||||
values[:pattern] = pattern
|
values[:pattern] = pattern
|
||||||
end
|
end
|
||||||
|
@ -58,7 +53,7 @@ OptionParser.new do |opts|
|
||||||
end.parse!
|
end.parse!
|
||||||
|
|
||||||
config = MPW::Config.new(options[:config])
|
config = MPW::Config.new(options[:config])
|
||||||
cli = MPW::Cli.new(config, options[:sync])
|
cli = MPW::Cli.new(config)
|
||||||
|
|
||||||
cli.load_config
|
cli.load_config
|
||||||
cli.get_wallet(options[:wallet])
|
cli.get_wallet(options[:wallet])
|
||||||
|
|
|
@ -25,7 +25,6 @@ require 'mpw/cli'
|
||||||
# --------------------------------------------------------- #
|
# --------------------------------------------------------- #
|
||||||
|
|
||||||
options = {}
|
options = {}
|
||||||
options[:sync] = true
|
|
||||||
values = {}
|
values = {}
|
||||||
|
|
||||||
OptionParser.new do |opts|
|
OptionParser.new do |opts|
|
||||||
|
@ -48,10 +47,6 @@ OptionParser.new do |opts|
|
||||||
exit 0
|
exit 0
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('-n', '--no-sync', I18n.t('option.no_sync')) do
|
|
||||||
options[:sync] = false
|
|
||||||
end
|
|
||||||
|
|
||||||
opts.on('-p', '--pattern PATTERN', I18n.t('option.pattern')) do |pattern|
|
opts.on('-p', '--pattern PATTERN', I18n.t('option.pattern')) do |pattern|
|
||||||
values[:pattern] = pattern
|
values[:pattern] = pattern
|
||||||
end
|
end
|
||||||
|
@ -62,7 +57,7 @@ OptionParser.new do |opts|
|
||||||
end.parse!
|
end.parse!
|
||||||
|
|
||||||
config = MPW::Config.new(options[:config])
|
config = MPW::Config.new(options[:config])
|
||||||
cli = MPW::Cli.new(config, options[:sync])
|
cli = MPW::Cli.new(config)
|
||||||
|
|
||||||
cli.load_config
|
cli.load_config
|
||||||
cli.get_wallet(options[:wallet])
|
cli.get_wallet(options[:wallet])
|
||||||
|
|
|
@ -25,7 +25,6 @@ require 'mpw/cli'
|
||||||
# --------------------------------------------------------- #
|
# --------------------------------------------------------- #
|
||||||
|
|
||||||
options = {}
|
options = {}
|
||||||
options[:sync] = true
|
|
||||||
|
|
||||||
OptionParser.new do |opts|
|
OptionParser.new do |opts|
|
||||||
opts.banner = "#{I18n.t('option.usage')}: mpw import [options]"
|
opts.banner = "#{I18n.t('option.usage')}: mpw import [options]"
|
||||||
|
@ -43,17 +42,13 @@ OptionParser.new do |opts|
|
||||||
exit 0
|
exit 0
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('-n', '--no-sync', I18n.t('option.no_sync')) do
|
|
||||||
options[:sync] = false
|
|
||||||
end
|
|
||||||
|
|
||||||
opts.on('-w', '--wallet NAME', I18n.t('option.wallet')) do |wallet|
|
opts.on('-w', '--wallet NAME', I18n.t('option.wallet')) do |wallet|
|
||||||
options[:wallet] = wallet
|
options[:wallet] = wallet
|
||||||
end
|
end
|
||||||
end.parse!
|
end.parse!
|
||||||
|
|
||||||
config = MPW::Config.new(options[:config])
|
config = MPW::Config.new(options[:config])
|
||||||
cli = MPW::Cli.new(config, options[:sync])
|
cli = MPW::Cli.new(config)
|
||||||
|
|
||||||
cli.load_config
|
cli.load_config
|
||||||
cli.get_wallet(options[:wallet])
|
cli.get_wallet(options[:wallet])
|
||||||
|
|
|
@ -25,7 +25,6 @@ require 'mpw/cli'
|
||||||
# --------------------------------------------------------- #
|
# --------------------------------------------------------- #
|
||||||
|
|
||||||
options = {}
|
options = {}
|
||||||
options[:sync] = true
|
|
||||||
values = {}
|
values = {}
|
||||||
|
|
||||||
OptionParser.new do |opts|
|
OptionParser.new do |opts|
|
||||||
|
@ -48,17 +47,13 @@ OptionParser.new do |opts|
|
||||||
values[:pattern] = pattern
|
values[:pattern] = pattern
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('-n', '--no-sync', I18n.t('option.no_sync')) do
|
|
||||||
options[:sync] = false
|
|
||||||
end
|
|
||||||
|
|
||||||
opts.on('-w', '--wallet NAME', I18n.t('option.wallet')) do |wallet|
|
opts.on('-w', '--wallet NAME', I18n.t('option.wallet')) do |wallet|
|
||||||
options[:wallet] = wallet
|
options[:wallet] = wallet
|
||||||
end
|
end
|
||||||
end.parse!
|
end.parse!
|
||||||
|
|
||||||
config = MPW::Config.new(options[:config])
|
config = MPW::Config.new(options[:config])
|
||||||
cli = MPW::Cli.new(config, options[:sync])
|
cli = MPW::Cli.new(config)
|
||||||
|
|
||||||
cli.load_config
|
cli.load_config
|
||||||
cli.get_wallet(options[:wallet])
|
cli.get_wallet(options[:wallet])
|
||||||
|
|
|
@ -25,7 +25,6 @@ require 'mpw/cli'
|
||||||
# --------------------------------------------------------- #
|
# --------------------------------------------------------- #
|
||||||
|
|
||||||
options = {}
|
options = {}
|
||||||
options[:sync] = true
|
|
||||||
values = {}
|
values = {}
|
||||||
|
|
||||||
OptionParser.new do |opts|
|
OptionParser.new do |opts|
|
||||||
|
@ -44,10 +43,6 @@ OptionParser.new do |opts|
|
||||||
exit 0
|
exit 0
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('-n', '--no-sync', I18n.t('option.no_sync')) do
|
|
||||||
options[:sync] = false
|
|
||||||
end
|
|
||||||
|
|
||||||
opts.on('-p', '--pattern PATTERN', I18n.t('option.pattern')) do |pattern|
|
opts.on('-p', '--pattern PATTERN', I18n.t('option.pattern')) do |pattern|
|
||||||
values[:pattern] = pattern
|
values[:pattern] = pattern
|
||||||
end
|
end
|
||||||
|
@ -62,7 +57,7 @@ OptionParser.new do |opts|
|
||||||
end.parse!
|
end.parse!
|
||||||
|
|
||||||
config = MPW::Config.new(options[:config])
|
config = MPW::Config.new(options[:config])
|
||||||
cli = MPW::Cli.new(config, options[:sync])
|
cli = MPW::Cli.new(config)
|
||||||
|
|
||||||
cli.load_config
|
cli.load_config
|
||||||
cli.get_wallet(options[:wallet])
|
cli.get_wallet(options[:wallet])
|
||||||
|
|
|
@ -25,9 +25,7 @@ require 'mpw/cli'
|
||||||
# --------------------------------------------------------- #
|
# --------------------------------------------------------- #
|
||||||
|
|
||||||
options = {}
|
options = {}
|
||||||
options[:sync] = {}
|
|
||||||
options[:delete] = false
|
options[:delete] = false
|
||||||
values = {}
|
|
||||||
|
|
||||||
OptionParser.new do |opts|
|
OptionParser.new do |opts|
|
||||||
opts.banner = "#{I18n.t('option.usage')}: mpw wallet [options]"
|
opts.banner = "#{I18n.t('option.usage')}: mpw wallet [options]"
|
||||||
|
@ -50,10 +48,6 @@ OptionParser.new do |opts|
|
||||||
exit 0
|
exit 0
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('--host NAME', I18n.t('option.host')) do |host|
|
|
||||||
values[:host] = host
|
|
||||||
end
|
|
||||||
|
|
||||||
opts.on('-l', '--list', I18n.t('option.list')) do
|
opts.on('-l', '--list', I18n.t('option.list')) do
|
||||||
options[:list] = true
|
options[:list] = true
|
||||||
end
|
end
|
||||||
|
@ -62,37 +56,13 @@ OptionParser.new do |opts|
|
||||||
options[:list_keys] = true
|
options[:list_keys] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('-n', '--no-sync', I18n.t('option.no_sync')) do
|
|
||||||
options[:sync] = false
|
|
||||||
end
|
|
||||||
|
|
||||||
opts.on('--password', I18n.t('option.password')) do
|
|
||||||
values[:password] = true
|
|
||||||
end
|
|
||||||
|
|
||||||
opts.on('--path PATH', I18n.t('option.path')) do |path|
|
|
||||||
values[:path] = path
|
|
||||||
end
|
|
||||||
|
|
||||||
opts.on('--port NUMBER', I18n.t('option.port')) do |port|
|
|
||||||
values[:port] = port
|
|
||||||
end
|
|
||||||
|
|
||||||
opts.on('--protocol NAME', I18n.t('option.protocol')) do |protocol|
|
|
||||||
values[:protocol] = protocol
|
|
||||||
end
|
|
||||||
|
|
||||||
opts.on('--user NAME', I18n.t('option.user')) do |user|
|
|
||||||
values[:user] = user
|
|
||||||
end
|
|
||||||
|
|
||||||
opts.on('-w', '--wallet NAME', I18n.t('option.wallet')) do |wallet|
|
opts.on('-w', '--wallet NAME', I18n.t('option.wallet')) do |wallet|
|
||||||
options[:wallet] = wallet
|
options[:wallet] = wallet
|
||||||
end
|
end
|
||||||
end.parse!
|
end.parse!
|
||||||
|
|
||||||
config = MPW::Config.new(options[:config])
|
config = MPW::Config.new(options[:config])
|
||||||
cli = MPW::Cli.new(config, options[:sync])
|
cli = MPW::Cli.new(config)
|
||||||
|
|
||||||
cli.load_config
|
cli.load_config
|
||||||
|
|
||||||
|
@ -110,7 +80,5 @@ else
|
||||||
else
|
else
|
||||||
cli.add_key(options[:gpg_key])
|
cli.add_key(options[:gpg_key])
|
||||||
end
|
end
|
||||||
elsif not values.empty?
|
|
||||||
cli.setup_wallet_config(values)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
26
i18n/en.yml
26
i18n/en.yml
|
@ -23,15 +23,6 @@ en:
|
||||||
import: "Can't import, unable to read %{file}!"
|
import: "Can't import, unable to read %{file}!"
|
||||||
update:
|
update:
|
||||||
host_empty: "You must define a host!"
|
host_empty: "You must define a host!"
|
||||||
sync:
|
|
||||||
general: "An error has appeared during the sync"
|
|
||||||
connection: "Connection fail!"
|
|
||||||
communication: "A communication problem with the server is appeared!"
|
|
||||||
download: "Can't download the file!"
|
|
||||||
not_authorized: "You haven't the access to remote file!"
|
|
||||||
upload: "Can't upload the file on the server!"
|
|
||||||
unknown: "An unknown error is occured!"
|
|
||||||
unknown_type: "The sync type is unknown"
|
|
||||||
|
|
||||||
warning:
|
warning:
|
||||||
select: 'Your choice is not a valid element!'
|
select: 'Your choice is not a valid element!'
|
||||||
|
@ -68,7 +59,6 @@ en:
|
||||||
gpg_key: "Specify a GPG key (ex: user@example.com)"
|
gpg_key: "Specify a GPG key (ex: user@example.com)"
|
||||||
group: "Search the items with specified group"
|
group: "Search the items with specified group"
|
||||||
help: "Show this help message"
|
help: "Show this help message"
|
||||||
host: "Specify the server for the synchronization"
|
|
||||||
init: "Initialize mpw"
|
init: "Initialize mpw"
|
||||||
import: "Import item since a yaml file"
|
import: "Import item since a yaml file"
|
||||||
key: "Specify the key name"
|
key: "Specify the key name"
|
||||||
|
@ -76,13 +66,8 @@ en:
|
||||||
length: "Size of the password"
|
length: "Size of the password"
|
||||||
list: "List the wallets"
|
list: "List the wallets"
|
||||||
list_keys: "List the GPG keys in wallet"
|
list_keys: "List the GPG keys in wallet"
|
||||||
no_sync: "Disable synchronization with the server"
|
|
||||||
numeric: "Use number to generate a password"
|
numeric: "Use number to generate a password"
|
||||||
password: "Change the password for the synchronization"
|
|
||||||
path: "Specify the remote path"
|
|
||||||
pattern: "Given search pattern"
|
pattern: "Given search pattern"
|
||||||
port: "Specify the connection port"
|
|
||||||
protocol: "Specify the protocol for the connection"
|
|
||||||
random_password: "Generate a random password"
|
random_password: "Generate a random password"
|
||||||
setup: "Create a new configuration file"
|
setup: "Create a new configuration file"
|
||||||
setup_wallet: "Create a new configuration file for a wallet"
|
setup_wallet: "Create a new configuration file for a wallet"
|
||||||
|
@ -90,7 +75,6 @@ en:
|
||||||
show: "Search and show the items"
|
show: "Search and show the items"
|
||||||
show_all: "List all items"
|
show_all: "List all items"
|
||||||
usage: "Usage"
|
usage: "Usage"
|
||||||
user: "Specify the user for the connection"
|
|
||||||
wallet: "Specify a wallet to use"
|
wallet: "Specify a wallet to use"
|
||||||
wallet_dir: "Set the wallets folder"
|
wallet_dir: "Set the wallets folder"
|
||||||
|
|
||||||
|
@ -141,16 +125,6 @@ en:
|
||||||
gpg_exe: "Enter the executable GPG path (optional): "
|
gpg_exe: "Enter the executable GPG path (optional): "
|
||||||
wallet_dir: "Enter the wallets's folder path [default=%{home}/wallets]: "
|
wallet_dir: "Enter the wallets's folder path [default=%{home}/wallets]: "
|
||||||
valid: "The config file has been created!"
|
valid: "The config file has been created!"
|
||||||
setup_wallet:
|
|
||||||
password: "Sync password: "
|
|
||||||
title: "Wallet setup"
|
|
||||||
sync_type: "Synchronization type (ssh, ftp): "
|
|
||||||
sync_host: "Synchronization server: "
|
|
||||||
sync_port: "Port of the synchronization server: "
|
|
||||||
sync_user: "Username for the synchronization: "
|
|
||||||
sync_pwd: "Password for the synchronization: "
|
|
||||||
sync_path: "File path for the synchronization : "
|
|
||||||
valid: "The wallet config file has been created!"
|
|
||||||
setup_gpg_key:
|
setup_gpg_key:
|
||||||
title: "Setup a GPG key"
|
title: "Setup a GPG key"
|
||||||
ask: "Do you want create your GPG key ? (Y/n)"
|
ask: "Do you want create your GPG key ? (Y/n)"
|
||||||
|
|
26
i18n/fr.yml
26
i18n/fr.yml
|
@ -23,15 +23,6 @@ fr:
|
||||||
import: "Impossible d'importer le fichier %{file}, car il n'est pas lisible!"
|
import: "Impossible d'importer le fichier %{file}, car il n'est pas lisible!"
|
||||||
update:
|
update:
|
||||||
host_empty: "Vous devez définir un host!"
|
host_empty: "Vous devez définir un host!"
|
||||||
sync:
|
|
||||||
general: "Une erreur est survenue durant la synchronisation"
|
|
||||||
connection: "La connexion n'a pu être établie!"
|
|
||||||
communication: "Un problème de communication avec le serveur est apparu!"
|
|
||||||
download: "Impossible de télécharger le fichier!"
|
|
||||||
not_authorized: "Vous n'avez pas les autorisations d'accès au fichier distant!"
|
|
||||||
upload: "Impossible d'envoyer le fichier sur le serveur!"
|
|
||||||
unknown: "Une erreur inconnue est survenue!"
|
|
||||||
unknown_type: "Le type de synchronisation est inconnu"
|
|
||||||
|
|
||||||
warning:
|
warning:
|
||||||
select: "Votre choix n'est pas un élément valide!"
|
select: "Votre choix n'est pas un élément valide!"
|
||||||
|
@ -68,7 +59,6 @@ fr:
|
||||||
gpg_key: "Spécifie une clé GPG (ex: user@example.com)"
|
gpg_key: "Spécifie une clé GPG (ex: user@example.com)"
|
||||||
group: "Recherche les éléments appartenant au groupe spécifié"
|
group: "Recherche les éléments appartenant au groupe spécifié"
|
||||||
help: "Affiche ce message d'aide"
|
help: "Affiche ce message d'aide"
|
||||||
host: "Spécifie le serveur pour la synchronisation"
|
|
||||||
import: "Importe des éléments depuis un fichier yaml"
|
import: "Importe des éléments depuis un fichier yaml"
|
||||||
init: "Initialise mpw"
|
init: "Initialise mpw"
|
||||||
key: "Spécifie le nom d'une clé"
|
key: "Spécifie le nom d'une clé"
|
||||||
|
@ -76,13 +66,8 @@ fr:
|
||||||
length: "Taille du mot de passe"
|
length: "Taille du mot de passe"
|
||||||
list: "Liste les portefeuilles"
|
list: "Liste les portefeuilles"
|
||||||
list_keys: "Liste les clés GPG dans le portefeuille"
|
list_keys: "Liste les clés GPG dans le portefeuille"
|
||||||
no_sync: "Désactive la synchronisation avec le serveur"
|
|
||||||
numeric: "Utilise des chiffre dans la génération d'un mot de passe"
|
numeric: "Utilise des chiffre dans la génération d'un mot de passe"
|
||||||
password: "Changer le mot de passe de connexion"
|
|
||||||
path: "Spécifie le chemin distant"
|
|
||||||
pattern: "Motif de donnée à chercher"
|
pattern: "Motif de donnée à chercher"
|
||||||
port: "Spécifie le port de connexion"
|
|
||||||
protocol: "Spécifie le protocol utilisé pour la connexion"
|
|
||||||
random_password: "Génére un mot de passe aléatoire"
|
random_password: "Génére un mot de passe aléatoire"
|
||||||
setup: "Création d'un nouveau fichier de configuration"
|
setup: "Création d'un nouveau fichier de configuration"
|
||||||
setup_wallet: "Création d'un nouveau fichier de configuration pour un portefeuille"
|
setup_wallet: "Création d'un nouveau fichier de configuration pour un portefeuille"
|
||||||
|
@ -90,7 +75,6 @@ fr:
|
||||||
show: "Recherche et affiche les éléments"
|
show: "Recherche et affiche les éléments"
|
||||||
show_all: "Liste tous les éléments"
|
show_all: "Liste tous les éléments"
|
||||||
usage: "Utilisation"
|
usage: "Utilisation"
|
||||||
user: "Spécifie l'identifiant de connection"
|
|
||||||
wallet: "Spécifie le portefeuille à utiliser"
|
wallet: "Spécifie le portefeuille à utiliser"
|
||||||
wallet_dir: "Spécifie le répertoire des portefeuilles"
|
wallet_dir: "Spécifie le répertoire des portefeuilles"
|
||||||
|
|
||||||
|
@ -141,16 +125,6 @@ fr:
|
||||||
gpg_exe: "Entrez le chemin de l'exécutable GPG (optionnel): "
|
gpg_exe: "Entrez le chemin de l'exécutable GPG (optionnel): "
|
||||||
wallet_dir: "Entrez le chemin du répertoire qui contiendra les porte-feuilles de mot de passe [défaut=%{home}/wallets]: "
|
wallet_dir: "Entrez le chemin du répertoire qui contiendra les porte-feuilles de mot de passe [défaut=%{home}/wallets]: "
|
||||||
valid: "Le fichier de configuration a bien été créé!"
|
valid: "Le fichier de configuration a bien été créé!"
|
||||||
setup_wallet:
|
|
||||||
password: "Mot de passe de synchronisation: "
|
|
||||||
title: "Configuration du porte-feuille"
|
|
||||||
sync_type: "Type de synchronisation (ssh, ftp): "
|
|
||||||
sync_host: "Serveur: "
|
|
||||||
sync_port: "Port: "
|
|
||||||
sync_user: "Utilisateur: "
|
|
||||||
sync_pwd: "Mot de passe: "
|
|
||||||
sync_path: "Chemin du fichier: "
|
|
||||||
valid: "Le fichier de configuration du porte-feuille a bien été créé!"
|
|
||||||
setup_gpg_key:
|
setup_gpg_key:
|
||||||
title: "Configuration d'une nouvelle clé GPG"
|
title: "Configuration d'une nouvelle clé GPG"
|
||||||
ask: "Voulez vous créer votre clé GPG ? (O/n)"
|
ask: "Voulez vous créer votre clé GPG ? (O/n)"
|
||||||
|
|
|
@ -31,10 +31,8 @@ class Cli
|
||||||
|
|
||||||
# Constructor
|
# Constructor
|
||||||
# @args: config -> the config
|
# @args: config -> the config
|
||||||
# sync -> boolean for sync or not
|
def initialize(config)
|
||||||
def initialize(config, sync=true)
|
|
||||||
@config = config
|
@config = config
|
||||||
@sync = sync
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Change a parameter int the config after init
|
# Change a parameter int the config after init
|
||||||
|
@ -89,26 +87,6 @@ class Cli
|
||||||
exit 2
|
exit 2
|
||||||
end
|
end
|
||||||
|
|
||||||
# Setup wallet config for sync
|
|
||||||
# @args: options -> value to change
|
|
||||||
def setup_wallet_config(options={})
|
|
||||||
if not options[:password].nil?
|
|
||||||
options[:password] = ask(I18n.t('form.setup_wallet.password')) {|q| q.echo = false}
|
|
||||||
end
|
|
||||||
|
|
||||||
#wallet_file = wallet.nil? ? "#{@config.wallet_dir}/default.mpw" : "#{@config.wallet_dir}/#{wallet}.mpw"
|
|
||||||
|
|
||||||
@mpw = MPW.new(@config.gpg_key, @wallet_file, @password, @config.gpg_exe)
|
|
||||||
@mpw.read_data
|
|
||||||
@mpw.set_config(options)
|
|
||||||
@mpw.write_data
|
|
||||||
|
|
||||||
puts "#{I18n.t('form.setup_wallet.valid')}".green
|
|
||||||
rescue Exception => e
|
|
||||||
puts "#{I18n.t('display.error')} #10: #{e}".red
|
|
||||||
exit 2
|
|
||||||
end
|
|
||||||
|
|
||||||
# List gpg keys in wallet
|
# List gpg keys in wallet
|
||||||
def list_keys
|
def list_keys
|
||||||
table_list('keys', @mpw.list_keys)
|
table_list('keys', @mpw.list_keys)
|
||||||
|
@ -131,7 +109,6 @@ class Cli
|
||||||
end
|
end
|
||||||
|
|
||||||
@mpw.read_data
|
@mpw.read_data
|
||||||
@mpw.sync if @sync
|
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
puts "#{I18n.t('display.error')} #11: #{e}".red
|
puts "#{I18n.t('display.error')} #11: #{e}".red
|
||||||
exit 2
|
exit 2
|
||||||
|
@ -369,7 +346,6 @@ class Cli
|
||||||
def add_key(key)
|
def add_key(key)
|
||||||
@mpw.add_key(key)
|
@mpw.add_key(key)
|
||||||
@mpw.write_data
|
@mpw.write_data
|
||||||
@mpw.sync(true) if @sync
|
|
||||||
|
|
||||||
puts "#{I18n.t('form.add_key.valid')}".green
|
puts "#{I18n.t('form.add_key.valid')}".green
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
|
@ -381,7 +357,6 @@ class Cli
|
||||||
def delete_key(key)
|
def delete_key(key)
|
||||||
@mpw.delete_key(key)
|
@mpw.delete_key(key)
|
||||||
@mpw.write_data
|
@mpw.write_data
|
||||||
@mpw.sync(true) if @sync
|
|
||||||
|
|
||||||
puts "#{I18n.t('form.delete_key.valid')}".green
|
puts "#{I18n.t('form.delete_key.valid')}".green
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
|
@ -431,7 +406,6 @@ class Cli
|
||||||
@mpw.set_password(item.id, options[:password]) if options.has_key?(:password)
|
@mpw.set_password(item.id, options[:password]) if options.has_key?(:password)
|
||||||
@mpw.set_otp_key(item.id, options[:otp_key]) if options.has_key?(:otp_key)
|
@mpw.set_otp_key(item.id, options[:otp_key]) if options.has_key?(:otp_key)
|
||||||
@mpw.write_data
|
@mpw.write_data
|
||||||
@mpw.sync(true) if @sync
|
|
||||||
|
|
||||||
puts "#{I18n.t('form.add_item.valid')}".green
|
puts "#{I18n.t('form.add_item.valid')}".green
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
|
@ -457,7 +431,6 @@ class Cli
|
||||||
@mpw.set_password(item.id, options[:password]) if options.has_key?(:password)
|
@mpw.set_password(item.id, options[:password]) if options.has_key?(:password)
|
||||||
@mpw.set_otp_key(item.id, options[:otp_key]) if options.has_key?(:otp_key)
|
@mpw.set_otp_key(item.id, options[:otp_key]) if options.has_key?(:otp_key)
|
||||||
@mpw.write_data
|
@mpw.write_data
|
||||||
@mpw.sync(true) if @sync
|
|
||||||
|
|
||||||
puts "#{I18n.t('form.update_item.valid')}".green
|
puts "#{I18n.t('form.update_item.valid')}".green
|
||||||
end
|
end
|
||||||
|
@ -484,7 +457,6 @@ class Cli
|
||||||
|
|
||||||
item.delete
|
item.delete
|
||||||
@mpw.write_data
|
@mpw.write_data
|
||||||
@mpw.sync(true) if @sync
|
|
||||||
|
|
||||||
puts "#{I18n.t('form.delete_item.valid')}".green
|
puts "#{I18n.t('form.delete_item.valid')}".green
|
||||||
end
|
end
|
||||||
|
|
|
@ -30,7 +30,6 @@ class Item
|
||||||
attr_accessor :otp
|
attr_accessor :otp
|
||||||
attr_accessor :comment
|
attr_accessor :comment
|
||||||
attr_accessor :last_edit
|
attr_accessor :last_edit
|
||||||
attr_accessor :last_sync
|
|
||||||
attr_accessor :created
|
attr_accessor :created
|
||||||
|
|
||||||
# Constructor
|
# Constructor
|
||||||
|
@ -72,11 +71,6 @@ class Item
|
||||||
@last_edit = Time.now.to_i if not options.has_key?(:no_update_last_edit)
|
@last_edit = Time.now.to_i if not options.has_key?(:no_update_last_edit)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Update last_sync
|
|
||||||
def set_last_sync
|
|
||||||
@last_sync = Time.now.to_i
|
|
||||||
end
|
|
||||||
|
|
||||||
# Delete all data
|
# Delete all data
|
||||||
def delete
|
def delete
|
||||||
@id = nil
|
@id = nil
|
||||||
|
@ -89,7 +83,6 @@ class Item
|
||||||
@comment = nil
|
@comment = nil
|
||||||
@created = nil
|
@created = nil
|
||||||
@last_edit = nil
|
@last_edit = nil
|
||||||
@last_sync = nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def empty?
|
def empty?
|
||||||
|
|
106
lib/mpw/mpw.rb
106
lib/mpw/mpw.rb
|
@ -229,7 +229,6 @@ class MPW
|
||||||
@config['user'] = options[:user] if options.has_key?(:user)
|
@config['user'] = options[:user] if options.has_key?(:user)
|
||||||
@config['password'] = options[:password] if options.has_key?(:password)
|
@config['password'] = options[:password] if options.has_key?(:password)
|
||||||
@config['path'] = options[:path] if options.has_key?(:path)
|
@config['path'] = options[:path] if options.has_key?(:path)
|
||||||
@config['last_sync'] = @config['last_sync'].nil? ? 0 : @config['last_sync']
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Add a new item
|
# Add a new item
|
||||||
|
@ -281,111 +280,6 @@ class MPW
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
# Get last sync
|
|
||||||
def get_last_sync
|
|
||||||
return @config['last_sync'].to_i
|
|
||||||
rescue
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
|
|
||||||
# Sync data with remote file
|
|
||||||
# @args: force -> force the sync
|
|
||||||
def sync(force=false)
|
|
||||||
return if @config.empty? or @config['protocol'].to_s.empty?
|
|
||||||
return if get_last_sync + 300 > Time.now.to_i and not force
|
|
||||||
|
|
||||||
tmp_file = "#{@wallet_file}.sync"
|
|
||||||
|
|
||||||
case @config['protocol']
|
|
||||||
when 'sftp', 'scp', 'ssh'
|
|
||||||
require "mpw/sync/ssh"
|
|
||||||
sync = SyncSSH.new(@config)
|
|
||||||
when 'ftp'
|
|
||||||
require 'mpw/sync/ftp'
|
|
||||||
sync = SyncFTP.new(@config)
|
|
||||||
else
|
|
||||||
raise I18n.t('error.sync.unknown_type')
|
|
||||||
end
|
|
||||||
|
|
||||||
sync.connect
|
|
||||||
sync.get(tmp_file)
|
|
||||||
|
|
||||||
remote = MPW.new(@key, tmp_file, @gpg_pass, @gpg_exe)
|
|
||||||
remote.read_data
|
|
||||||
|
|
||||||
File.unlink(tmp_file) if File.exist?(tmp_file)
|
|
||||||
|
|
||||||
return if remote.get_last_sync == @config['last_update']
|
|
||||||
|
|
||||||
if not remote.to_s.empty?
|
|
||||||
@data.each do |item|
|
|
||||||
next if item.empty?
|
|
||||||
|
|
||||||
update = false
|
|
||||||
|
|
||||||
remote.list.each do |r|
|
|
||||||
next if item.id != r.id
|
|
||||||
|
|
||||||
# Update item
|
|
||||||
if item.last_edit < r.last_edit
|
|
||||||
item.update(group: r.group,
|
|
||||||
host: r.host,
|
|
||||||
protocol: r.protocol,
|
|
||||||
user: r.user,
|
|
||||||
port: r.port,
|
|
||||||
comment: r.comment
|
|
||||||
)
|
|
||||||
set_password(item.id, remote.get_password(item.id))
|
|
||||||
end
|
|
||||||
|
|
||||||
r.delete
|
|
||||||
update = true
|
|
||||||
|
|
||||||
break
|
|
||||||
end
|
|
||||||
|
|
||||||
# Remove an old item
|
|
||||||
if not update and item.last_sync.to_i < get_last_sync and item.last_edit < get_last_sync
|
|
||||||
item.delete
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Add item
|
|
||||||
remote.list.each do |r|
|
|
||||||
next if r.last_edit <= get_last_sync
|
|
||||||
|
|
||||||
item = Item.new(id: r.id,
|
|
||||||
group: r.group,
|
|
||||||
host: r.host,
|
|
||||||
protocol: r.protocol,
|
|
||||||
user: r.user,
|
|
||||||
port: r.port,
|
|
||||||
comment: r.comment,
|
|
||||||
created: r.created,
|
|
||||||
last_edit: r.last_edit
|
|
||||||
)
|
|
||||||
|
|
||||||
set_password(item.id, remote.get_password(item.id))
|
|
||||||
add(item)
|
|
||||||
end
|
|
||||||
|
|
||||||
remote = nil
|
|
||||||
|
|
||||||
@data.each do |item|
|
|
||||||
item.set_last_sync
|
|
||||||
end
|
|
||||||
|
|
||||||
@config['last_sync'] = Time.now.to_i
|
|
||||||
|
|
||||||
write_data
|
|
||||||
sync.update(@wallet_file)
|
|
||||||
rescue Exception => e
|
|
||||||
File.unlink(tmp_file) if File.exist?(tmp_file)
|
|
||||||
|
|
||||||
raise "#{I18n.t('error.sync.general')}\n#{e}"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Set an opt key
|
# Set an opt key
|
||||||
# args: id -> the item id
|
# args: id -> the item id
|
||||||
# key -> the new key
|
# key -> the new key
|
||||||
|
|
|
@ -1,68 +0,0 @@
|
||||||
#!/usr/bin/ruby
|
|
||||||
# MPW is a software to crypt and manage your passwords
|
|
||||||
# Copyright (C) 2016 Adrien Waksberg <mpw@yae.im>
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or
|
|
||||||
# modify it under the terms of the GNU General Public License
|
|
||||||
# as published by the Free Software Foundation; either version 2
|
|
||||||
# of the License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
|
|
||||||
require 'i18n'
|
|
||||||
require 'net/ftp'
|
|
||||||
|
|
||||||
module MPW
|
|
||||||
class FTP
|
|
||||||
|
|
||||||
# Constructor
|
|
||||||
# @args: config -> the config
|
|
||||||
def initialize(config)
|
|
||||||
@host = config['host']
|
|
||||||
@user = config['user']
|
|
||||||
@password = config['password']
|
|
||||||
@path = config['path']
|
|
||||||
@port = config['port'].instance_of?(Integer) ? 22 : config['port']
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
# Connect to server
|
|
||||||
def connect
|
|
||||||
Net::FTP.open(@host) do |ftp|
|
|
||||||
ftp.login(@user, @password)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
rescue Exception => e
|
|
||||||
raise "#{I18n.t('error.sync.connection')}\n#{e}"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Get data on server
|
|
||||||
# @args: file_tmp -> the path where download the file
|
|
||||||
def get(file_tmp)
|
|
||||||
Net::FTP.open(@host) do |ftp|
|
|
||||||
ftp.login(@user, @password)
|
|
||||||
ftp.gettextfile(@path, file_tmp)
|
|
||||||
end
|
|
||||||
rescue Exception => e
|
|
||||||
raise "#{I18n.t('error.sync.download')}\n#{e}"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Update the remote data
|
|
||||||
# @args: file_gpg -> the data to send on server
|
|
||||||
def update(file_gpg)
|
|
||||||
Net::FTP.open(@host) do |ftp|
|
|
||||||
ftp.login(@user, @password)
|
|
||||||
ftp.puttextfile(file_gpg, @path)
|
|
||||||
end
|
|
||||||
rescue Exception => e
|
|
||||||
raise "#{I18n.t('error.sync.upload')}\n#{e}"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,67 +0,0 @@
|
||||||
#!/usr/bin/ruby
|
|
||||||
# MPW is a software to crypt and manage your passwords
|
|
||||||
# Copyright (C) 2016 Adrien Waksberg <mpw@yae.im>
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or
|
|
||||||
# modify it under the terms of the GNU General Public License
|
|
||||||
# as published by the Free Software Foundation; either version 2
|
|
||||||
# of the License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
|
|
||||||
require 'i18n'
|
|
||||||
require 'net/ssh'
|
|
||||||
require 'net/sftp'
|
|
||||||
|
|
||||||
module MPW
|
|
||||||
class SyncSSH
|
|
||||||
|
|
||||||
# Constructor
|
|
||||||
# @args: config -> the config
|
|
||||||
def initialize(config)
|
|
||||||
@host = config['host']
|
|
||||||
@user = config['user']
|
|
||||||
@password = config['password']
|
|
||||||
@path = config['path']
|
|
||||||
@port = config['port'].instance_of?(Integer) ? 22 : config['port']
|
|
||||||
end
|
|
||||||
|
|
||||||
# Connect to server
|
|
||||||
def connect
|
|
||||||
Net::SSH.start(@host, @user, password: @password, port: @port) do
|
|
||||||
break
|
|
||||||
end
|
|
||||||
rescue Exception => e
|
|
||||||
raise "#{I18n.t('error.sync.connection')}\n#{e}"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Get data on server
|
|
||||||
# @args: file_tmp -> the path where download the file
|
|
||||||
def get(file_tmp)
|
|
||||||
Net::SFTP.start(@host, @user, password: @password, port: @port) do |sftp|
|
|
||||||
sftp.lstat(@path) do |response|
|
|
||||||
sftp.download!(@path, file_tmp) if response.ok?
|
|
||||||
end
|
|
||||||
end
|
|
||||||
rescue Exception => e
|
|
||||||
raise "#{I18n.t('error.sync.download')}\n#{e}"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Update the remote data
|
|
||||||
# @args: file_gpg -> the data to send on server
|
|
||||||
def update(file_gpg)
|
|
||||||
Net::SFTP.start(@host, @user, password: @password, port: @port) do |sftp|
|
|
||||||
sftp.upload!(file_gpg, @path)
|
|
||||||
end
|
|
||||||
rescue Exception => e
|
|
||||||
raise "#{I18n.t('error.sync.upload')}\n#{e}"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in a new issue