So wenden Sie pyethrecover.py auf v3 .json/transfor v3 .json auf .v1 an

Ich versuche, pyethrecover.py über Python auf einer meiner .json-Dateien zum Laufen zu bringen, die von Ethereum-Wallet für Mac erstellt wurden. Es scheint, dass meine .json-Datei v3 ist und die pyethrecover.py nur für v1-Dateien funktioniert (die pyethrecover.py sucht nach „encseed“ und „ethaddr“, die in v3-Versionen von .json-Dateien nicht verfügbar sind).

Gibt es eine Möglichkeit, v3-Dateien in v1-Dateien zu übertragen (ohne das Passwort eingeben zu müssen) oder eine andere Möglichkeit, meine .json-Datei brutal zu erzwingen, wenn ich mein genaues Passwort vergessen habe? Oder vielleicht meine v3 .json-Datei ändern, um pyethrecover.py bei der Arbeit daran zu unterstützen?

Ich habe bereits eine E-Mail mit meinem Problem an ethereal.org gesendet, aber keine Antwort.

Hoffe ihr könnt mir helfen!

Antworten (2)

Ich hatte das gleiche Problem. Ich hatte eine Wallet mit erstellt gethund irgendwie das falsche Passwort aufgeschrieben. Ich habe den folgenden einfachen pythonCode verwendet, um das Problem zu lösen. Ich weiß, es ist nicht schön, aber ich brauchte nur eine schnelle Lösung für mein Problem. Jemand anderes könnte dies aufgreifen und ein geeignetes Werkzeug erstellen, oder vielleicht komme ich eines Tages als gute pythonLernerfahrung dazu. Ich habe einige 100.000 Passwörter getestet und konnte sie mit diesem Code wiederherstellen. Es folgt einem ähnlichen Format wie pyethrecover(das Vorverkaufstool) und wird pyethereumzum Decodieren der Keystore-Datei verwendet.

Sie müssen die pyethereumBibliothek herunterladen/installieren: https://github.com/ethereum/pyethereum
Siehe Dokumentation dort für Anforderungen und Anleitungen.

Von pyethereumbrauchen wir, keys.pywas die Funktion hatdecode_keystore_json

from keys import decode_keystore_json #keys.py from pyethereum, we only want the decode_keystore_json function
import json
import itertools
import sys

f = open('wallet.json') # the json account file from keystore, here renamed
jsondata=json.load(f)

Führen Sie Folgendes aus, wenn Sie eine Textdatei mit den verschiedenen Passwörtern haben, die Sie ausprobieren möchten, eines in jeder Zeile:

# Reading possible passwords from a text file
with open('listofpasswords.txt') as fpw: # a text file with possible passwords on each line
    lines = fpw.read().splitlines()

n_pws = len(lines)
print 'Number of passwords to test: %d' % (n_pws,)
i=1
for l in lines:
    try:
        decode_keystore_json(jsondata,l)
        print '\n*** found password in text file:'
        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

Oder diesen Code, wenn Sie Passwörter aus möglichen Kombinationen konstruieren möchten (siehe pyethrecover-Beispiel 2):

# Constructing passwords from possible combinations (see doc of pyethrecover)
grammar=[
    ('correct',),
    ('horse','donkey'),
    ('staple','STAPLE'),
    ('','battery')
]

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

Viel Glück!

@rhkarls Antwort war ein Lebensretter!

Ich musste den Code nur ein wenig für meine Version von Python (3.5.2) anpassen.

from keys import decode_keystore_json #keys.py from pyethereum, we only want the decode_keystore_json function
import json
import itertools
import sys
print(sys.version)

# the json account file from keystore, here renamed, normally has a name like 
# Ethereum\keystore\UTC--2016-12-23T11-51-50.069518500Z--637f383c240g512be19d3ffa3b45d7f03babf091
f = open('ethereum-wallet.json')
jsondata=json.load(f)

combinations=[
    ('beautiful', 'ugly', 'elegant', 'clumsy', ''),
    ('blue', 'red', 'yellow', 'green'),
    ('horse', 'dog', 'cat')
]

pwds=[]
def generate_all(el, tr): #taken from pyethrecover
    if el:
        for j in range(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(combinations,''))
pwds_l = list(pwds)
n_pws = len(pwds_l)

print('Number of passwords to test {0} '.format(n_pws))

i=1
found = 0
for l in pwds_l:    
    try:
        decode_keystore_json(jsondata,l)
        print('\n*** found password in text file {0} '.format(l))
        found = 1
        break
    except:   
        i+=1

if found == 0:
    print('Password not found in {0} attempts'.format(n_pws))
Ich habe eine parallelisierte Version des obigen gehackt: github.com/danielchalef/pyethrecoverv3