Tengo este código:
#!/usr/bin/env python3
# pip3 set up pycryptodome bsddb3
import os
import bsddb3.db as bdb
import struct
def extract_keys(wallet_path):
attempt:
# Open the pockets.dat file
db_env = bdb.DBEnv()
db_env.open(os.path.dirname(wallet_path), bdb.DB_CREATE | bdb.DB_INIT_MPOOL)
db = bdb.DB(db_env)
db.open(wallet_path, "important", bdb.DB_BTREE, bdb.DB_RDONLY)
mkey, ckeys = None, ()
for key, worth in db.gadgets():
if key.startswith(b'x04mkey'):
mkey = worth # Extract grasp key
elif key.startswith(b'x07ckey'):
ckeys.append(worth) # Extract crypted keys
db.shut()
db_env.shut()
return {"mkey": mkey, "ckeys": ckeys}
besides Exception as e:
print(f"Error: {e}")
return None
if __name__ == "__main__":
for infile in os.listdir('.'):
if os.path.isfile(infile) and infile(-4:)=='.dat':
consequence = extract_keys(infile)
if consequence:
print(f"File: {infile}")
print(f"mkey: {consequence('mkey').hex() if consequence('mkey') else 'Not discovered'}")
print(f"ckey: {(ckey.hex() for ckey in consequence('ckeys'))}n")
else:
print("Did not extract keys.")
Extrae mkeys pero no ckys. ¿Cómo solucionar eso?
¿Extrae correctamente mkeys?
Tengo este código:
#!/usr/bin/env python3
# pip3 set up pycryptodome bsddb3
import os
import bsddb3.db as bdb
import struct
def extract_keys(wallet_path):
attempt:
# Open the pockets.dat file
db_env = bdb.DBEnv()
db_env.open(os.path.dirname(wallet_path), bdb.DB_CREATE | bdb.DB_INIT_MPOOL)
db = bdb.DB(db_env)
db.open(wallet_path, "important", bdb.DB_BTREE, bdb.DB_RDONLY)
mkey, ckeys = None, ()
for key, worth in db.gadgets():
if key.startswith(b'x04mkey'):
mkey = worth # Extract grasp key
elif key.startswith(b'x07ckey'):
ckeys.append(worth) # Extract crypted keys
db.shut()
db_env.shut()
return {"mkey": mkey, "ckeys": ckeys}
besides Exception as e:
print(f"Error: {e}")
return None
if __name__ == "__main__":
for infile in os.listdir('.'):
if os.path.isfile(infile) and infile(-4:)=='.dat':
consequence = extract_keys(infile)
if consequence:
print(f"File: {infile}")
print(f"mkey: {consequence('mkey').hex() if consequence('mkey') else 'Not discovered'}")
print(f"ckey: {(ckey.hex() for ckey in consequence('ckeys'))}n")
else:
print("Did not extract keys.")
Extrae mkeys pero no ckys. ¿Cómo solucionar eso?
¿Extrae correctamente mkeys?