Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def make_password(arg_string=None):
if arg_string is None:
arg_string = "-w safe6 -n 4 --min 1 --max=6"
argv = arg_string.split()
parser = xkcd_password.XkcdPassArgumentParser(prog="xkcdpass")
options = parser.parse_args(argv)
xkcd_password.validate_options(parser, options)
my_wordlist = xkcd_password.generate_wordlist(
wordfile=options.wordfile,
min_length=options.min_length,
max_length=options.max_length,
valid_chars=options.valid_chars)
if options.verbose:
xkcd_password.verbose_reports(my_wordlist, options)
return xkcd_password.generate_xkcdpassword(
my_wordlist,
interactive=options.interactive,
def main(argv=None):
""" Mainline code for this program. """
if argv is None:
argv = sys.argv
exit_status = 0
try:
program_name = os.path.basename(argv[0])
parser = XkcdPassArgumentParser(prog=program_name)
options = parser.parse_args(argv[1:])
validate_options(parser, options)
my_wordlist = generate_wordlist(
wordfile=options.wordfile,
min_length=options.min_length,
max_length=options.max_length,
valid_chars=options.valid_chars)
if options.interactive:
initialize_interactive_run(options)
if options.verbose:
verbose_reports(my_wordlist, options)
def __init__(self, *args, **kwargs):
super(XkcdPassArgumentParser, self).__init__(*args, **kwargs)
self._add_arguments()
def __init__(self, *args, **kwargs):
super(XkcdPassArgumentParser, self).__init__(*args, **kwargs)
self._add_arguments()
def main(argv=None):
""" Mainline code for this program. """
if argv is None:
argv = sys.argv
exit_status = 0
try:
program_name = os.path.basename(argv[0])
parser = XkcdPassArgumentParser(prog=program_name)
options = parser.parse_args(argv[1:])
validate_options(parser, options)
my_wordlist = generate_wordlist(
wordfile=options.wordfile,
min_length=options.min_length,
max_length=options.max_length,
valid_chars=options.valid_chars)
if options.verbose:
verbose_reports(my_wordlist, options)
emit_passwords(my_wordlist, options)
except SystemExit as exc: