pypass-0.2.1/ 0000755 0001750 0001750 00000000000 13227723055 013273 5 ustar aviau aviau 0000000 0000000 pypass-0.2.1/docs-requirements.txt 0000644 0001750 0001750 00000000056 13227722471 017507 0 ustar aviau aviau 0000000 0000000 click
colorama
enum34
sphinx
sphinx_rtd_theme
pypass-0.2.1/README.rst 0000644 0001750 0001750 00000010421 13227722471 014761 0 ustar aviau aviau 0000000 0000000 python-pass
###########
.. image:: https://travis-ci.org/ReAzem/python-pass.svg?branch=master
:target: https://travis-ci.org/ReAzem/python-pass
.. image:: https://img.shields.io/coveralls/ReAzem/python-pass.svg
:target: https://coveralls.io/r/ReAzem/python-pass?branch=master
.. image:: https://readthedocs.org/projects/pypass/badge/?version=latest&style
:target: https://readthedocs.org/projects/pypass/
:alt: Documentation Status
.. image:: https://pypip.in/version/pypass/badge.svg
:target: https://pypi.python.org/pypi/pypass/
:alt: Latest Version
For fun, I have decided to write `pass `_ in Python.
Python-pass will provide the same functionality as `pass `_. In addition, it will be usable as a library.
Testing
+++++++
Python-pass is tested for python 2.7, 3.2, 3.3, 3.4, pypy and pypy3
On your machine
---------------
- Install the requirements: ``sudo apt-get install -y gnupg tree``
- Prepare the gnupg home directory for testing: ``make setup_gpg``
- Run the tests: ``tox``
With Docker
-----------
- Run the tests in a container: ``make test``
- Or, get a shell with pypass installed: ``make run``
Documentation
+++++++++++++
Documentation for python-pass is available on `pypass.rtfd.org `_.
You can build the documentation and the man page yourself with ``tox -edocs``. The HTML documentation will be built in ``docs/build/html`` and the man page will be built in ``docs/build/man``.
Project Status
++++++++++++++
Bash completion
---------------
Comming soon.
``pypass init``
---------------
- [X] ``pypass init`` - creates a folder and a .gpg-id file
- [X] Support ``--path`` option
- [ ] re-encryption functionality
- [X] Should output: ``Password store initialized for [gpg-id].``
- [X] ``--clone `` allows to init from an existing repo
``pypass insert``
-----------------
- [X] ``pypass insert test.com`` prompts for a password and creates a test.com.gpg file
- [X] multi-line support
- [X] create a git commit
- [ ] When inserting in a folder with a .gpg-id file, insert should use the .gpg-id file's key
``pypass show``
---------------
- [X] ``pypass show test.com`` will display the content of test.com.gpg
- [X] ``--clip, -c`` copies the first line to the clipboard
- [ ] ``--password``, and ``--username`` options.
Accepted format:
::
login:
url:
``pypass connect`` (or ``ssh``)
-------------------------------
This new command should connect to a server using an encrypted rsa key.
``pypass ls``
-------------
- [X] ``pypass ls`` shows the content of the password store with ``tree``
- [X] ``pypass`` invokes ``pypass ls`` by default
- [X] ``pypass ls subfolder`` calls tree on the subfolder only
- [X] Hide .gpg at the end of each entry
- [X] Accept subfolder argument
- [X] First output line should be ``Password Store``
``pypass rm``
-------------
- [X] ``pypass rm test.com`` removes the test.com.gpg file
- [ ] ``pypass remove`` and ``pypass delete`` aliases
- [X] ``pypass rm -r folder`` (or ``--recursive``) will remove a folder and all of it's content (not interactive!)
- [X] Ask for confirmation
``pypass find``
---------------
- [X] ``pypass find python.org pypass`` will show a tree with password entries that match python.org or pass
- [X] Accepts one or many search terms
``pypass cp``
-------------
- [X] ``pypass cp old-path new-pah`` copies a password to a new path
- [ ] Dont overwrite
``pypass mv``
-------------
- [X] ``pypass mv old-path new-path`` moves a password to a new path
- [ ] Dont overwrite
``pypass git``
--------------
- [X] Pass commands to git
- [X] ``pypass git init`` should behave differently with an existing password store
- [X] Add tests
``pypass edit``
--------------
- [X] ``pypass edit test.com`` will open a text editor and let you edit the password
``pypass grep``
---------------
- [X] ``pypass grep searchstring`` will search for the given string inside all of the encrypted passwords
``pypass generate``
-------------------
- [ ] ``pypass generate [pass-name] [pass-length]`` Genrates a new password using of length pass-length and inserts it into pass-name.
- [ ] ``--no-symbols, -n``
- [ ] ``--clip, -c``
- [ ] ``--in-place, -i``
- [ ] ``--force, -f``
pypass-0.2.1/pypass.egg-info/ 0000755 0001750 0001750 00000000000 13227723055 016304 5 ustar aviau aviau 0000000 0000000 pypass-0.2.1/pypass.egg-info/pbr.json 0000644 0001750 0001750 00000000056 13227723055 017763 0 ustar aviau aviau 0000000 0000000 {"git_version": "f740b1b", "is_release": true} pypass-0.2.1/pypass.egg-info/SOURCES.txt 0000644 0001750 0001750 00000001407 13227723055 020172 0 ustar aviau aviau 0000000 0000000 .travis.yml
AUTHORS
ChangeLog
Dockerfile
LICENSE
Makefile
README.rst
docs-requirements.txt
requirements.txt
setup.cfg
setup.py
test-requirements.txt
tox.ini
completion/pypass.bash-completion
docs/source/API.rst
docs/source/conf.py
docs/source/index.rst
docs/source/introduction.rst
docs/source/manpage.rst
pypass/__init__.py
pypass/command.py
pypass/entry_type.py
pypass/passwordstore.py
pypass.egg-info/PKG-INFO
pypass.egg-info/SOURCES.txt
pypass.egg-info/dependency_links.txt
pypass.egg-info/entry_points.txt
pypass.egg-info/not-zip-safe
pypass.egg-info/pbr.json
pypass.egg-info/requires.txt
pypass.egg-info/top_level.txt
pypass/tests/__init__.py
pypass/tests/test_command.py
pypass/tests/test_key_sec.asc
pypass/tests/test_ownertrust.txt
pypass/tests/test_passwordstore.py pypass-0.2.1/pypass.egg-info/top_level.txt 0000644 0001750 0001750 00000000007 13227723055 021033 0 ustar aviau aviau 0000000 0000000 pypass
pypass-0.2.1/pypass.egg-info/not-zip-safe 0000644 0001750 0001750 00000000001 13227723055 020532 0 ustar aviau aviau 0000000 0000000
pypass-0.2.1/pypass.egg-info/dependency_links.txt 0000644 0001750 0001750 00000000001 13227723055 022352 0 ustar aviau aviau 0000000 0000000
pypass-0.2.1/pypass.egg-info/PKG-INFO 0000644 0001750 0001750 00000000373 13227723055 017404 0 ustar aviau aviau 0000000 0000000 Metadata-Version: 1.0
Name: pypass
Version: 0.2.1
Summary: Pass in python
Home-page: https://github.com/ReAzem/python-pass
Author: Alexandre Viau
Author-email: alexandre@alexandreviau.net
License: UNKNOWN
Description: Pass in python
Platform: UNKNOWN
pypass-0.2.1/pypass.egg-info/requires.txt 0000644 0001750 0001750 00000000036 13227723055 020703 0 ustar aviau aviau 0000000 0000000 click
colorama
enum34
pexpect
pypass-0.2.1/pypass.egg-info/entry_points.txt 0000644 0001750 0001750 00000000060 13227723055 021576 0 ustar aviau aviau 0000000 0000000 [console_scripts]
pypass = pypass.command:main
pypass-0.2.1/completion/ 0000755 0001750 0001750 00000000000 13227723055 015444 5 ustar aviau aviau 0000000 0000000 pypass-0.2.1/completion/pypass.bash-completion 0000644 0001750 0001750 00000005671 13227722471 022003 0 ustar aviau aviau 0000000 0000000 # completion file for bash
# Copyright (C) 2012 - 2014 Jason A. Donenfeld and
# Brian Mattern . All Rights Reserved.
# This file is licensed under the GPLv2+. Please see COPYING for more information.
_pypass_complete_entries () {
prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store/}"
suffix=".gpg"
autoexpand=${1:-0}
local IFS=$'\n'
local items=($(compgen -f $prefix$cur))
for item in ${items[@]}; do
[[ $item =~ /\.[^/]*$ ]] && continue
# if there is a unique match, and it is a directory with one entry
# autocomplete the subentry as well (recursively)
if [[ ${#items[@]} -eq 1 && $autoexpand -eq 1 ]]; then
while [[ -d $item ]]; do
local subitems=($(compgen -f "$item/"))
local filtereditems=( )
for item2 in "${subitems[@]}"; do
[[ $item2 =~ /\.[^/]*$ ]] && continue
filtereditems+=( "$item2" )
done
if [[ ${#filtereditems[@]} -eq 1 ]]; then
item="${filtereditems[0]}"
else
break
fi
done
fi
# append / to directories
[[ -d $item ]] && item="$item/"
item="${item%$suffix}"
COMPREPLY+=("${item#$prefix}")
done
}
_pypass_complete_folders () {
prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store/}"
local IFS=$'\n'
local items=($(compgen -d $prefix$cur))
for item in ${items[@]}; do
[[ $item == $prefix.* ]] && continue
COMPREPLY+=("${item#$prefix}/")
done
}
_pypass_complete_keys () {
local IFS=$'\n'
# Extract names and email addresses from gpg --list-keys
local keys="$(gpg2 --list-secret-keys --with-colons | cut -d : -f 10 | sort -u | sed '/^$/d')"
COMPREPLY+=($(compgen -W "${keys}" -- ${cur}))
}
_pypass()
{
COMPREPLY=()
local cur="${COMP_WORDS[COMP_CWORD]}"
local commands="init ls find grep show insert generate edit rm mv cp connect git help version"
if [[ $COMP_CWORD -gt 1 ]]; then
local lastarg="${COMP_WORDS[$COMP_CWORD-1]}"
COMPREPLY+=($(compgen -W "-h --help" -- ${cur}))
case "${COMP_WORDS[1]}" in
init)
if [[ $lastarg == "-p" || $lastarg == "--path" ]]; then
_pypass_complete_folders
else
COMPREPLY+=($(compgen -W "-p --path" -- ${cur}))
_pypass_complete_keys
fi
;;
ls|list|edit|connect)
_pypass_complete_entries
;;
show|-*)
COMPREPLY+=($(compgen -W "-c --clip" -- ${cur}))
_pypass_complete_entries 1
;;
insert)
COMPREPLY+=($(compgen -W "-m --multiline" -- ${cur}))
_pypass_complete_entries
;;
generate)
COMPREPLY+=($(compgen -W "-n --no-symbols" -- ${cur}))
_pypass_complete_entries
;;
cp|mv)
#COMPREPLY+=($(compgen -W "-f --force" -- ${cur}))
_pypass_complete_entries
;;
rm)
COMPREPLY+=($(compgen -W "-r --recursive" -- ${cur}))
_pypass_complete_entries
;;
git)
COMPREPLY+=($(compgen -W "init push pull config log reflog rebase" -- ${cur}))
;;
esac
else
COMPREPLY+=($(compgen -W "${commands}" -- ${cur}))
#_pypass_complete_entries 1
fi
}
complete -o filenames -o nospace -F _pypass pypass
pypass-0.2.1/pypass/ 0000755 0001750 0001750 00000000000 13227723055 014612 5 ustar aviau aviau 0000000 0000000 pypass-0.2.1/pypass/command.py 0000644 0001750 0001750 00000027472 13227722471 016617 0 ustar aviau aviau 0000000 0000000 #
# Copyright (C) 2014 Alexandre Viau
#
# This file is part of python-pass.
#
# python-pass 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 3 of the License, or
# (at your option) any later version.
#
# python-pass 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 python-pass. If not, see .
#
import os
import subprocess
import shutil
import sys
import tempfile
import click
import colorama
from pexpect import pxssh
from pypass.entry_type import EntryType
from pypass import PasswordStore
@click.group(invoke_without_command=True)
@click.option('--PASSWORD_STORE_DIR',
envvar='PASSWORD_STORE_DIR',
default=os.path.join(os.getenv("HOME"), ".password-store"),
type=click.Path(file_okay=False, resolve_path=True))
@click.option('--PASSWORD_STORE_GIT',
envvar='PASSWORD_STORE_GIT',
type=click.Path(file_okay=False, resolve_path=True),
default=None)
@click.option('--EDITOR',
envvar='EDITOR',
default='editor',
type=click.STRING)
@click.pass_context
def main(ctx, password_store_dir, password_store_git, editor):
# init does not need any of this.
if ctx.invoked_subcommand == "init":
return
# Prepare the config file
config = {
'password_store': PasswordStore(
path=password_store_dir,
git_dir=password_store_git
),
'editor': editor
}
ctx.obj = config
# By default, invoke ls
if ctx.invoked_subcommand is None:
ctx.invoke(ls)
@main.command(name='help')
@click.pass_context
def hlp(contex):
click.echo(contex.parent.get_help())
@main.command()
@click.option('--path', '-p',
type=click.Path(file_okay=False, resolve_path=True),
default=os.path.join(os.getenv("HOME"), ".password-store"),
help='Where to create the password store.')
@click.option('--clone', '-c',
type=click.STRING,
help='Git url to clone')
@click.argument('gpg-id', type=click.STRING)
def init(path, clone, gpg_id):
PasswordStore.init(gpg_id, path, clone_url=clone)
click.echo("Password store initialized for %s." % gpg_id)
@main.command()
@click.option('--multiline', '-m', is_flag=True)
@click.argument('path', type=click.STRING)
@click.pass_obj
def insert(config, path, multiline):
if multiline:
with tempfile.NamedTemporaryFile() as temp_file:
if subprocess.call([config['editor'], temp_file.name]) == 0:
password = temp_file.read().strip()
else:
password = click.prompt(
'Enter the password',
type=str,
confirmation_prompt=True,
hide_input=True
)
config['password_store'].insert_password(path, password)
if config['password_store'].uses_git:
config['password_store'].git_add_and_commit(
path + '.gpg',
message='Added %s to store' % path
)
@main.command()
@click.option('--no-symbols', '-n', is_flag=True, default=False)
@click.argument('pass_name', type=click.STRING)
@click.argument('pass_length', type=int)
def generate(pass_name, pass_length, no_symbols):
symbols = not no_symbols
password = PasswordStore.generate_password(
digits=True,
symbols=symbols,
length=pass_length
)
print(password)
@main.command()
@click.pass_obj
@click.argument('path', type=click.STRING)
def edit(config, path):
if path in config['password_store'].get_passwords_list():
old_password = config['password_store'].get_decrypted_password(path)
with tempfile.NamedTemporaryFile() as temp_file:
temp_file.write(old_password)
temp_file.flush()
subprocess.call([config['editor'], temp_file.name])
temp_file.seek(0)
config['password_store'].insert_password(
path, temp_file.file.read()
)
click.echo("%s was updated." % path)
if config['password_store'].uses_git:
config['password_store'].git_add_and_commit(
path + '.gpg',
message='Edited password for %s using %s'
% (path, config['editor'])
)
else:
click.echo("%s is not in the password store." % path)
@main.command()
@click.option('--clip', '-c', is_flag=True)
@click.argument('path', type=click.STRING)
@click.pass_obj
def show(config, path, clip):
if path not in config['password_store'].get_passwords_list():
click.echo('Error: %s is not in the password store.' % path)
sys.exit(1)
decrypted_password = \
config['password_store'].get_decrypted_password(path).strip()
if clip:
xclip = subprocess.Popen(
[
'xclip',
'-selection', 'clipboard'
],
stdin=subprocess.PIPE
)
xclip.stdin.write(decrypted_password.split('\n')[0].encode('utf8'))
xclip.stdin.close()
click.echo('Copied %s to clipboard.' % path)
else:
click.echo(decrypted_password)
@main.command()
@click.argument('path', type=click.STRING)
@click.pass_obj
def connect(config, path):
store = config['password_store']
hostname = store.get_decrypted_password(path, entry=EntryType.hostname)
username = store.get_decrypted_password(path, entry=EntryType.username)
password = store.get_decrypted_password(path, entry=EntryType.password)
s = pxssh.pxssh()
click.echo("Connectig to %s" % hostname)
s.login(hostname, username, password=password)
s.sendline()
s.interact()
@main.command()
@click.argument('subfolder', required=False, type=click.STRING, default='')
@click.pass_obj
def ls(config, subfolder):
tree = subprocess.Popen(
[
'tree',
'-C',
'-l',
'--noreport',
os.path.join(config['password_store'].path, subfolder),
],
shell=False,
stdout=subprocess.PIPE
)
tree.wait()
if tree.returncode == 0:
output_without_gpg = \
tree.stdout.read().decode('utf8').replace('.gpg', '')
output_replaced_first_line =\
"Password Store\n" + '\n'.join(output_without_gpg.split('\n')[1:])
output_stripped = output_replaced_first_line.strip()
click.echo(output_stripped)
@main.command()
@click.argument('search_terms', nargs=-1)
@click.pass_obj
def find(config, search_terms):
click.echo("Search Terms: " + ','.join(search_terms))
pattern = '*' + '*|*'.join(search_terms) + '*'
tree = subprocess.Popen(
[
'tree',
'-C',
'-l',
'--noreport',
'-P', pattern,
# '--prune', (tree>=1.5)
# '--matchdirs', (tree>=1.7)
# '--ignore-case', (tree>=1.7)
config['password_store'].path,
],
shell=False,
stdout=subprocess.PIPE
)
tree.wait()
if tree.returncode == 0:
output_without_gpg = \
tree.stdout.read().decode('utf8').replace('.gpg', '')
output_without_first_line =\
'\n'.join(output_without_gpg.split('\n')[1:]).strip()
click.echo(output_without_first_line)
@main.command()
@click.argument('search_string')
@click.pass_obj
def grep(config, search_string):
for password in config['password_store'].get_passwords_list():
decrypted_password = \
config['password_store'].get_decrypted_password(password)
grep = subprocess.Popen(
['grep', '-e', search_string],
stdout=subprocess.PIPE,
stdin=subprocess.PIPE
)
grep.stdin.write(decrypted_password.encode())
grep.stdin.close()
grep_stdout = grep.stdout.read().decode().strip()
if grep_stdout.strip() != '':
click.echo(
colorama.Fore.BLUE + password + ":" + '\n' +
colorama.Fore.RESET + grep_stdout
)
@main.command()
@click.option('--recursive', '-r', is_flag=True)
@click.argument('path', type=click.STRING)
@click.pass_obj
def rm(config, recursive, path):
resolved_path = os.path.realpath(
os.path.join(config['password_store'].path, path)
)
if os.path.isdir(resolved_path) is False:
resolved_path = os.path.join(
config['password_store'].path,
path + '.gpg'
)
if os.path.exists(resolved_path):
if recursive:
click.confirm("Recursively remove %s?" % resolved_path, abort=True)
shutil.rmtree(resolved_path)
else:
click.confirm("Really remove %s?" % resolved_path, abort=True)
os.remove(resolved_path)
click.echo("%s was removed from the store." % path)
else:
click.echo("Error: %s is not in the password store." % path)
@main.command()
@click.argument('old_path', type=click.STRING)
@click.argument('new_path', type=click.STRING)
@click.pass_obj
def cp(config, old_path, new_path):
resolved_old_path = os.path.realpath(
os.path.join(config['password_store'].path, old_path)
)
if os.path.isdir(resolved_old_path):
shutil.copytree(
resolved_old_path,
os.path.realpath(
os.path.join(config['password_store'].path, new_path)
)
)
else:
resolved_old_path = os.path.realpath(
os.path.join(config['password_store'].path, old_path + '.gpg')
)
if os.path.isfile(resolved_old_path):
shutil.copy(
resolved_old_path,
os.path.realpath(
os.path.join(
config['password_store'].path,
new_path + '.gpg'
)
)
)
else:
click.echo("Error: %s is not in the password store" % old_path)
@main.command()
@click.argument('old_path', type=click.STRING)
@click.argument('new_path', type=click.STRING)
@click.pass_obj
def mv(config, old_path, new_path):
resolved_old_path = os.path.realpath(
os.path.join(config['password_store'].path, old_path)
)
if os.path.isdir(resolved_old_path):
shutil.move(
resolved_old_path,
os.path.realpath(
os.path.join(config['password_store'].path, new_path)
)
)
else:
resolved_old_path = os.path.realpath(
os.path.join(config['password_store'].path, old_path + '.gpg')
)
if os.path.isfile(resolved_old_path):
shutil.move(
resolved_old_path,
os.path.realpath(
os.path.join(
config['password_store'].path,
new_path + '.gpg'
)
)
)
else:
click.echo("Error: %s is not in the password store" % old_path)
@main.command()
@click.argument('commands', nargs=-1)
@click.pass_obj
def git(config, commands):
command_list = list(commands)
if len(command_list) > 0 and command_list[0] == 'init':
config['password_store'].git_init()
else:
subprocess.call(
[
'git',
'--git-dir=%s' % config['password_store'].git_dir,
'--work-tree=%s' % config['password_store'].path,
] + command_list,
shell=False,
)
if __name__ == '__main__':
main()
pypass-0.2.1/pypass/__init__.py 0000644 0001750 0001750 00000001641 13227722471 016726 0 ustar aviau aviau 0000000 0000000 # -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Alexandre Viau
#
# This file is part of python-pass.
#
# python-pass 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 3 of the License, or
# (at your option) any later version.
#
# python-pass 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 python-pass. If not, see .
#
from .passwordstore import PasswordStore
from .entry_type import EntryType
__all__ = [
'PasswordStore',
'EntryType'
]
pypass-0.2.1/pypass/passwordstore.py 0000644 0001750 0001750 00000025323 13227722471 020111 0 ustar aviau aviau 0000000 0000000 #
# Copyright (C) 2014 Alexandre Viau
#
# This file is part of python-pass.
#
# python-pass 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 3 of the License, or
# (at your option) any later version.
#
# python-pass 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 python-pass. If not, see .
#
import os
import subprocess
import string
import random
import re
from .entry_type import EntryType
# Find the right gpg binary
if subprocess.call(
['which', 'gpg2'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE) == 0:
GPG_BIN = 'gpg2'
elif subprocess.call(
['which', 'gpg'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE) == 0:
GPG_BIN = 'gpg'
else:
raise Exception("Could not find GPG")
class PasswordStore(object):
"""This is a Password Store
:param path: The path of the password-store. By default,
'$home/.password-store'.
:param git_dir: The git directory of the password store. By default,
it looks for a .git directory in the password store.
"""
def __init__(
self,
path=os.path.join(os.getenv("HOME"), ".password-store"),
git_dir=None,
):
self.path = path
# Read the .gpg-id
gpg_id_file = os.path.join(path, '.gpg-id')
if os.path.isfile(gpg_id_file):
self.gpg_id = open(gpg_id_file, 'r').read().strip()
else:
raise Exception("could not find .gpg-id file")
# Try to locate the git dir
git_dir = git_dir or os.path.join(self.path, '.git')
self.uses_git = os.path.isdir(git_dir)
if self.uses_git:
self.git_dir = git_dir
def get_passwords_list(self):
"""Returns a list of the passwords in the store
:returns: Example: ['Email/bob.net', 'example.com']
"""
passwords = []
for root, dirnames, filenames in os.walk(self.path):
for filename in filenames:
if filename.endswith('.gpg'):
path = os.path.join(root, filename.replace('.gpg', ''))
simplified_path = path.replace(self.path + '/', '')
passwords.append(simplified_path)
return passwords
def get_decrypted_password(self, path, entry=None):
"""Returns the content of the decrypted password file
:param path: The path of the password to be decrypted. Example:
'email.com'
:param entry: The entry to retreive. (EntryType enum)
"""
passfile_path = os.path.realpath(
os.path.join(
self.path,
path + '.gpg'
)
)
gpg = subprocess.Popen(
[
GPG_BIN,
'--quiet',
'--batch',
'--use-agent',
'-d', passfile_path,
],
shell=False,
stdout=subprocess.PIPE
)
gpg.wait()
if gpg.returncode == 0:
decrypted_password = gpg.stdout.read().decode()
if entry == EntryType.username:
usr = re.search(
'(?:username|user|login): (.+)',
decrypted_password
)
if usr:
return usr.groups()[0]
elif entry == EntryType.password:
pw = re.search('(?:password|pass): (.+)', decrypted_password)
if pw:
return pw.groups()[0]
else: # If there is no match, password is the first line
return decrypted_password.split('\n')[0]
elif entry == EntryType.hostname:
hostname = re.search(
'(?:host|hostname): (.+)', decrypted_password
)
if hostname:
return hostname.groups()[0]
else:
return decrypted_password
def insert_password(self, path, password):
"""Encrypts the password at the given path
:param path: Where to insert the password. Ex: 'passwordstore.org'
:param password: The password to insert, can be multi-line
"""
passfile_path = os.path.realpath(
os.path.join(self.path, path + '.gpg')
)
if not os.path.isdir(os.path.dirname(passfile_path)):
os.makedirs(os.path.dirname(passfile_path))
gpg = subprocess.Popen(
[
GPG_BIN,
'-e',
'-r', self.gpg_id,
'--batch',
'--use-agent',
'--no-tty',
'--yes',
'-o', passfile_path
],
shell=False,
stdin=subprocess.PIPE
)
gpg.stdin.write(password.encode())
gpg.stdin.close()
gpg.wait()
@staticmethod
def generate_password(digits=True, symbols=True, length=15):
"""Returns a random password
:param digits: Should the password have digits? Defaults to True
:param symbols: Should the password have symbols? Defaults to True
:param length: Length of the password. Defaults to 15
"""
chars = string.ascii_letters
if symbols:
chars += string.punctuation
if digits:
chars += string.digits
password = ''.join(random.choice(chars) for i in range(length))
return password
@staticmethod
def init(gpg_id, path, clone_url=None):
"""Creates a password store to the given path
:param gpg_id: Default gpg key identification used for encryption and
decryption. Example: '3CCC3A3A'
:param path: Where to create the password store. By default, this is
$home/.password-store
:param clone_url: If specified, the clone_url parameter will be used
to import a password store from a git repository.
Example: ssh://myserver.net:/home/bob/.password-store
:returns: PasswordStore object
"""
git_dir = os.path.join(path, '.git')
git_work_tree = path
# Create a folder at the path
if not os.path.exists(path):
os.makedirs(path)
# Clone an existing remote repo
if clone_url:
# Init git repo
subprocess.call(
[
"git",
"--git-dir=%s" % git_dir,
"--work-tree=%s" % git_work_tree,
"init", path
],
shell=False
)
# Add remote repo
subprocess.call(
[
"git",
"--git-dir=%s" % git_dir,
"--work-tree=%s" % git_work_tree,
"remote",
"add",
"origin",
clone_url
],
shell=False,
)
# Pull remote repo
# TODO: add parameters for remote and branch ?
subprocess.call(
[
"git",
"--git-dir=%s" % git_dir,
"--work-tree=%s" % git_work_tree,
"pull",
"origin",
"master"
],
shell=False
)
gpg_id_path = os.path.join(path, '.gpg-id')
if os.path.exists(gpg_id_path) is False:
# Create .gpg_id and put the gpg id in it
with open(os.path.join(path, '.gpg-id'), 'a') as gpg_id_file:
gpg_id_file.write(gpg_id + '\n')
return PasswordStore(path)
def git_init(self, git_dir=None):
"""Transform the existing password store into a git repository
:param git_dir: Where to create the git directory. By default, it will
be created at the root of the password store in a .git
folder.
"""
self.git_dir = git_dir or os.path.join(self.path, '.git')
self.uses_git = True
subprocess.call(
[
'git',
"--git-dir=%s" % self.git_dir,
"--work-tree=%s" % self.path,
'init',
],
shell=False
)
self.git_add_and_commit(
'.',
message="Add current contents of password store."
)
# Create .gitattributes and commit it
with open(
os.path.join(self.path, '.gitattributes'), 'w'
) as gitattributes:
gitattributes.write('*.gpg diff=gpg\n')
self.git_add_and_commit(
'.gitattributes',
message="Configure git repository for gpg file diff."
)
subprocess.call(
[
'git',
"--git-dir=%s" % self.git_dir,
"--work-tree=%s" % self.path,
'config',
'--local',
'diff.gpg.binary',
'true'
],
shell=False
)
subprocess.call(
[
'git',
"--git-dir=%s" % self.git_dir,
"--work-tree=%s" % self.path,
'config',
'--local',
'diff.gpg.textconv',
'gpg -d'
],
shell=False
)
def git_add_and_commit(self, path, message=None):
subprocess.call(
[
'git',
"--git-dir=%s" % self.git_dir,
"--work-tree=%s" % self.path,
'add',
path
],
shell=False
)
if message:
subprocess.call(
[
'git',
"--git-dir=%s" % self.git_dir,
"--work-tree=%s" % self.path,
'commit',
'-m',
message
],
shell=False
)
else:
subprocess.call(
[
'git',
"--git-dir=%s" % self.git_dir,
"--work-tree=%s" % self.path,
'commit'
],
shell=False
)
pypass-0.2.1/pypass/entry_type.py 0000644 0001750 0001750 00000001677 13227722471 017402 0 ustar aviau aviau 0000000 0000000 #
# Copyright (C) 2014 Alexandre Viau
#
# This file is part of python-pass.
#
# python-pass 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 3 of the License, or
# (at your option) any later version.
#
# python-pass 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 python-pass. If not, see .
#
from enum import Enum
class EntryType(Enum):
password = 1
"""password entry"""
username = 2
"""username/login entry"""
hostname = 3
"""hostname entry"""
pypass-0.2.1/pypass/tests/ 0000755 0001750 0001750 00000000000 13227723055 015754 5 ustar aviau aviau 0000000 0000000 pypass-0.2.1/pypass/tests/__init__.py 0000644 0001750 0001750 00000001612 13227722471 020066 0 ustar aviau aviau 0000000 0000000 #
# Copyright (C) 2014 Alexandre Viau
#
# This file is part of python-pass.
#
# python-pass 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 3 of the License, or
# (at your option) any later version.
#
# python-pass 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 python-pass. If not, see .
#
import os
import unittest
skipIfTravis = unittest.skipIf(
os.getenv('TRAVIS') == 'true', "Skipping this test on travis."
)
pypass-0.2.1/pypass/tests/test_passwordstore.py 0000644 0001750 0001750 00000016160 13227722471 022311 0 ustar aviau aviau 0000000 0000000 #
# Copyright (C) 2014 Alexandre Viau
#
# This file is part of python-pass.
#
# python-pass 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 3 of the License, or
# (at your option) any later version.
#
# python-pass 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 python-pass. If not, see .
#
import unittest
import os
import shutil
import subprocess
import string
import tempfile
from pypass import PasswordStore
from pypass import EntryType
class TestPasswordStore(unittest.TestCase):
def setUp(self):
self.dir = tempfile.mkdtemp()
# .gpg_id file
with open(os.path.join(self.dir, '.gpg-id'), 'w') as gpg_id_file:
gpg_id_file.write('5C5833E3')
# Create three dummy files
open(os.path.join(self.dir, 'linux.ca.gpg'), 'a').close()
open(os.path.join(self.dir, 'passwordstore.org.gpg'), 'a').close()
open(os.path.join(self.dir, 'test.com.gpg'), 'a').close()
# Create one folder
email_folder_path = os.path.join(self.dir, 'Email')
os.mkdir(email_folder_path)
open(os.path.join(email_folder_path, 'email.com.gpg'), 'a').close()
def tearDown(self):
shutil.rmtree(self.dir)
def test_constructor(self):
store = PasswordStore(self.dir)
self.assertEqual(store.gpg_id, '5C5833E3')
self.assertFalse(store.uses_git)
self.assertEqual(self.dir, store.path)
def test_get_passwords_list(self):
store = PasswordStore(self.dir)
self.assertListEqual(
sorted(store.get_passwords_list()),
sorted([
'test.com',
'linux.ca',
'passwordstore.org',
'Email/email.com',
])
)
def test_encrypt_decrypt(self):
self.assertFalse(
os.path.isfile(os.path.join(self.dir, 'hello.com.gpg'))
)
store = PasswordStore(self.dir)
password = 'ELLO'
store.insert_password('hello.com', password)
self.assertTrue(
os.path.isfile(os.path.join(self.dir, 'hello.com.gpg'))
)
self.assertEqual(
password,
store.get_decrypted_password('hello.com')
)
def test_get_decrypted_password_specific_entry(self):
store = PasswordStore(self.dir)
password = 'ELLO'
store.insert_password('hello.com', password)
# When there is no 'password:' mention, the password is assumed to be
# the first line.
self.assertEqual(
'ELLO',
store.get_decrypted_password('hello.com', entry=EntryType.password)
)
store.insert_password('hello.com', 'sdfsdf\npassword: pwd')
self.assertEqual(
'pwd',
store.get_decrypted_password('hello.com', entry=EntryType.password)
)
store.insert_password('hello.com', 'sdf\npassword: pwd\nusername: bob')
self.assertEqual(
'bob',
store.get_decrypted_password('hello.com', entry=EntryType.username)
)
def test_get_decrypted_password_only_password(self):
store = PasswordStore(self.dir)
password = 'ELLO'
store.insert_password('hello.com', password)
self.assertEqual(
'ELLO',
store.get_decrypted_password('hello.com')
)
def test_get_decrypted_password_deeply_nested(self):
store = PasswordStore(self.dir)
self.assertFalse(
os.path.isdir(os.path.join(self.dir, 'A', 'B', 'C'))
)
store.insert_password('A/B/C/D/hello.com', 'Alice')
store.insert_password('A/B/C/hello.com', 'Bob')
self.assertEqual(
'Alice',
store.get_decrypted_password('A/B/C/D/hello.com')
)
self.assertEqual(
'Bob',
store.get_decrypted_password('A/B/C/hello.com')
)
self.assertTrue(
os.path.isdir(os.path.join(self.dir, 'A', 'B', 'C', 'D'))
)
def test_init(self):
init_dir = tempfile.mkdtemp()
PasswordStore.init(
'5C5833E3',
path=os.path.join(init_dir, '.password-store')
)
self.assertTrue(
os.path.isdir(os.path.join(init_dir, '.password-store'))
)
self.assertTrue(
os.path.isfile(
os.path.join(init_dir, '.password-store', '.gpg-id')
)
)
self.assertEqual(
open(
os.path.join(init_dir, '.password-store', '.gpg-id'),
'r'
).read(),
'5C5833E3\n'
)
shutil.rmtree(init_dir)
def test_init_clone(self):
origin_dir = tempfile.mkdtemp()
destination_dir = tempfile.mkdtemp()
subprocess.Popen(
[
'git',
'--git-dir=%s' % os.path.join(origin_dir, '.git'),
'--work-tree=%s' % origin_dir,
'init',
origin_dir
],
shell=False
).wait()
open(os.path.join(origin_dir, 'test_git_init_clone.gpg'), 'a').close()
subprocess.Popen(
[
'git',
'--git-dir=%s' % os.path.join(origin_dir, '.git'),
'--work-tree=%s' % origin_dir,
'add', 'test_git_init_clone.gpg',
]
).wait()
subprocess.Popen(
[
'git',
'--git-dir=%s' % os.path.join(origin_dir, '.git'),
'--work-tree=%s' % origin_dir,
'commit',
'-m', '"testcommit"',
]
).wait()
# Init
PasswordStore.init(
path=destination_dir,
clone_url=origin_dir,
gpg_id='3CCC3A3A'
)
# The key should be imported
self.assertTrue(
os.path.isfile(
os.path.join(destination_dir, 'test_git_init_clone.gpg')
)
)
# The gpg-id file should be created
self.assertTrue(
os.path.isfile(
os.path.join(destination_dir, '.gpg-id')
)
)
shutil.rmtree(origin_dir)
shutil.rmtree(destination_dir)
def test_generate_password(self):
only_letters = PasswordStore.generate_password(
digits=False,
symbols=False
)
self.assertTrue(only_letters.isalpha())
alphanum = PasswordStore.generate_password(digits=True, symbols=False)
self.assertTrue(alphanum.isalnum())
for char in alphanum:
self.assertTrue(char not in string.punctuation)
length_100 = PasswordStore.generate_password(length=100)
self.assertEqual(len(length_100), 100)
pypass-0.2.1/pypass/tests/test_key_sec.asc 0000644 0001750 0001750 00000003577 13227722471 021142 0 ustar aviau aviau 0000000 0000000 -----BEGIN PGP PRIVATE KEY BLOCK-----
Version: GnuPG v1
lQHYBFRbvR8BBADv0+LbiIyJVz2f3BMB31332J5Gvdy9qGYxaxtyzLvpLTSVuVhB
mX96OkQUSRPjkORk+ji9/SBUEE0wNx0R3ndXKDymrda6pc393H/A+FxhctGckPdp
ArRdxzAcyAdNytgtVnSNOcSDpAedKfFG9vF5ERfH5KVGOK8EMnMoGQAweQARAQAB
AAP+L72oLTdzcmuRct8mUXsbg5j1ePOWm5KINVIy9plW1sYO77cjoHtj6vrqTnd1
pBlVvdwpq3hWFSXhl7WA7euxKZ/EoEJbrj97hxZjUupNy1tPzXkN0kymWRzIYFr2
mdRjwUW9X8gJyAYfHICbR3Utv8CAIduWOiqOtosPq83a1XkCAPGtB9gm2fP5J4b3
s/s6YSQ7tkyxfd6iRnKhffY7eRMgsjmo+uD9Ycym5U65G6n9HPFUFFXlAaJ+vYw5
Aou46HcCAP4Kz/N5yQGzbYyz8O92HIrOFYBzYLY/lOT90gxVBLwo3lXsoEBWGmz/
4v4xEHydS2aG3Qu/QJuCPR32MgCH2o8B/A6tghT+DIg15LzoREcB9LCS8mAb7haL
qeGsqF7hWNGr9cCp8A/SoB8/Pk2BEdDt8rd8j31PRZmajCkgRTQIX4OnKbQrcHlw
YXNzIHRlc3RpbmcgKHRlc3Rpbmcga2V5KSA8dGVzdEBrZXkuY29tPoi4BBMBAgAi
BQJUW70fAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRBQwMdEXFgz4yxu
BACh9qlN3eROxKOBgDebu9XYhI7lBAXjIh36FP9pQVmdINJ5E0a6ef2Ps5BtJjv3
7NxZa0O9jv76vXlk1Nr5PxbL7q6G6evB93P9rrVrx+lOIiezN+NPJMFe7mpAJdFw
/R3uUZYoAyKcvd8MvI0Qkx8PXa7tjgKcMuXAp9W80xwziZ0B2ARUW70fAQQAmTbt
oF6q2wFTeIR7HHlnrmy5ffeYx87tL8J3FUkdzvxUDxJBU8IjZLl3OHC08L4OarRV
hzZ3gs05DfT88ewWEf5cTVoZxB8DpLT+yt03J1GjFNI28DpJ4X1xzAOQ9Mt7yHhM
5xm6+zUcrL8uT4/VP4sXhAAmOQTOWTMZhVmTEjsAEQEAAQAD/iIZziDMATYWYPgp
cGdBhDiXvV9SjOAn57WiEDQeHnLTyXfDReP5CTyhZO4cc8FDY90O/xxFnKrxt1mq
ZeQIek61xKSovyM0sOIzPcq22xP9Eg/mbfkdm2742mkRQBTOV84tOf6F1su9LF6M
t0oAOD6SgBvgNT4D+3vXuqBb/51pAgDCsTsmGW3k/btgot1o6t0Yo08nC59+6Oo2
Cy9LW/Q8vfM9+TuyialtPayxpzSpRyqHaPOOU3fsNwg0qbluv69jAgDJdgsq1bLj
LEmXeOU4dFxDDf0RHQULS0Ns5kRXYOLaz+aaLP4hU9BEfr/eh8kmfLF2uxjyV+Nk
/0DcfGDx6GVJAgCrC7Usw+tp7Fazeyg3tfc2Ydrmr0BX0UDsQy8Uw+Ieah8Jmj6s
kLAv5+6R+8uwLA54iRPSpJ2pusSY+fYBQcxAoq2InwQYAQIACQUCVFu9HwIbDAAK
CRBQwMdEXFgz48MyA/96cafBG4tNaEGOcgNNOmzNQY+Esq/+hbAZgSudL8/ASvV1
pi2NJj128ni2Gv8ZODMRqwdmBDyv+y6oCDkbCfaoJfjmTaYiPKEaw0qVWNplmAOm
c/PLqm3neB5asdVbM53Gf3xLJnFPCaV7PURCbV+rzRISU7uT+HJS/fE4pwcyVQ==
=BZ6e
-----END PGP PRIVATE KEY BLOCK-----
pypass-0.2.1/pypass/tests/test_ownertrust.txt 0000644 0001750 0001750 00000000246 13227722471 022013 0 ustar aviau aviau 0000000 0000000 # List of assigned trustvalues, created Thu 06 Nov 2014 05:15:14 PM EST
# (Use "gpg --import-ownertrust" to restore them)
D3D7CF5C9A636C0D27E2DC0850C0C7445C5833E3:6:
pypass-0.2.1/pypass/tests/test_command.py 0000644 0001750 0001750 00000030144 13227722471 021006 0 ustar aviau aviau 0000000 0000000 #
# Copyright (C) 2014 Alexandre Viau
#
# This file is part of python-pass.
#
# python-pass 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 3 of the License, or
# (at your option) any later version.
#
# python-pass 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 python-pass. If not, see .
#
import os
import re
import shutil
import subprocess
import tempfile
import unittest
import click.testing
import pypass.command
import pypass.tests
from pypass.passwordstore import PasswordStore
class TestCommand(unittest.TestCase):
def run_cli(self, args, input=None):
args = ['--PASSWORD_STORE_DIR', self.dir] + list(args)
runner = click.testing.CliRunner()
result = runner.invoke(pypass.command.main, args, input=input)
return result
def setUp(self):
self.dir = tempfile.mkdtemp()
# .gpg_id file
with open(os.path.join(self.dir, '.gpg-id'), 'w') as gpg_id_file:
gpg_id_file.write('5C5833E3')
def tearDown(self):
shutil.rmtree(self.dir)
def test_init(self):
init_dir = tempfile.mkdtemp()
init_result = self.run_cli(
[
'init',
'-p', os.path.join(init_dir, '.password-store'),
'5C5833E3'
]
)
self.assertTrue(
os.path.isdir(os.path.join(init_dir, '.password-store'))
)
self.assertTrue(
os.path.isfile(
os.path.join(init_dir, '.password-store', '.gpg-id')
)
)
self.assertEqual(
open(
os.path.join(init_dir, '.password-store', '.gpg-id'),
'r'
).read(),
'5C5833E3\n'
)
self.assertEqual(
init_result.output,
'Password store initialized for 5C5833E3.\n'
)
shutil.rmtree(init_dir)
def test_insert_and_show(self):
# Insert a password for test.com
self.run_cli(
['insert', 'test.com'],
input='super_secret\nsuper_secret'
)
self.assertTrue(
os.path.isfile(os.path.join(self.dir, 'test.com.gpg'))
)
# Show the password for test.com
show_result = self.run_cli(
['show', 'test.com'],
input='super_secret\nsuper_secret'
)
self.assertEqual(show_result.output, 'super_secret\n')
def test_show_non_existing_password(self):
# Show the password for test.com
show_result = self.run_cli(
['show', 'test.com'],
)
self.assertEqual(show_result.output,
'Error: test.com is not in the password store.\n')
# Can't get xclip to work in Travis.
@pypass.tests.skipIfTravis
def test_show_clip(self):
store = PasswordStore(self.dir)
store.insert_password('clip_test', 'clipme999\nbutnotthisnewline\nfff')
show_result = self.run_cli(['show', '-c', 'clip_test'])
self.assertEqual(
show_result.output,
'Copied clip_test to clipboard.\n'
)
# Check if the password is in the clipoard
xclip = subprocess.Popen(
['xclip', '-o', '-selection', 'clipboard'],
stdout=subprocess.PIPE)
xclip.wait()
self.assertEqual(xclip.stdout.read().decode('utf8'), 'clipme999')
def test_edit_not_exist(self):
edit_result = self.run_cli(
['edit', 'woijewoifj.ccc']
)
self.assertEqual(
edit_result.output,
'woijewoifj.ccc is not in the password store.\n'
)
def test_ls(self):
# Create three dummy files
open(os.path.join(self.dir, 'linux.ca.gpg'), 'a').close()
open(os.path.join(self.dir, 'passwordstore.org.gpg'), 'a').close()
open(os.path.join(self.dir, 'test.com.gpg'), 'a').close()
ls_result = self.run_cli(['ls'])
expected_regex = \
"Password Store\s.*linux.ca\s.*passwordstore.org\s.*test.com"
self.assertIsNotNone(re.search(expected_regex, ls_result.output))
# By default, pypass should run the ls command
ls_default_result = self.run_cli([])
self.assertEqual(ls_result.output, ls_default_result.output)
def test_rm(self):
# Create one dummy file
dummy_file_path = os.path.join(self.dir, 'test.com.gpg')
with open(dummy_file_path, 'w') as dummy_file:
dummy_file.write('test.com')
self.assertTrue(os.path.isfile(dummy_file_path))
rm_result = self.run_cli(['rm', 'test.com'], input='y\n')
self.assertFalse(os.path.isfile(dummy_file_path))
self.assertIsNotNone(
re.match("Really remove .*test.com.gpg?", rm_result.output)
)
def test_rm_dont_exist(self):
result = self.run_cli(['rm', 'test.com'])
self.assertEqual(
result.output,
'Error: test.com is not in the password store.\n'
)
def test_rm_recursive(self):
folder_path = os.path.join(self.dir, 'test_folder')
os.mkdir(folder_path)
self.assertTrue(os.path.isdir(folder_path))
# Create three dummy files
open(os.path.join(folder_path, 'linux.ca.gpg'), 'a').close()
open(os.path.join(folder_path, 'passwordstore.org.gpg'), 'a').close()
open(os.path.join(folder_path, 'test.com.gpg'), 'a').close()
rm_result = self.run_cli(['rm', '-r', 'test_folder'], input='y\n')
self.assertFalse(os.path.isdir(folder_path))
self.assertIsNotNone(
re.match("Recursively remove .*test_folder?", rm_result.output)
)
def test_mv_file(self):
old_file_path = os.path.join(self.dir, 'move_me.gpg')
open(old_file_path, 'a').close()
self.assertTrue(os.path.isfile(old_file_path))
self.run_cli(['mv', 'move_me', 'i_moved'])
self.assertFalse(os.path.isfile(old_file_path))
self.assertTrue(os.path.isfile(os.path.join(self.dir, 'i_moved.gpg')))
def test_mv_folder(self):
folder_path = os.path.join(self.dir, 'test_folder')
os.mkdir(folder_path)
self.assertTrue(os.path.isdir(folder_path))
# Create three dummy files
open(os.path.join(folder_path, 'linux.ca.gpg'), 'a').close()
open(os.path.join(folder_path, 'passwordstore.org.gpg'), 'a').close()
open(os.path.join(folder_path, 'test.com.gpg'), 'a').close()
self.run_cli(['mv', 'test_folder', 'moved_folder'])
self.assertFalse(os.path.isdir(folder_path))
self.assertTrue(os.path.isdir(os.path.join(self.dir, 'moved_folder')))
def test_mv_error(self):
mv_result = self.run_cli(['mv', 'test_folder', 'moved_folder'])
self.assertEqual(
mv_result.output,
'Error: test_folder is not in the password store\n'
)
def test_cp_file(self):
old_file_path = os.path.join(self.dir, 'copy_me.gpg')
open(old_file_path, 'a').close()
self.assertTrue(os.path.isfile(old_file_path))
self.run_cli(['cp', 'copy_me', 'i_was_copied'])
self.assertTrue(os.path.isfile(old_file_path))
self.assertTrue(
os.path.isfile(os.path.join(self.dir, 'i_was_copied.gpg'))
)
def test_cp_folder(self):
folder_path = os.path.join(self.dir, 'test_folder')
os.mkdir(folder_path)
self.assertTrue(os.path.isdir(folder_path))
# Create three dummy files
open(os.path.join(folder_path, 'linux.ca.gpg'), 'a').close()
open(os.path.join(folder_path, 'passwordstore.org.gpg'), 'a').close()
open(os.path.join(folder_path, 'test.com.gpg'), 'a').close()
self.run_cli(['cp', 'test_folder', 'copied_folder'])
self.assertTrue(os.path.isdir(folder_path))
self.assertTrue(os.path.isdir(os.path.join(self.dir, 'copied_folder')))
def test_cp_error(self):
mv_result = self.run_cli(['cp', 'test_folder', 'moved_folder'])
self.assertEqual(
mv_result.output,
'Error: test_folder is not in the password store\n'
)
def test_find(self):
# Create dummy files
open(os.path.join(self.dir, 'linux.ca.gpg'), 'a').close()
open(os.path.join(self.dir, 'passwordstore.org.gpg'), 'a').close()
open(os.path.join(self.dir, 'test.com.gpg'), 'a').close()
open(os.path.join(self.dir, 'vv.com.gpg'), 'a').close()
open(os.path.join(self.dir, 'zz.com.gpg'), 'a').close()
find_result = self.run_cli(['find', 'pass', 'vv'])
expected_regex = \
"Search\sTerms:\spass,vv\s.*passwordstore.org\s.*vv.com"
self.assertIsNotNone(re.search(expected_regex, find_result.output))
def test_grep(self):
store = PasswordStore(self.dir)
store.insert_password('grep_test.com', 'GREPME')
grep_result = self.run_cli(['grep', 'GREPME'])
self.assertEqual(
grep_result.output,
'grep_test.com:\nGREPME\n'
)
def test_git_init(self):
self.run_cli(['git', 'init'])
# git init should add a .gitattributes file
self.assertEqual(
open(os.path.join(self.dir, '.gitattributes'), 'r').read(),
'*.gpg diff=gpg\n'
)
# git init should set diff.gpg.binary to True
diff_gpg_binary = subprocess.Popen(
[
'git',
'--git-dir=%s' % os.path.join(self.dir, '.git'),
'--work-tree=%s' % self.dir,
'config',
'--local',
'diff.gpg.binary'
],
shell=False,
stdout=subprocess.PIPE
)
diff_gpg_binary.wait()
self.assertEqual(diff_gpg_binary.stdout.read().decode(), 'true\n')
# git init should set diff.gpg.textconv to 'gpg -d'
gpg = subprocess.Popen(
[
'git',
'--git-dir=%s' % os.path.join(self.dir, '.git'),
'--work-tree=%s' % self.dir,
'config',
'--local',
'diff.gpg.textconv'
],
shell=False,
stdout=subprocess.PIPE
)
gpg.wait()
self.assertEqual(gpg.stdout.read().decode(), 'gpg -d\n')
def test_init_clone(self):
# Setup origin repo
origin_dir = tempfile.mkdtemp()
origin_git_dir = os.path.join(origin_dir, '.git')
subprocess.Popen(
[
'git',
'--git-dir=%s' % origin_git_dir,
'--work-tree=%s' % origin_dir,
'init',
origin_dir
],
shell=False
).wait()
open(os.path.join(origin_dir, 'test_git_init_clone.gpg'), 'a').close()
subprocess.call(
[
'git',
'--git-dir=%s' % origin_git_dir,
'--work-tree=%s' % origin_dir,
'add', 'test_git_init_clone.gpg',
]
)
subprocess.call(
[
'git',
'--git-dir=%s' % origin_git_dir,
'--work-tree=%s' % origin_dir,
'commit',
'-m', '"testcommit"',
]
)
# Init
self.run_cli(
[
'init',
'--path', self.dir,
'--clone', origin_dir,
'TEST_GPG_ID'
]
)
# The key should be imported
self.assertTrue(
os.path.isfile(
os.path.join(self.dir, 'test_git_init_clone.gpg')
)
)
# The gpg-id file should be created
self.assertTrue(
os.path.isfile(
os.path.join(self.dir, '.gpg-id')
)
)
pypass-0.2.1/docs/ 0000755 0001750 0001750 00000000000 13227723055 014223 5 ustar aviau aviau 0000000 0000000 pypass-0.2.1/docs/source/ 0000755 0001750 0001750 00000000000 13227723055 015523 5 ustar aviau aviau 0000000 0000000 pypass-0.2.1/docs/source/API.rst 0000644 0001750 0001750 00000000152 13227722471 016665 0 ustar aviau aviau 0000000 0000000 API
===
.. autoclass:: pypass.PasswordStore
:members:
.. autoclass:: pypass.EntryType
:members:
pypass-0.2.1/docs/source/manpage.rst 0000644 0001750 0001750 00000033631 13227722471 017674 0 ustar aviau aviau 0000000 0000000 Manpage
=======
Synopsis
--------
pypass [COMMAND] [OPTIONS] [ARGS]
Description
-----------
pypass is a Python implementation of pass, a very simple password store that keeps passwords inside gpg2(1) encrypted files inside a simple directory tree residing at ~/.password-store. The pyppass utility provides a series of commands for manipulating the password store, allowing the user to add, remove, edit, synchronize, generate, and manipulate passwords.
If no COMMAND is specified, COMMAND defaults to either show or ls, depending on the type of specifier in ARGS. Otherwise COMMAND must be one of the valid commands listed below.
Several of the commands below rely on or provide additional functionality if the password store directory is also a git repository. If the password store directory is a git repository, all password store modification commands will cause a corresponding git commit. See the EXTENDED GIT EXAMPLE section for a detailed description using init and git(1).
The init command must be run before other commands in order to initialize the password store with the correct gpg key id. Passwords are encrypting using the gpg key set with init.
Commands
--------
init [ --path=sub-folder, -p sub-folder ] gpg-id...
Initialize new password storage and use gpg-id for encryption. Multiple gpg-ids may be specified, in order to encrypt each password with multiple ids. This command must be run first before a password store can be used. If the specified gpg-id is different from the key used in any existing files, these files will be reencrypted to use the new id. Note that use of gpg-agent(1) is recommended so that the batch decryption does not require as much user intervention. If --path or -p is specified, along with an argument, a specific gpg-id or set of gpg-ids is assigned for that specific subfolder of the password store. If only one gpg-id is given, and it is an empty string, then the current .gpg-id file for the specified sub-folder (or root if unspecified) is removed.
ls subfolder
List names of passwords inside the tree at subfolder by using the tree(1) program.
grep search-string
Searches inside each decrypted password file for search-string, and displays line containing matched string along with filename. Uses grep(1) for matching. Make use of the GREP_OPTIONS environment variable to set particular options.
find pass-names...
List names of passwords inside the tree that match pass-names by using the tree(1) program.
show [ --clip, -c ] pass-name
Decrypt and print a password named pass-name. If --clip or -c is specified, do not print the password but instead copy the first line to the clipboard using xclip(1) and then restore the clipboard after 45 (or PASSWORD_STORE_CLIP_TIME) seconds.
insert [ --multiline, -m ] [ --force, -f ] pass-name
Insert a new password into the password store called pass-name. If --multiline or -m is specified, the default text editor specified by the environment variable EDITOR, or editor(1) as a fallback, will be opened and the password will be inserted after the editor exits. Otherwise, a prompt will ask for the password until correctly typed twice. Prompt before overwriting an existing password, unless --force or -f is specified.
edit pass-name
Edit an existing password using the default text editor specified by the environment variable EDITOR or using editor(1) as a fallback. This mode makes use of temporary files for editing, but care is taken to ensure that temporary files are created in /dev/shm in order to avoid writing to difficult-to-erase disk sectors. If /dev/shm is not accessible, fallback to the ordinary TMPDIR location, and print a warning.
generate [ --no-symbols, -n ] [ --clip, -c ] [ --in-place, -i | --force, -f ] pass-name pass-length
Generate a new password using pwgen(1) of length pass-length and insert into pass-name. If --no-symbols or -n is specified, do not use any non-alphanumeric characters in the generated password. If --clip or -c is specified, do not print the password but instead copy it to the clipboard using xclip(1) and then restore the clipboard after 45 (or PASSWORD_STORE_CLIP_TIME) seconds. Prompt before overwriting an existing password, unless --force or -f is specified. If --in-place or -i is specified, do not interactively prompt, and only replace the first line of the password file with the new generated password, keeping the remainder of the file intact.
rm [ --recursive, -r ] [ --force, -f ] pass-name
Remove the password named pass-name from the password store. This command is alternatively named remove or delete. If --recursive or -r is specified, delete pass-name recursively if it is a directory. If --force or -f is specified, do not interactively prompt before removal.
mv [ --force, -f ] old-path new-path
Renames the password or directory named old-path to new-path. This command is alternatively named rename. If --force is specified, silently overwrite new-path if it exists. If new-path ends in a trailing /, it is always treated as a directory. Passwords are selectively reencrypted to the corresponding keys of their new destination.
cp [ --force, -f ] old-path new-path
Copies the password or directory named old-path to new-path. This command is alternatively named copy. If --force is specified, silently overwrite new-path if it exists. If new-path ends in a trailing /, it is always treated as a directory. Passwords are selectively reencrypted to the corresponding keys of their new destination.
git git-command-args...
If the password store is a git repository, pass git-command-args as arguments to git(1) using the password store as the git repository. If git-command-args is init, in addition to initializing the git repository, add the current contents of the password store to the repository in an initial commit. If the git config key pass.signcommits is set to true, then all commits will be signed using user.signingkey or the default git signing key. This config key may be turned on using: `pass git config --bool --add pass.signcommits true`
help
Shows usage message.
Version
Shows version information
Simple Examples
---------------
Initialize password store
::
zx2c4@laptop ~ $ pass init Jason@zx2c4.com
mkdir: created directory ‘/home/zx2c4/.password-store’
Password store initialized for Jason@zx2c4.com.
List existing passwords in store
::
zx2c4@laptop ~ $ pypass
Password Store
├── Business
│ ├── some-silly-business-site.com
│ └── another-business-site.net
├── Email
│ ├── donenfeld.com
│ └── zx2c4.com
└── France
├── bank
├── freebox
└── mobilephone
Alternatively, "pypass ls".
Find existing passwords in store that match .com
::
zx2c4@laptop ~ $ pypass find .com
Search Terms: .com
├── Business
│ ├── some-silly-business-site.com
└── Email
├── donenfeld.com
└── zx2c4.com
Alternatively, "pypass search .com".
Show existing password
::
zx2c4@laptop ~ $ pypass Email/zx2c4.com
sup3rh4x3rizmynam3
Copy existing password to clipboard
::
zx2c4@laptop ~ $ pypass -c Email/zx2c4.com
Copied Email/jason@zx2c4.com to clipboard. Will clear in 45 seconds.
Add password to store
::
zx2c4@laptop ~ $ pypass insert Business/cheese-whiz-factory
Enter password for Business/cheese-whiz-factory: omg so much cheese
what am i gonna do
Add multiline password to store
::
zx2c4@laptop ~ $ pypass insert -m Business/cheese-whiz-factory
Enter contents of Business/cheese-whiz-factory and press Ctrl+D when
finished:
Hey this is my
awesome
multi
line
passworrrrrrrrd.
^D
Generate new password
::
zx2c4@laptop ~ $ pypass generate Email/jasondonenfeld.com 15
The generated password to Email/jasondonenfeld.com is:
$(-QF&Q=IN2nFBx
Generate new alphanumeric password
::
zx2c4@laptop ~ $ pypass generate -n Email/jasondonenfeld.com 12
The generated password to Email/jasondonenfeld.com is:
YqFsMkBeO6di
Generate new password and copy it to the clipboard
::
zx2c4@laptop ~ $ pypass generate -c Email/jasondonenfeld.com 19
Copied Email/jasondonenfeld.com to clipboard. Will clear in 45 sec‐
onds.
Remove password from store
::
zx2c4@laptop ~ $ pypass remove Business/cheese-whiz-factory
rm: remove regular file ‘/home/zx2c4/.password-store/Business/cheese-
whiz-factory.gpg’? y
removed ‘/home/zx2c4/.password-store/Business/cheese-whiz-factory.gpg’
Extended Git Example
--------------------
Here, we initialize new password store, create a git repository, and then manipulate and sync passwords. Make note of the arguments to the first call of pass git push; consult git-push(1) for more information.
zx2c4@laptop ~ $ pypass init Jason@zx2c4.com
::
mkdir: created directory ‘/home/zx2c4/.password-store’
Password store initialized for Jason@zx2c4.com.
zx2c4@laptop ~ $ pypass git init
::
Initialized empty Git repository in /home/zx2c4/.password-store/.git/
[master (root-commit) 998c8fd] Added current contents of password store.
1 file changed, 1 insertion(+)
create mode 100644 .gpg-id
zx2c4@laptop ~ $ pypass git remote add origin kexec.com:pass-store
zx2c4@laptop ~ $ pypass generate Amazon/amazonemail@email.com 21
::
mkdir: created directory ‘/home/zx2c4/.password-store/Amazon’
[master 30fdc1e] Added generated password for Amazon/amazonemail@email.com
to store.
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 Amazon/amazonemail@email.com.gpg
The generated password to Amazon/amazonemail@email.com is:
<5m,_BrZY`antNDxKN<0A
zx2c4@laptop ~ $ pypass git push -u --all
::
Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 921 bytes, done.
Total 4 (delta 0), reused 0 (delta 0)
To kexec.com:pass-store
* [new branch] master -> master
Branch master set up to track remote branch master from origin.
zx2c4@laptop ~ $ pypass insert Amazon/otheraccount@email.com
::
Enter password for Amazon/otheraccount@email.com:
som3r3a11yb1gp4ssw0rd!!88**
[master b9b6746] Added given password for Amazon/otheraccount@email.com to
store.
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 Amazon/otheraccount@email.com.gpg
zx2c4@laptop ~ $ pypass rm Amazon/amazonemail@email.com
::
rm: remove regular file ‘/home/zx2c4/.password-store/Amazon/amazone‐
mail@email.com.gpg’? y
removed ‘/home/zx2c4/.password-store/Amazon/amazonemail@email.com.gpg’
rm 'Amazon/amazonemail@email.com.gpg'
[master 288b379] Removed Amazon/amazonemail@email.com from store.
1 file changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 Amazon/amazonemail@email.com.gpg
zx2c4@laptop ~ $ pypass git push
::
Counting objects: 9, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (7/7), 1.25 KiB, done.
Total 7 (delta 0), reused 0 (delta 0)
To kexec.com:pass-store
Files
-----
~/.password-store
The default password storage directory.
~/.password-store/.gpg-id
Contains the default gpg key identification used for encryption and decryption. Multiple gpg keys may be specified in this file, one per line. If this file exists in any sub directories, passwords inside those sub directories are encrypted using those keys. This should be set using the init command.
Environement Variables
---------------------
PASSWORD_STORE_DIR
Overrides the default password storage directory.
PASSWORD_STORE_KEY
Overrides the default gpg key identification set by init. Keys must not contain spaces and thus use of the hexidecimal key signature is recommended. Multiple keys may be specified separated by spaces.
PASSWORD_STORE_GIT
Overrides the default root of the git repository, which is helpful if PASSWORD_STORE_DIR is temporarily set to a sub-directory of the default password store.
PASSWORD_STORE_CLIP_TIME
Specifies the number of seconds to wait before restoring the clipboard, by default 45 seconds.
PASSWORD_STORE_UMASK
Sets the umask of all files modified by pypass, by default 077.
EDITOR
The location of the text editor used by edit.
See Also
--------
:manpage:`gpg2(1)`, :manpage:`git(1)`, :manpage:`xclip(1)`.
Author
------
pypass was written by Alexandre Viau . For updates and more information, a project page is available on the World Wide Web (https://github.com/ReAzem/python-pass).
pass was written by Jason A. Donenfeld ⟨Jason@zx2c4.com⟩. For updates and more information, a project page is available on the World Wide Web ⟨http://www.passwordstore.org/⟩.
Copying
-------
python-pass 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 3 of the License, or(at your option) any later version.
python-pass 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 python-pass. If not, see .
pypass-0.2.1/docs/source/conf.py 0000644 0001750 0001750 00000003705 13227722471 017030 0 ustar aviau aviau 0000000 0000000 # -*- coding: utf-8 -*-
import os
import sys
import sphinx_rtd_theme
sys.path.insert(0, os.path.abspath('../..'))
# -- General configuration ----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc']
# autodoc generation is a bit aggressive and a nuisance when doing heavy
# text edit cycles.
# execute "export SPHINX_DEBUG=1" in your terminal to disable
# The suffix of source filenames.
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'pypass'
# copyright = u'2014, Alexandre Viau'
# If true, '()' will be appended to :func: etc. cross-reference text.
add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
add_module_names = True
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# -- Options for HTML output --------------------------------------------------
# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
# Output file base name for HTML help builder.
htmlhelp_basename = '%sdoc' % project
# -- Options for manual page output -------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(
'manpage',
'pypass',
u'stores, retrieves, generates, and synchronizes passwords securely',
[],
1
)
]
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'http://docs.python.org/': None}
pypass-0.2.1/docs/source/introduction.rst 0000644 0001750 0001750 00000000036 13227722471 020776 0 ustar aviau aviau 0000000 0000000 .. include:: ../../README.rst
pypass-0.2.1/docs/source/index.rst 0000644 0001750 0001750 00000000131 13227722471 017360 0 ustar aviau aviau 0000000 0000000 python-pass
===========
.. toctree::
:maxdepth: 2
introduction
API
manpage
pypass-0.2.1/PKG-INFO 0000644 0001750 0001750 00000000373 13227723055 014373 0 ustar aviau aviau 0000000 0000000 Metadata-Version: 1.0
Name: pypass
Version: 0.2.1
Summary: Pass in python
Home-page: https://github.com/ReAzem/python-pass
Author: Alexandre Viau
Author-email: alexandre@alexandreviau.net
License: UNKNOWN
Description: Pass in python
Platform: UNKNOWN
pypass-0.2.1/.travis.yml 0000644 0001750 0001750 00000001141 13227722471 015402 0 ustar aviau aviau 0000000 0000000 language: python
env:
- TOX_ENV=py27
# - TOX_ENV=py32
# - TOX_ENV=py33
- TOX_ENV=py34
# - TOX_ENV=pypy
# - TOX_ENV=pypy3
- TOX_ENV=flake8
- TOX_ENV=docs
- TOX_ENV=coverage
install:
- sudo apt-get install -y gnupg2
- make setup_gpg
- git config --global user.email "you@example.com"
- git config --global user.name "Your Name"
- sudo apt-get install -y tree
- sudo pip install tox
- sudo pip install coveralls
script:
- tox -e $TOX_ENV
after_success:
- if [ "$TOX_ENV" == "coverage" ] ; then coveralls; fi
notifications:
email: false
pypass-0.2.1/setup.cfg 0000644 0001750 0001750 00000000514 13227723055 015114 0 ustar aviau aviau 0000000 0000000 [metadata]
name = pypass
author = Alexandre Viau
author-email = alexandre@alexandreviau.net
home-page = https://github.com/ReAzem/python-pass
description-file = README.rst
description = Pass in python
[files]
packages = pypass
[entry_points]
console_scripts =
pypass = pypass.command:main
[egg_info]
tag_build =
tag_date = 0
pypass-0.2.1/ChangeLog 0000644 0001750 0001750 00000011053 13227723055 015045 0 ustar aviau aviau 0000000 0000000 CHANGES
=======
0.2.1
-----
* Create subdirectories if specified in password path (#14)
* Fix decrypted typo. (#12)
* Isolate gpg in tests (#13)
* setup.cfg: spaces around '='
* Check if hostname is None before return
0.2.0
-----
* Git commit on password edit
* Update setup.cfg
0.1.0
-----
* PEP8 fix
* Added error on unexisting password show
* Added connect to bash completion
* Added basic connect command
* Added hostname entry to get\_decrypted\_password
* Added EntryType enum to doc
* Added docs-requirements.txt for RTD
* Changed doc badge link
* Disabled installation of bash completion with setup.py
* Changed completion dir
* Adapted bash completion for pypass
* Imported pass.bash-completion
* requirements: enum -> enum34
* Refactored get\_decypted\_password: Now use EntryType enum
* Added bash completion in todo
* Refactored python package
* Flake8 fix
* Fixed flake8
* Added only\_usr and only\_pwd options to get\_decrypted\_password
* Updated todo
* Improved documentation
* Added help command
* Hide password during insert
* Fixed flake8
* python3 fixes
* Added generate\_password method to PasswordStore
* Fix xclip-related tests on Travis
* Added xclip to Travis
* Added -c, --clip option to show command
* Fixed typo
* Updated TODO
* Improved API documentation
* Added generate command to TODO
* Added grep to project status
* Added grep command
* Added grep command
* added test\_edit\_not\_exist
* Added edit command
* Support multi-line inserts
* Fixed wrong git work tree on 'pypass git [command]'
* .gpg-id should have a newline - fixed #3
* No longer alter env variables
* Added git\_init to PasswordStore
* Ask for confirmation on rm
* Find the right gpg binary
* fixed uses\_git
* Moved git\_add\_and\_commit to PasswordStore
* Added test\_init
* Rename: test\_git\_init\_clone -> test\_init\_clone
* Fixed issue on init
* Added test\_init
* Moved init from Command.py to PasswordStore
* Added test\_encrypt\_decrypt
* Added get\_decrypted\_password and insert\_password
* test\_get\_passwords\_list: fixed sorting issues
* Implemented get\_passwords\_list
* updated todo
* Removed docs-requirements.txt from Dockrefile
* Refactored tox.ini
* Added API autodoc
* document the API
* PasswordStore: Added test\_init
* fixed flake8
* Added cp command
* Mention that pypass will be a lib
* Fixed flake8
* Introduced PasswordStore class
* documented --clone
* Added test for init --clone
* Make tests verbose
* Override GIT\_DIR and GIT\_WORK\_TREE in init
* Fixed tests for PR#2
* Add init clone
* Commit after insert
* Configure git in travis
* Added tests for git init
* Fixed flake8
* Implemented git init
* Removed useless space
* Added info for documentation
* Added PASSWORD\_STORE\_GIT env var parameter
* Improved find and ls outputs
* Init outputs 'Password store initialized for [gpg-id]'
* Removed .gpg of find output
* Avoid capturing stderr
* Added git command
* Updated todo list
* gpg -> gpg2
* Manpage: pass -> pypass
* Manpage: pass -> pypass
* Added pypi version badge
* Added git examples to manpage
* imported simple examples from pass
* include readme in readthedocs
* Import pass manpage
* Fixed docs in Docker
* Changed readthedocs link
* Build docs in tox + fixed flake
* Added readthedocs badge
* Added docs-requiresments.txt for rtd
* Now build documentation and manpage
* Remove .gpg in ls output
* Added vim to Dockerfile
* Fixed issue on tree<1.5
* Fixed error on tree <1.7
* Added testing documentation
* Added mv command
* Dockerfile: Fixed python3 tests
* Added Dockerfile
* Added properties to setup.cfg
* Added more things in TODO
* Improved find pattern
* fixed typo
* Added find command
* Added subfolder argument to ls
* Added -r, --recursive options to rm
* Create dummy files in one line
* Invoke ls by default
* Removed useless lines
* Added rm command
* Added README to dist
* Fixed typo
* Update and rename README.md to README.rst
* added tree to travis
* cosmetic fix
* Added show command
* Added todo for pypyass insert
* gpg2 -> gpg
* Added show command
* Fixed pypy
* gpg --import-ownertrust
* Check for gpg errors
* Text py27 and py34 by default
* gpg\_id -> gpg-id + read gpg-id file
* fixed python3
* Added gpg key for testing
* Added gnupg to travis
* Removed debug strings
* Added pypass insert tests
* Progress on pypass insert
* Update README.md
* Update and rename README.rst to README.md
* Fixed tests with pypy
* flake8 fix
* Added travis and coveralls badges
* Changed README to .rst
* Fixed cover package
* Added test for init
* Create README.md
* Added init command
* Added pypass command
* Added setup.py
* Added tox.ini
* Added .travis.yml
* Initial commit
pypass-0.2.1/LICENSE 0000644 0001750 0001750 00000104462 13227722471 014310 0 ustar aviau aviau 0000000 0000000 GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{one line to give the program's name and a brief idea of what it does.}
Copyright (C) {year} {name of author}
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 3 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, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
{project} Copyright (C) {year} {fullname}
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
pypass-0.2.1/tox.ini 0000644 0001750 0001750 00000001417 13227722471 014612 0 ustar aviau aviau 0000000 0000000 [tox]
envlist = py34, py27, pypy, flake8, docs
[testenv]
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = nosetests -v
passenv = HOME DISPLAY TRAVIS
setenv = GNUPGHOME=pypass/tests/gnupg
[testenv:flake8]
deps = flake8
pep8-naming
commands = flake8
[testenv:coverage]
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
coverage
commands = nosetests -v --with-coverage --cover-html --cover-package=pypass
[testenv:docs]
deps = -r{toxinidir}/docs-requirements.txt
commands =
sphinx-build -b html docs/source docs/build/html
sphinx-build -b man docs/source docs/build/man
[flake8]
exclude = env,.git,.tox,*.egg,build
ignore = N802
# N802 - Ignored because of nose's setUp function
pypass-0.2.1/Dockerfile 0000644 0001750 0001750 00000001612 13227722471 015266 0 ustar aviau aviau 0000000 0000000 FROM debian:testing
# Click needs this for python3 support
ENV LC_ALL C.UTF-8
ENV LANG C.UTF-8
# Skip the same tests as Travis
ENV TRAVIS true
RUN apt-get update && apt-get install -y vim git python-pip tree xclip gnupg2 python3 pypy
RUN pip install tox
RUN git config --global user.email "you@example.com"
RUN git config --global user.name "Your Name"
ADD pypass pypass/pypass
ADD docs pypass/docs
ADD setup.py pypass/setup.py
ADD setup.cfg pypass/setup.cfg
ADD requirements.txt pypass/requirements.txt
ADD test-requirements.txt pypass/test-requirements.txt
ADD README.rst pypass/README.rst
ADD tox.ini pypass/tox.ini
ADD .git pypass/.git
# Install testing gpg key
RUN gpg --allow-secret-key-import --import pypass/pypass/tests/test_key_sec.asc
RUN gpg --import-ownertrust pypass/pypass/tests/test_ownertrust.txt
RUN pip install -r pypass/requirements.txt
RUN cd pypass && python setup.py install
pypass-0.2.1/Makefile 0000644 0001750 0001750 00000001171 13227722471 014734 0 ustar aviau aviau 0000000 0000000 .PHONY: build kill setup_gpg
build:
sudo docker build -t pypass_image .
kill:
- sudo docker stop pypass
- sudo docker rm pypass
run: kill build
sudo docker run -i -t --name pypass pypass_image bash
test: kill build
sudo docker run -t --name pypass pypass_image bash -c "cd pypass && tox"
setup_gpg: pypass/tests/gnupg
pypass/tests/gnupg: pypass/tests/test_key_sec.asc pypass/tests/test_ownertrust.txt
mkdir -m 700 -p pypass/tests/gnupg
GNUPGHOME=pypass/tests/gnupg gpg --allow-secret-key-import --import pypass/tests/test_key_sec.asc
GNUPGHOME=pypass/tests/gnupg gpg --import-ownertrust pypass/tests/test_ownertrust.txt
pypass-0.2.1/setup.py 0000644 0001750 0001750 00000001533 13227722471 015010 0 ustar aviau aviau 0000000 0000000 #
# Copyright (C) 2014 Alexandre Viau
#
# This file is part of python-pass.
#
# python-pass 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 3 of the License, or
# (at your option) any later version.
#
# python-pass 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 python-pass. If not, see .
#
import setuptools
setuptools.setup(
setup_requires=['pbr'],
pbr=True,
)
pypass-0.2.1/test-requirements.txt 0000644 0001750 0001750 00000000005 13227722471 017530 0 ustar aviau aviau 0000000 0000000 nose
pypass-0.2.1/AUTHORS 0000644 0001750 0001750 00000000366 13227723055 014350 0 ustar aviau aviau 0000000 0000000 Alexandre Viau
Low Kian Seong
Matthias Dellweg
Thibault Cohen
aviau
rene
toXel
pypass-0.2.1/requirements.txt 0000644 0001750 0001750 00000000036 13227722471 016557 0 ustar aviau aviau 0000000 0000000 click
colorama
enum34
pexpect