marcwebbie / passpie

:closed_lock_with_key: Multiplatform command-line password manager
http://passpie.readthedocs.org/
MIT License
921 stars 68 forks source link

Exceptions raising from error on `--pattern` regex #84

Closed marcwebbie closed 8 years ago

marcwebbie commented 8 years ago

When adding a credential using a regex pattern, it raises a traceback for errors in the regex.

passpie add foo@example.com --random --pattern "[a-z]{10} [A-Z]{10} [0-9]{10} [\-\_\+\=\*\&\%\$\#\@\!\?\.\]{10}"                                                                                                                                                                                                ::
Password for 'https://...@github.org':
Traceback (most recent call last):
  File "/usr/local/Cellar/passpie/1.1.1/libexec/bin/passpie", line 9, in <module>
    load_entry_point('passpie==1.1.1', 'console_scripts', 'passpie')()
  File "/usr/local/Cellar/passpie/1.1.1/libexec/vendor/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/Cellar/passpie/1.1.1/libexec/vendor/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/Cellar/passpie/1.1.1/libexec/vendor/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/Cellar/passpie/1.1.1/libexec/vendor/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/Cellar/passpie/1.1.1/libexec/vendor/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/Cellar/passpie/1.1.1/libexec/vendor/lib/python2.7/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/usr/local/Cellar/passpie/1.1.1/libexec/vendor/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/Cellar/passpie/1.1.1/libexec/lib/python2.7/site-packages/passpie/cli.py", line 182, in add
    password = genpass(pattern=pattern)
  File "/usr/local/Cellar/passpie/1.1.1/libexec/lib/python2.7/site-packages/passpie/utils.py", line 17, in genpass
    return rstr.xeger(pattern)
  File "/usr/local/Cellar/passpie/1.1.1/libexec/vendor/lib/python2.7/site-packages/rstr/xeger.py", line 63, in xeger
    parsed = re.sre_parse.parse(pattern)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sre_parse.py", line 716, in parse
    p = _parse_sub(source, pattern, 0)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sre_parse.py", line 324, in _parse_sub
    itemsappend(_parse(source, state))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sre_parse.py", line 450, in _parse
    raise error, "unexpected end of regular expression"
sre_constants.error: unexpected end of regular expression