12,10 → 12,11 |
http://oss.wired-networks.net/bugzilla/show_bug.cgi?id=111 |
-> http://web.archive.org/http://oss.wired-networks.net/bugzilla/show_bug.cgi?id=111 |
(ref3) http://docs.python.org/library/zlib.html |
(ref4) http://pymotw.com/2/getpass/ |
""" |
# Relevation Password Printer |
# |
# Copyright (c) 2011,2012 Toni Corvera |
# Copyright (c) 2011,2012,2013 Toni Corvera |
# All rights reserved. |
# |
# Redistribution and use in source and binary forms, with or without |
41,6 → 42,7 |
|
import ConfigParser |
import getopt |
import getpass |
from lxml import etree |
import os |
import stat |
70,7 → 72,7 |
__revision__ = '$Rev$' |
__version_info__ = ( 1, 2 ) #, 0 ) |
__version__ = '.'.join(map(str, __version_info__)) |
RELEASE=True |
RELEASE=not True |
|
# These are pseudo-standardized exit codes, in Linux (*NIX?) they are defined |
#+in the header </usr/include/sysexits.h> and available as properties of 'os' |
380,10 → 382,16 |
elif opt in ( '-p', '--password' ): |
password = arg |
elif opt in ( '-a', '--ask', '-0', '--stdin' ): |
prompt = '' |
if opt in ( '-a', '--ask' ): |
printen('File password: ') |
password = sys.stdin.readline() |
password = password[:-1] |
prompt = 'File password: ' |
# see [ref4] |
if sys.stdin.isatty(): |
password = getpass.getpass(prompt=prompt, stream=sys.stderr) |
else: |
# Not a terminal, getpass won't work |
password = sys.stdin.readline(); |
password = password[:-1] # XXX: would .rstrip() be safe enough? |
elif opt in ( '-s', '--search' ): |
needles.append(arg) |
elif opt in ( '-i', '--case-insensitive' ): |