def cleandir(d): try: files = os.listdir(d) except: return msg(green("Cleaning directory '%s'" % d)) for f in files: os.unlink(os.path.join(d,f))
def ok(self): ret = self.p.wait() if ret != self.req_exit_val and not opt.coverage: die(1,red('test.py: spawned program exited with value {}'.format(ret))) if opt.profile: return if not self.skip_ok: sys.stderr.write(green('OK\n') if opt.exact_output or opt.verbose else (' OK\n')) return self
def ok(self): ret = self.p.wait() if ret != self.req_exit_val and not opt.coverage: die( 1, red('test.py: spawned program exited with value {}'.format( ret))) if opt.profile: return if not self.skip_ok: sys.stderr.write( green('OK\n') if opt.exact_output or opt.verbose else ( ' OK\n')) return self
def ok(): if opt.verbose or opt.exact_output: sys.stderr.write(green("OK\n")) else: msg(" OK")
except: msg("'rounds' must be a positive integer") sys.exit(1) elif len(cmd_args) > 1: opt.opts.usage(opts_data) if opt.system: sys.path.pop(0) from mmgen.addr import test_for_keyconv if not test_for_keyconv(silent=True): msg( "To run this test, you must install 'keyconv' from the vanitygen package.") sys.exit(1) msg(green("Comparing {}'s internally generated addresses against output of 'keyconv'").format(g.proj_name)) from subprocess import check_output for i in range(1,rounds+1): msg_r("\rRound %s/%s " % (i,rounds)) sec = hexlify(os.urandom(32)) wif = hextowif(sec) a = privnum2addr(int(sec,16)) vmsg("\nkey: %s\naddr: %s\n" % (wif,a)) b = check_output(["keyconv", wif]).split()[1] if a != b: msg_r(red("\nERROR: Addresses do not match!")) msg(""" sec key: {} WIF key: {} {pnm}: {}
) } cmd_args = opt.opts.init(opts_data,opt_filter=opt_filter) if len(cmd_args) < nargs \ and not opt.hidden_incog_input_params and not opt.in_fmt: die(1,"An input file or input format must be specified") elif len(cmd_args) > nargs \ or (len(cmd_args) == nargs and opt.hidden_incog_input_params): msg("No input files may be specified" if invoked_as == "gen" else "Too many input files specified") opt.opts.usage() if cmd_args: check_infile(cmd_args[0]) if not invoked_as == "chk": do_license_msg() if invoked_as in ("conv","passchg"): msg(green("Processing input wallet")) ss_in = None if invoked_as == "gen" \ else SeedSource(*cmd_args,passchg=invoked_as=="passchg") if invoked_as == "chk": sys.exit() if invoked_as in ("conv","passchg"): msg(green("Processing output wallet")) ss_out = SeedSource(ss=ss_in,passchg=invoked_as=="passchg") ss_out.write_to_file()