this is dumb.

This commit is contained in:
brent s 2020-04-03 16:06:01 -04:00
parent f957ad49b9
commit 9c2b26bf7f
Signed by: bts
GPG Key ID: 8C004C2F93481F6B
3 changed files with 183 additions and 7 deletions

View File

@ -367,7 +367,7 @@ Per the Pass man page:
If no COMMAND is specified, COMMAND defaults to either show or ls, depending on the type of specifier in ARGS. Alternatively, if PASSWORD_STORE_ENABLE_EXTENSIONS is set to "true", and the file .extensions/COMMAND.bash exists inside the password store and is executable, then it is sourced into the environment, passing any arguments and environment variables. Extensions existing in a system-wide directory, only installable by the administrator, are always enabled. If no COMMAND is specified, COMMAND defaults to either show or ls, depending on the type of specifier in ARGS. Alternatively, if PASSWORD_STORE_ENABLE_EXTENSIONS is set to "true", and the file .extensions/COMMAND.bash exists inside the password store and is executable, then it is sourced into the environment, passing any arguments and environment variables. Extensions existing in a system-wide directory, only installable by the administrator, are always enabled.
.... ....


Due to this being Python, we lose some of this compatability. It may be possible to add this functionality in the Due to this being Python, we lose some of this compatibility. It may be possible to add this functionality in the
future, but it's lower priority currently. future, but it's lower priority currently.


Similarly, we cannot set a default subcommand as of yet in Python via `argparse` (the library that VaultPass uses to Similarly, we cannot set a default subcommand as of yet in Python via `argparse` (the library that VaultPass uses to
@ -440,7 +440,11 @@ Pass (and to a slightly lesser extent, Vault) relies almost entirely/exclusively
configuration. VaultPass does not. configuration. VaultPass does not.


==== Workaround(s) ==== Workaround(s)
Relying entirely on environment variables for configuration is dumb, so I don't rely on that. All persistent Relying entirely on environment variables for configuration is dumb, so I don't do on that. All persistent
configuration can be either specified in the <<configuration,configuration file>> or can be overridden by configuration can be either specified in the <<configuration,configuration file>> or can be overridden by
flags/switches to subcommands. **Some** configuration directives/behaviour may be overridden by environment variables, flags/switches to subcommands. **Some** configuration directives/behaviour may be overridden by environment variables
but by and large this is not the case. where supported by Vault/Pass upstream configuration.


== Submitting a Bug Report/Feature Request
Please use https://bugs.square-r00t.net/index.php?do=newtask&project=13[my bugtracker^].

View File

@ -88,7 +88,7 @@ def parseArgs():
dest = 'chars', dest = 'chars',
default = constants.SELECTED_PASS_CHARS, default = constants.SELECTED_PASS_CHARS,
help = ('The characters to use when generating a password (symbols included). ' help = ('The characters to use when generating a password (symbols included). '
'Default: {0}').format(constants.SELECTED_PASS_CHARS)) 'Default: {0}').format(constants.SELECTED_PASS_CHARS.replace('%', '%%')))
gen.add_argument('-Cn', '--characters-no-symbols', gen.add_argument('-Cn', '--characters-no-symbols',
dest = 'chars_plain', dest = 'chars_plain',
default = constants.SELECTED_PASS_NOSYMBOL_CHARS, default = constants.SELECTED_PASS_NOSYMBOL_CHARS,
@ -113,7 +113,177 @@ def parseArgs():
gen.add_argument('length', gen.add_argument('length',
type = int, type = int,
default = constants.GENERATED_LENGTH, default = constants.GENERATED_LENGTH,
nargs = '?',
metavar = 'LENGTH', metavar = 'LENGTH',
help = ('The length (number of characters) in the generated password. ' help = ('The length (number of characters) in the generated password. '
'Default: {0}').format(constants.GENERATED_LENGTH)) 'Default: {0}').format(constants.GENERATED_LENGTH))
# GIT
git.add_argument('dummy_opts',
nargs = '+',
default = None,
metavar = 'dummy',
help = ('(Unused; kept for compatibility reasons)'))
# GREP
# I wish argparse supported arbitrary arguments.
# It *KIND* of does: https://stackoverflow.com/a/37367814/733214 but then I wouldn't be able to properly grab the
# regex pattern without more hackery. So here's to wasting my life.
## DUMMY OPTIONS ##
####################################################################################################################
grep.add_argument('-V', '--version',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-E', '--extended-regexp',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-F', '--fixed-strings',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-G', '--basic-regexp',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-P', '--perl-regexp',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-i', '--ignore_case',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('--no-ignore-case',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-v', '--invert-match',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-w', '--word-regexp',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-x', '--line-regexp',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-y',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-c', '--count',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-L', '--files-without-match',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-l', '--files-with-matches',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-o', '--only-matching',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-q', '--quiet', '--silent',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-s', '--no-messages',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-b', '--byte-offset',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-H', '--with-filename',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-n', '--line-number',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-T', '--initial-tab',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-u', '--unix-byte-offsets',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-Z', '--null',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-a', '--text',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-I',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-r', '--recursive',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-R', '--dereference-recursive',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('--line-buffered',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-U', '--binary',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-z', '--null-data',
action='store_true',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-e', '--regexp',
dest = 'dummy_0',
metavar = 'PATTERNS',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-f', '--file',
dest = 'dummy_1_0',
metavar = 'FILE',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('--exclude-from',
dest = 'dummy_1_1',
metavar = 'FILE',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-m', '--max-count',
dest = 'dummy_2_0',
metavar = 'NUM',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-A', '--after-context',
dest = 'dummy_2_1',
metavar = 'NUM',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-B', '--before-context',
dest = 'dummy_2_2',
metavar = 'NUM',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-C', '--context',
dest = 'dummy_2_3',
metavar = 'NUM',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('--label',
dest = 'dummy_3',
metavar = 'LABEL',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('--binary-files',
dest = 'dummy_4',
metavar = 'TYPE',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-D', '--devices',
dest = 'dummy_5_0',
metavar = 'ACTION',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('-d', '--directories',
dest = 'dummy_5_1',
metavar = 'ACTION',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('--exclude',
dest = 'dummy_6_0',
metavar = 'GLOB',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('--exclude-dir',
dest = 'dummy_6_1',
metavar = 'GLOB',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('--include',
dest = 'dummy_6_2',
metavar = 'GLOB',
help = ('(Dummy option; kept for compatibility reasons)'))
grep.add_argument('--color', '--colour',
dest = 'dummy_7',
metavar = 'WHEN',
const = None,
nargs = '?',
help = ('(Dummy option; kept for compatibility reasons)'))
####################################################################################################################
grep.add_argument('pattern',
metavar = 'REGEX_PATTERN',
help = ('Regex pattern to search passwords'))

return(args) return(args)

View File

@ -3,7 +3,9 @@ import string


# These are static. # These are static.
VERSION = '0.0.1' VERSION = '0.0.1'
ALPHA_PASS_CHARS = string.ascii_letters ALPHA_LOWER_PASS_CHARS = string.ascii_lowercase
ALPHA_UPPER_PASS_CHARS = string.ascii_uppercase
ALPHA_PASS_CHARS = ALPHA_LOWER_PASS_CHARS + ALPHA_UPPER_PASS_CHARS
NUM_PASS_CHARS = string.digits NUM_PASS_CHARS = string.digits
ALPHANUM_PASS_CHARS = ALPHA_PASS_CHARS + NUM_PASS_CHARS ALPHANUM_PASS_CHARS = ALPHA_PASS_CHARS + NUM_PASS_CHARS
SYMBOL_PASS_CHARS = string.punctuation SYMBOL_PASS_CHARS = string.punctuation
@ -13,7 +15,7 @@ CLIP_TIMEOUT = 45
SELECTED_PASS_CHARS = ALL_PASS_CHARS SELECTED_PASS_CHARS = ALL_PASS_CHARS
SELECTED_PASS_NOSYMBOL_CHARS = ALPHANUM_PASS_CHARS SELECTED_PASS_NOSYMBOL_CHARS = ALPHANUM_PASS_CHARS
CLIPBOARD = 'clipboard' CLIPBOARD = 'clipboard'
GENERATED_LENGTH = 25 # I personally would prefer 32, but Pass compatability... GENERATED_LENGTH = 25 # I personally would prefer 32, but Pass compatibility...
EDITOR = 'vi' # vi is on ...every? single distro and UNIX/UNIX-like, to my knowledge. EDITOR = 'vi' # vi is on ...every? single distro and UNIX/UNIX-like, to my knowledge.


if not os.environ.get('NO_VAULTPASS_ENVS'): if not os.environ.get('NO_VAULTPASS_ENVS'):