Projects STRLCPY btcrecover Commits 3470e901
🤬
  • ■ ■ ■ ■ ■
    btcrecover/btcrpass.py
    skipped 28 lines
    29 29  # (all optional futures for 2.7)
    30 30  from __future__ import print_function, absolute_import, division, unicode_literals
    31 31   
    32  -__version__ = "0.17.0"
     32 +__version__ = "0.17.1"
    33 33  __ordering_version__ = b"0.6.4" # must be updated whenever password ordering changes
    34 34   
    35 35  import sys, argparse, itertools, string, re, multiprocessing, signal, os, cPickle, gc, \
    skipped 2697 lines
    2733 2733  # Opens a new or returns an already-opened file, if it passes the specified constraints.
    2734 2734  # * Only examines one file: if filename == "__funccall" and funccall_file is not None,
    2735 2735  # use it. Otherwise if filename is not None, use it. Otherwise if default_filename
    2736  -# exists, use it. Otherwise, return None.
     2736 +# exists, use it (possibly with its extension duplicated). Otherwise, return None.
    2737 2737  # * After deciding which one file to potentially use, check it against the require_data
    2738 2738  # or new_or_empty "no-exception" constraints and just return None if either fails.
    2739 2739  # (These are "soft" fails which don't raise exceptions.)
    2740 2740  # * Tries to open (if not already opened) and return the file, letting any exception
    2741 2741  # raised by open (a "hard" fail) to pass up.
    2742  -# * For Unicode builds (when tstr == unicode), returns a io.TextIOBase which produces
     2742 +# * For Unicode builds (when tstr == unicode), returns an io.TextIOBase which produces
    2743 2743  # unicode strings if and only if mode is text (is not binary / does not contain "b").
    2744 2744  # * The results of opening stdin more than once are undefined.
    2745 2745  def open_or_use(filename, mode = "r",
    skipped 45 lines
    2791 2791   return sys.stdin
    2792 2792   if os.path.isfile(default_filename):
    2793 2793   filename = default_filename
     2794 + else:
     2795 + # For default filenames only, try doubling the extension to help users who don't realize
     2796 + # their shell is hiding the extension (and thus the actual file has "two" extensions)
     2797 + default_filename, default_ext = os.path.splitext(default_filename)
     2798 + default_filename += default_ext + default_ext
     2799 + if os.path.isfile(default_filename):
     2800 + filename = default_filename
    2794 2801   if not filename:
    2795 2802   return None
    2796 2803   #
    skipped 141 lines
    2938 2945   # is changed (due to reading a tokenlist or restore file), we redo parser.parse_args() which
    2939 2946   # changes args, so we only do this early on before most args processing takes place.
    2940 2947   
     2948 + # If no args are present on the command line (e.g. user double-clicked the script
     2949 + # in the shell), enable --pause by default so user doesn't miss any error messages
     2950 + if not effective_argv: enable_pause()
     2951 + 
    2941 2952   # Create a parser which can parse any supported option, and run it
    2942 2953   global args
    2943 2954   init_parser_common()
    skipped 59 lines
    3003 3014   if not (args.restore or args.passwordlist or args.performance or base_iterator):
    3004 3015   tokenlist_file = open_or_use(args.tokenlist, "r", kwds.get("tokenlist"),
    3005 3016   default_filename=TOKENS_AUTO_FILENAME, permit_stdin=True, make_peekable=True)
    3006  - if hasattr(tokenlist_file, "name") and tokenlist_file.name == TOKENS_AUTO_FILENAME:
     3017 + if hasattr(tokenlist_file, "name") and tokenlist_file.name.startswith(TOKENS_AUTO_FILENAME):
    3007 3018   enable_pause() # enabled by default when using btcrecover-tokens-auto.txt
    3008 3019   else:
    3009 3020   tokenlist_file = None
    skipped 58 lines
    3068 3079   # We finally know the tokenlist filename; open it here
    3069 3080   tokenlist_file = open_or_use(args.tokenlist, "r", kwds.get("tokenlist"),
    3070 3081   default_filename=TOKENS_AUTO_FILENAME, permit_stdin=True, make_peekable=True)
    3071  - if hasattr(tokenlist_file, "name") and tokenlist_file.name == TOKENS_AUTO_FILENAME:
     3082 + if hasattr(tokenlist_file, "name") and tokenlist_file.name.startswith(TOKENS_AUTO_FILENAME):
    3072 3083   enable_pause() # enabled by default when using btcrecover-tokens-auto.txt
    3073 3084   # Display a warning if any options (all ignored) were specified in the tokenlist file
    3074 3085   if tokenlist_file and tokenlist_file.peek() == "#": # if it's either a comment or additional args
    skipped 619 lines
    3694 3705   passwordlist_file == sys.stdin or
    3695 3706   args.exclude_passwordlist == '-' or
    3696 3707   args.android_pin or
    3697  - args.blockchain_secondpass
     3708 + args.blockchain_secondpass or
     3709 + args.mnemonic_prompt
    3698 3710   ) and (
    3699 3711   passwordlist_file != sys.stdin or
    3700 3712   passwordlist_allcached
    skipped 1853 lines
Please wait...
Page is in error, reload to recover