コード例 #1
0
def attempt(w, pw):
    sys.stdout.flush()
    counter.increment()
    jakdlouho = time.time() - time1
    cas = "\t%.2f sec \t\t" % jakdlouho

    print counter.value, "\t", n_pws - counter.value, cas, [pw]

    try:
        o = decode_keystore_json(w, pw)

        print(
            """\n\n*************************\nNasel jsem heslo:\n"%s"\n*************************\n\n"""
            % pw)
        f = open("nalezeneheslo.txt", 'w')
        f.write(
            """\n\n*************************\nNasel jsem heslo:\n"%s"\n*************************\n\n"""
            % pw)
        f.close()
        os.system("killall python")
        try:
            os.system("killall python")
        except SystemExit as e:
            sys.exit(e)
        except:
            raise

    except ValueError as e:
        return ""
コード例 #2
0
def attempt(w, pw):
    sys.stdout.flush()
    counter.increment()
    jakdlouho = time.time() - time1
    cas = "\t%.2f sec \t\t" % jakdlouho

    print counter.value, "\t", n_pws - counter.value, cas, [pw]

    try:
        o = decode_keystore_json(w, pw)

        print(
            """\n\n*************************\nPASSWORD FOUND:\n%s\n*************************\n\n"""
            % pw)
        f = open("result.txt", 'w')
        f.write(
            """\n\n*************************\nPASSWORD FOUND:\n%s\n*************************\n\n"""
            % pw)
        f.close()
        sys.exit(0)


#	try:
#	    sys.exit(0)
#	except SystemExit as e:
#	    sys.exit(e)
#	except:
#	    raise

    except ValueError as e:
        return ""
コード例 #3
0
 def unlock(self, password):
     """Unlock the account with a password.
     If the account is already unlocked, nothing happens, even if the password is wrong.
     :raises: :exc:`ValueError` (originating in ethereum.keys) if the password is wrong (and the
              account is locked)
     """
     if self.locked:
         self._privkey = keys.decode_keystore_json(self.keystore, password)
         self.locked = False
         self.address  # get address such that it stays accessible after a subsequent lock
コード例 #4
0
def attempt(w, pw):
    sys.stdout.write(
        "Attempt #%d: %s\n" % (counter.value, pw)
    )  #prints simple progress with # in list that is tested and the pw string
    sys.stdout.flush()
    counter.increment()

    if len(pw) < ethereum_minimum_pw_length:
        return ""
    try:
        o = decode_keystore_json(w, pw)
        with open("password.txt", "w") as pwfile:
            pwfile.write(pw)
            print("\n\nYour password is:\n%s\n\n" % pw)
        raise PasswordFoundException("""\n\nYour password is:\n%s""" % o)
    except ValueError:
        return ""
コード例 #5
0
def attempt(w, pw):
    # print(pw)
    # sys.stdout.write("\r")

    # sys.stdout.write("\rAttempt #%d: %s" % (counter.value, pw)) #prints simple progress with # in list that is tested and the pw string
    sys.stdout.write(
        "Attempt #%d: %s\n" % (counter.value, pw)
    )  #prints simple progress with # in list that is tested and the pw string
    sys.stdout.flush()
    #print(counter.value)
    counter.increment()

    if len(pw) < 10:
        return ""
    try:
        o = decode_keystore_json(w, pw)
        print(o)
        # print (pw)q
        raise PasswordFoundException("""\n\nYour password is:\n%s""" % o)
    except ValueError as e:
        # print(e)
        return ""
コード例 #6
0
ファイル: keystorer.py プロジェクト: vaizguy/pyethereum
    except:
        raise Exception("keys module not found")

# Help
if len(sys.argv) < 2:
    print(
        "Use `keystorer.py create <pw> <optional privkey>` to create a key store file, and `keystorer.py decode <filename> <pw>` to decode a key store file"
    )
# Create a json
elif sys.argv[1] == 'create':
    if len(sys.argv) < 4:
        key = os.urandom(32)
    else:
        key = keys.decode_hex(sys.argv[3])
    pw = sys.argv[2]
    print("Applying hard key derivation function. Wait a little")
    j = keys.make_keystore_json(key, pw)
    print j
    open(j["id"] + '.json', 'w').write(json.dumps(j, indent=4))
    print("Wallet creation successful, file saved at: " + j["id"] + ".json")
# Decode a json
elif sys.argv[1] == 'decode':
    if len(sys.argv) < 3:
        raise Exception("Need filename")
    json = json.loads(open(sys.argv[2]).read())
    if len(sys.argv) < 4:
        raise Exception("Need password")
    pw = sys.argv[3]
    print("Applying hard key derivation function. Wait a little")
    print(keys.encode_hex(keys.decode_keystore_json(json, pw)))
コード例 #7
0
ファイル: crack.py プロジェクト: sycomix/pyethcrack
pwds = []


def generate_all(el, tr):  #taken from pyethrecover
    if el:
        for j in xrange(len(el[0])):
            for w in generate_all(el[1:], tr + el[0][j]):
                yield w
    else:
        yield tr


pwds = itertools.chain(pwds, generate_all(grammar, ''))
pwds_l = list(pwds)
n_pws = len(pwds_l)
print 'Number of passwords to test: %d' % (n_pws, )
i = 1
for l in pwds_l:
    try:
        decode_keystore_json(jsondata, l)
        print '\n*** found password in grammar list:'
        print l
        break
    except:
        sys.stdout.write(
            "\r#%d %s" % (i, l)
        )  #prints simple progress with # in list that is tested and the pw string
        sys.stdout.flush()
        i += 1
コード例 #8
0
ファイル: keystorer.py プロジェクト: biblecoin/pybiblecoin
if len(sys.argv) < 2:
    print(
        "Use `keystorer.py create <optional privkey>` to create a key store file, and `keystorer.py getprivkey <filename>` or `keystorer.py getaddress <filename> to get a privkey/address from a key store file, respectively"
    )
# Create a json
elif sys.argv[1] == 'create':
    if len(sys.argv) < 3:
        key = os.urandom(32)
    else:
        key = keys.decode_hex(sys.argv[2])
    pw = getpass.getpass()
    pw2 = getpass.getpass()
    assert pw == pw2, "Password mismatch"
    print("Applying hard key derivation function. Wait a little")
    j = keys.make_keystore_json(key, pw)
    print(j)
    open(j["id"] + '.json', 'w').write(json.dumps(j, indent=4))
    print("Wallet creation successful, file saved at: " + j["id"] + ".json")
# Decode a json
elif sys.argv[1] in ('getprivkey', 'getaddress'):
    if len(sys.argv) < 3:
        raise Exception("Need filename")
    json = json.loads(open(sys.argv[2]).read())
    pw = getpass.getpass()
    print("Applying hard key derivation function. Wait a little")
    k = keys.decode_keystore_json(json, pw)
    if sys.argv[1] == 'getprivkey':
        print(keys.encode_hex(k))
    else:
        print(keys.encode_hex(keys.privtoaddr(k)))
コード例 #9
0
ファイル: keystorer.py プロジェクト: Aireed/pyethereum
# Help
if len(sys.argv) < 2:
    print("Use `keystorer.py create <optional privkey>` to create a key store file, and `keystorer.py getprivkey <filename>` or `keystorer.py getaddress <filename> to get a privkey/address from a key store file, respectively")
# Create a json
elif sys.argv[1] == 'create':
    if len(sys.argv) < 3:
        key = os.urandom(32)
    else:
        key = keys.decode_hex(sys.argv[2])
    pw = getpass.getpass()
    pw2 = getpass.getpass()
    assert pw == pw2, "Password mismatch"
    print("Applying hard key derivation function. Wait a little")
    j = keys.make_keystore_json(key, pw)
    print(j)
    open(j["id"]+'.json', 'w').write(json.dumps(j, indent=4))
    print("Wallet creation successful, file saved at: " + j["id"] + ".json")
# Decode a json
elif sys.argv[1] in ('getprivkey', 'getaddress'):
    if len(sys.argv) < 3:
        raise Exception("Need filename")
    json = json.loads(open(sys.argv[2]).read())
    pw = getpass.getpass()
    print("Applying hard key derivation function. Wait a little")
    k = keys.decode_keystore_json(json, pw)
    if sys.argv[1] == 'getprivkey':
        print(keys.encode_hex(k))
    else:
        print(keys.encode_hex(keys.privtoaddr(k)))
コード例 #10
0
ファイル: keystorer.py プロジェクト: Feretrius/pyethereum
    try:
        import ethereum.keys as keys
    except:
        raise Exception("keys module not found")

# Help
if len(sys.argv) < 2:
    print("Use `keystorer.py create <pw> <optional privkey>` to create a key store file, and `keystorer.py decode <filename> <pw>` to decode a key store file")
# Create a json
elif sys.argv[1] == 'create':
    if len(sys.argv) < 4:
        key = os.urandom(32)
    else:
        key = keys.decode_hex(sys.argv[3])
    pw = sys.argv[2]
    print("Applying hard key derivation function. Wait a little")
    j = keys.make_keystore_json(key, pw)
    print j
    open(j["id"]+'.json', 'w').write(json.dumps(j, indent=4))
    print("Wallet creation successful, file saved at: " + j["id"] + ".json")
# Decode a json
elif sys.argv[1] == 'decode':
    if len(sys.argv) < 3:
        raise Exception("Need filename")
    json = json.loads(open(sys.argv[2]).read())
    if len(sys.argv) < 4:
        raise Exception("Need password")
    pw = sys.argv[3]
    print("Applying hard key derivation function. Wait a little")
    print(keys.encode_hex(keys.decode_keystore_json(json, pw)))