def launch(what): if what in ("walletgen","walletchk","walletconv","passchg"): what = "wallet" if what == "keygen": what = "addrgen" try: import termios except: # Windows from mmgen.util import start_mscolor start_mscolor() __import__("mmgen.main_" + what) else: import sys,atexit fd = sys.stdin.fileno() old = termios.tcgetattr(fd) def at_exit(): termios.tcsetattr(fd, termios.TCSADRAIN, old) atexit.register(at_exit) try: __import__("mmgen.main_" + what) except KeyboardInterrupt: sys.stderr.write("\nUser interrupt\n") except EOFError: sys.stderr.write("\nEnd of file\n")
# Chdir to repo root. # Since script is not in repo root, fix sys.path so that modules are # imported from repo, not system. import sys,os pn = os.path.dirname(sys.argv[0]) os.chdir(os.path.join(pn,os.pardir)) sys.path.__setitem__(0,os.path.abspath(os.curdir)) from binascii import hexlify import mmgen.opt as opt import mmgen.globalvars as g from mmgen.util import msg,msg_r,mmsg,mdie,red,green,vmsg,start_mscolor from mmgen.bitcoin import hextowif,privnum2addr start_mscolor() rounds = 100 opts_data = { 'desc': "Test addresses generated by {} against output of 'keyconv'".format(g.proj_name), 'usage':"[options] [rounds]", 'options': """ -h, --help Print this help message -s, --system Test scripts and modules installed on system rather than those in the repo root -v, --verbose Produce more verbose output """, 'notes': """ 'keyconv' is the address generation utility from the well-known vanitygen package. If it's installed on your system, {pnm} will use it by default to