Bitcoin Forum
May 05, 2024, 06:36:44 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 3 4 [5] 6 »  All
  Print  
Author Topic: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet  (Read 1802 times)
NotATether
Legendary
*
Offline Offline

Activity: 1596
Merit: 6728


bitcoincleanup.com / bitmixlist.org


View Profile WWW
January 20, 2021, 05:32:22 AM
 #81

Hey guys thanks so much for all your support.

I'm not sure what I need to do...Excuse my ignorance, I'm not very good with working in Terminal and also not too familiar with what a script is (besides from what I read from a quick google search).

All you have to do is copy the code in my post to a text file using an editor, save the file as restore-wallet.py, ensure that it's located in the same folder as your wallet.json (or whatever the file that has your blockstack secret data is called) and then run python2 restore-wallet.py PUT_THE_BLOCKSTACK_FILE_HERE ~/.blockstack/wallet.json

Then you run the blockstack wallet command to access your private keys.

The wallet code is not using multisig so the private keys should be immediately spendable.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
1714891004
Hero Member
*
Offline Offline

Posts: 1714891004

View Profile Personal Message (Offline)

Ignore
1714891004
Reply with quote  #2

1714891004
Report to moderator
1714891004
Hero Member
*
Offline Offline

Posts: 1714891004

View Profile Personal Message (Offline)

Ignore
1714891004
Reply with quote  #2

1714891004
Report to moderator
1714891004
Hero Member
*
Offline Offline

Posts: 1714891004

View Profile Personal Message (Offline)

Ignore
1714891004
Reply with quote  #2

1714891004
Report to moderator
"Bitcoin: the cutting edge of begging technology." -- Giraffe.BTC
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714891004
Hero Member
*
Offline Offline

Posts: 1714891004

View Profile Personal Message (Offline)

Ignore
1714891004
Reply with quote  #2

1714891004
Report to moderator
NotATether
Legendary
*
Offline Offline

Activity: 1596
Merit: 6728


bitcoincleanup.com / bitmixlist.org


View Profile WWW
January 20, 2021, 08:53:44 AM
 #82

Click wallet details.
In field "Enter Private Key" put ef242kfjj24ekf3223jesdkhefsfhk324wuefhw38fhrypofhtr34d342132d34jsd

You should get addrress, WIF and priv (maybe this will work).

This isn't going to work because it appears that blockstack is creating 2-of-3 multisig keys for the payment and owner "private keys" using virtualchain. It checks for the current block height, and if it's greater than 436650 (it's well over that height by now), it creates multisig wallets for them. Otherwise it just creates regular private keys for them. Data key AFAIK is always using a single private key.

The question now is, which one holds the wallet's money? And why are only one of each owner and private key shown when you run blockstack wallet?

Quote from: blockstack_client/config.py
Code:
# epoch dates
EPOCH_1_END_BLOCK = 436650

# ...snip

EPOCH_HEIGHT_MINIMUM = EPOCH_1_END_BLOCK + 1

Quote from: blockstack_client/wallet.py
Code:
def make_wallet( password, hex_privkey=None, payment_privkey_info=None, owner_privkey_info=None, data_privkey_info=None, config_path=CONFIG_PATH ):
    """
    Make a wallet structure.
    By default, the owner and payment keys will be key bundles set up to require 2-of-3 signatures.
    @payment_privkey_info, @owner_privkey_info, and @data_privkey_info can either be individual private keys, or
    dicts with {'redeem_script': ..., 'private_keys': ...} defined.

    Return the new wallet on success.
    Return {'error': ...} on failure
    """

    # ... more stuff snipped

    multisig = False
    curr_height = get_block_height( config_path=config_path )
    if curr_height >= config.EPOCH_HEIGHT_MINIMUM:
        # safe to use multisig
        multisig = True

    # default to 2-of-3 multisig key info if data isn't given
    if payment_privkey_info is None:
        if multisig:
            payment_privkey_info = virtualchain.make_multisig_wallet( 2, 3 )
        else:
            payment_privkey_info = virtualchain.BitcoinPrivateKey().to_wif()

    if not is_singlesig(payment_privkey_info) and not is_multisig(payment_privkey_info):
        return {'error': 'Payment private key info must be either a single private key or a multisig bundle'}

    if not multisig and is_multisig(payment_privkey_info):
        return {'error': 'Multisig payment private key info is not supported'}

    if owner_privkey_info is None:
        if multisig:
            owner_privkey_info = virtualchain.make_multisig_wallet( 2, 3 )
        else:
            owner_privkey_info = virtualchain.BitcoinPrivateKey().to_wif()



Based on Your code - Ive created similar for version pre0.13 (OP provided password longer than 16, and min 15 chart was requested by Blockstack cli version 0.0.12.4 - so maybe version pre13)
Blockstack cli version 0.0.12.4 use registrar for encrypted_key = (aes_encrypt(hex_privkey, hex_password)).

I got it to work on blockstack_client 0.14.0.2. The source code has been obliterated from Github but you can still download a copy hosted at PyPI located at https://files.pythonhosted.org/packages/3b/33/b0be01806a3503f8fbbaee22477b40c23682bfbde0285695e6d9474aa305/blockstack-client-0.14.0.2.tar.gz

I experienced difficulties with dependency errors trying to get newer versions to work. They require a function that has been removed from virtualchain.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
January 20, 2021, 12:04:58 PM
 #83

go to:
https://www.bitaddress.org/ (it is known and safe - you can turn off internet if you like)

No, it is not safe.
Stop making such retarded statements.

It is never safe to enter private information into a website, regardless of whether you "turn off the internet" or not..

escobol
Member
**
Offline Offline

Activity: 154
Merit: 39


View Profile
January 20, 2021, 06:04:15 PM
 #84

go to:
https://www.bitaddress.org/ (it is known and safe - you can turn off internet if you like)

No, it is not safe.
Stop making such retarded statements.

It is never safe to enter private information into a website, regardless of whether you "turn off the internet" or not..

You are right - deleted.
escobol
Member
**
Offline Offline

Activity: 154
Merit: 39


View Profile
January 20, 2021, 06:10:30 PM
 #85

Click wallet details.
In field "Enter Private Key" put ef242kfjj24ekf3223jesdkhefsfhk324wuefhw38fhrypofhtr34d342132d34jsd

You should get addrress, WIF and priv (maybe this will work).

This isn't going to work because it appears that blockstack is creating 2-of-3 multisig keys for the payment and owner "private keys" using virtualchain. It checks for the current block height, and if it's greater than 436650 (it's well over that height by now), it creates multisig wallets for them. Otherwise it just creates regular private keys for them. Data key AFAIK is always using a single private key.

The question now is, which one holds the wallet's money? And why are only one of each owner and private key shown when you run blockstack wallet?

Quote from: blockstack_client/config.py
Code:
# epoch dates
EPOCH_1_END_BLOCK = 436650

# ...snip

EPOCH_HEIGHT_MINIMUM = EPOCH_1_END_BLOCK + 1

Quote from: blockstack_client/wallet.py
Code:
def make_wallet( password, hex_privkey=None, payment_privkey_info=None, owner_privkey_info=None, data_privkey_info=None, config_path=CONFIG_PATH ):
    """
    Make a wallet structure.
    By default, the owner and payment keys will be key bundles set up to require 2-of-3 signatures.
    @payment_privkey_info, @owner_privkey_info, and @data_privkey_info can either be individual private keys, or
    dicts with {'redeem_script': ..., 'private_keys': ...} defined.

    Return the new wallet on success.
    Return {'error': ...} on failure
    """

    # ... more stuff snipped

    multisig = False
    curr_height = get_block_height( config_path=config_path )
    if curr_height >= config.EPOCH_HEIGHT_MINIMUM:
        # safe to use multisig
        multisig = True

    # default to 2-of-3 multisig key info if data isn't given
    if payment_privkey_info is None:
        if multisig:
            payment_privkey_info = virtualchain.make_multisig_wallet( 2, 3 )
        else:
            payment_privkey_info = virtualchain.BitcoinPrivateKey().to_wif()

    if not is_singlesig(payment_privkey_info) and not is_multisig(payment_privkey_info):
        return {'error': 'Payment private key info must be either a single private key or a multisig bundle'}

    if not multisig and is_multisig(payment_privkey_info):
        return {'error': 'Multisig payment private key info is not supported'}

    if owner_privkey_info is None:
        if multisig:
            owner_privkey_info = virtualchain.make_multisig_wallet( 2, 3 )
        else:
            owner_privkey_info = virtualchain.BitcoinPrivateKey().to_wif()



Based on Your code - Ive created similar for version pre0.13 (OP provided password longer than 16, and min 15 chart was requested by Blockstack cli version 0.0.12.4 - so maybe version pre13)
Blockstack cli version 0.0.12.4 use registrar for encrypted_key = (aes_encrypt(hex_privkey, hex_password)).

I got it to work on blockstack_client 0.14.0.2. The source code has been obliterated from Github but you can still download a copy hosted at PyPI located at https://files.pythonhosted.org/packages/3b/33/b0be01806a3503f8fbbaee22477b40c23682bfbde0285695e6d9474aa305/blockstack-client-0.14.0.2.tar.gz

I experienced difficulties with dependency errors trying to get newer versions to work. They require a function that has been removed from virtualchain.


436650 date is 30/10/2016 (so question to OP - when wallet was created?)
21XO (OP)
Jr. Member
*
Offline Offline

Activity: 57
Merit: 29


View Profile
January 20, 2021, 07:31:50 PM
 #86

Quote
436650 date is 30/10/2016 (so question to OP - when wallet was created?)

April 2016


Hey guys thanks so much for all your support.

I'm not sure what I need to do...Excuse my ignorance, I'm not very good with working in Terminal and also not too familiar with what a script is (besides from what I read from a quick google search).

All you have to do is copy the code in my post to a text file using an editor, save the file as restore-wallet.py, ensure that it's located in the same folder as your wallet.json (or whatever the file that has your blockstack secret data is called) and then run python2 restore-wallet.py PUT_THE_BLOCKSTACK_FILE_HERE ~/.blockstack/wallet.json

Then you run the blockstack wallet command to access your private keys.

The wallet code is not using multisig so the private keys should be immediately spendable.

Okay I have both files located on my desktop, but here is the message I am getting: https://ibb.co/Wvh6y3b

Here is what I pasted: https://ibb.co/vcyb8g0
NotATether
Legendary
*
Offline Offline

Activity: 1596
Merit: 6728


bitcoincleanup.com / bitmixlist.org


View Profile WWW
January 20, 2021, 07:40:01 PM
Last edit: January 20, 2021, 08:02:10 PM by NotATether
 #87

Okay I have both files located on my desktop, but here is the message I am getting: https://ibb.co/Wvh6y3b

Here is what I pasted: https://ibb.co/vcyb8g0

Since you put the files on the desktop, you need to change the terminal to the Desktop/ folder before running the command.

Run cd ~/Desktop/ and then run the command you were trying to run.



~snip

Hang on, I'll have a solution for that soon.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
21XO (OP)
Jr. Member
*
Offline Offline

Activity: 57
Merit: 29


View Profile
January 20, 2021, 07:59:34 PM
 #88

Code:
Opening wallet file wallet.json...
Deriving master private key...
Decoding wallet...
Writing decoded wallet to /home/parallels/.blockstack/wallet.json
Wallet dump successful.
parallels@parallels-Parallels-Virtual-Platform:~/Desktop$ blockstack wallet
/home/parallels/.local/lib/python2.7/site-packages/jsontokens/token_signer.py:15: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
  from cryptography.hazmat.backends import default_backend
/home/parallels/.local/lib/python2.7/site-packages/jsontokens/token_signer.py:15: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
  from cryptography.hazmat.backends import default_backend
API endpoint already running (PID 5159, /home/parallels/.blockstack/api_endpoint.pid)
Failed to start RPC endpoint (in working directory /home/parallels/.blockstack).
Please check your password, and verify that the working directory exists and is writeable.
parallels@parallels-Parallels-Virtual-Platform:~/Desktop$
NotATether
Legendary
*
Offline Offline

Activity: 1596
Merit: 6728


bitcoincleanup.com / bitmixlist.org


View Profile WWW
January 20, 2021, 09:28:14 PM
 #89

What happens if you try deleting the /home/parallels/.blockstack/api_endpoint.pid file? (type rm /home/parallels/.blockstack/api_endpoint.pid and then try to open the wallet again.)

If that doesn't help then reboot the Parallels VM and open the terminal again, set it to the desktop folder and run blockstack wallet once again.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
21XO (OP)
Jr. Member
*
Offline Offline

Activity: 57
Merit: 29


View Profile
January 20, 2021, 10:16:03 PM
 #90

What happens if you try deleting the /home/parallels/.blockstack/api_endpoint.pid file? (type rm /home/parallels/.blockstack/api_endpoint.pid and then try to open the wallet again.)

If that doesn't help then reboot the Parallels VM and open the terminal again, set it to the desktop folder and run blockstack wallet once again.

Yes that worked but the address has 0 btc. So I think maybe a new wallet was created...


Here is the address it gave me for the wallet: 1KWkUvMxU7PripJ6K2xp2ab1eqUjXvXMrV


But this is the address with coins: 194zW3CDXCuhx24quQcDaJBKwmonxxkK7N
escobol
Member
**
Offline Offline

Activity: 154
Merit: 39


View Profile
January 21, 2021, 08:59:15 PM
Last edit: January 21, 2021, 11:58:15 PM by escobol
Merited by ABCbits (6), LoyceV (4)
 #91

name code as dirty.py

wallet.json with master private_key and wallet_password

dirty.py with wallet.json in one place

in Terminal:
Code:
python2 dirty.py wallet.json wallet2.json
Will print all info in terminal (wallet address, priv key, wif)

If you see 194zW3CDXCuhx24quQcDaJBKwmonxxkK7N, copy WIF - import to Electrum and have fun Smiley



dirty.py
Code:
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
    Blockstack Legacy wallet crack

"""
from registrar.wallet import HDWallet
from registrar.crypto.utils import aes_encrypt, aes_decrypt
from registrar.crypto.utils import get_address_from_privkey, get_pubkey_from_privkey
from binascii import hexlify
from pybitcoin import BitcoinPrivateKey
import json
import sys
import os.path
import os
import base64


if __name__ == "__main__":
  
    result = {}
    print "Blockstack Legacy wallet crack"
    print "-----"
    print ""
    if len(sys.argv) != 3:
         print "Usage: python2 %s /path/to/wallet.json /path/to/destination/wallet.json" % sys.argv[0]
         sys.exit(1)

    src = sys.argv[1]
    dest = sys.argv[2]

    print "Opening wallet file %s..." % src
    f_src = open(src)
    jwallet = json.load(f_src)
    print "Deriving master private key..."
    hex_privkey = jwallet["master_private_key"]
    password = jwallet["wallet_password"]
    hex_password = hexlify(password)

    wallet = HDWallet(hex_privkey)
    child = wallet.get_child_keypairs(count=3, include_privkey=False)
  

    hex_privkey_1 = wallet.get_child_privkey(1)
    btc_1 = get_address_from_privkey(hex_privkey_1)
    btc_privkey_1 = BitcoinPrivateKey(hex_privkey_1)
    wif_1 = btc_privkey_1.to_wif()
  
    hex_privkey_2 = wallet.get_child_privkey(0)
    btc_2 = get_address_from_privkey(hex_privkey_2)
    btc_privkey_2 = BitcoinPrivateKey(hex_privkey_2)
    wif_2 = btc_privkey_2.to_wif()

    hex_privkey_3 = wallet.get_child_privkey(2)
    btc_3 = get_address_from_privkey(hex_privkey_3)
    btc_privkey_3 = BitcoinPrivateKey(hex_privkey_3)
    wif_3 = btc_privkey_3.to_wif()

  
    master = wallet.get_master_privkey()
    btc_privkey = BitcoinPrivateKey(hex_privkey)
    priv_hex = btc_privkey.to_hex()
    priv_wif = btc_privkey.to_wif()

    btc = get_address_from_privkey(hex_privkey)
    btc_pub = get_pubkey_from_privkey(hex_privkey)

    data = {}
    encrypted_key = aes_encrypt(hex_privkey, hex_password)
    data['encrypted_master_private_key'] = encrypted_key
    data['payment_addresses'] = [child[0]]
    data['owner_addresses'] = [child[1]]

    file = open(dest, 'w')
    file.write(json.dumps(data))
    file.close()
    print ""
    print "Wallet created. Make sure to backup the following:"
    print ""
    print "-----"
    print "master_private_key:", hex_privkey
    print "wallet_password:", password
    print "-----"
    print ""
    print "-----"
    print "encrypted_master_private_key:", encrypted_key
    print "-----"
    print "owner_addresses:", [child[1]]
    print "owner_addresses:", btc_1
    print "owner_key_hex:", hex_privkey_1
    print "WIF owner:", wif_1
    print "-----"
    print "payment_addresses:", [child[0]]
    print "payment_addresses:", btc_2
    print "payment_key_hex", hex_privkey_2
    print "WIF payment:", wif_2
    print "-----"
    print "payment_addresses:", [child[2]]
    print "payment_addresses:", btc_3
    print "payment_key_hex", hex_privkey_3
    print "WIF payment:", wif_3
    print "-----"
    print ""
    print "FROM MASTER"
    print "Address:", btc
    print "Priv HEX:", priv_hex
    print "WIF Master:", priv_wif

21XO (OP)
Jr. Member
*
Offline Offline

Activity: 57
Merit: 29


View Profile
January 27, 2021, 09:21:53 PM
 #92

Can someone confirm that Escobol's code is safe for me to try?
21XO (OP)
Jr. Member
*
Offline Offline

Activity: 57
Merit: 29


View Profile
January 27, 2021, 09:30:48 PM
 #93

What happens if you try deleting the /home/parallels/.blockstack/api_endpoint.pid file? (type rm /home/parallels/.blockstack/api_endpoint.pid and then try to open the wallet again.)

If that doesn't help then reboot the Parallels VM and open the terminal again, set it to the desktop folder and run blockstack wallet once again.

Yes that worked but the address has 0 btc. So I think maybe a new wallet was created...


Here is the address it gave me for the wallet: 1KWkUvMxU7PripJ6K2xp2ab1eqUjXvXMrV


But this is the address with coins: 194zW3CDXCuhx24quQcDaJBKwmonxxkK7N

I rebooted my system and tried again, but now it is creating yet another wallet.

So it seems like the
Code:
blockstack wallet
command just creates new wallets even after I run
Code:
python2 restore-wallet.py wallet.json ~/.blockstack/wallet.json
NotATether
Legendary
*
Offline Offline

Activity: 1596
Merit: 6728


bitcoincleanup.com / bitmixlist.org


View Profile WWW
January 28, 2021, 02:55:49 AM
 #94

I rebooted my system and tried again, but now it is creating yet another wallet.

So it seems like the
Code:
blockstack wallet
command just creates new wallets even after I run
Code:
python2 restore-wallet.py wallet.json ~/.blockstack/wallet.json

Interesting. I'll inspect the code that implements the wallet command and run escobol's code later and report the results.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
escobol
Member
**
Offline Offline

Activity: 154
Merit: 39


View Profile
January 29, 2021, 04:41:55 PM
 #95

I rebooted my system and tried again, but now it is creating yet another wallet.

So it seems like the
Code:
blockstack wallet
command just creates new wallets even after I run
Code:
python2 restore-wallet.py wallet.json ~/.blockstack/wallet.json

Interesting. I'll inspect the code that implements the wallet command and run escobol's code later and report the results.

Thnx NotATether, Ive tested it with few mpk/passwords generated with 3 old blockstack versions  (0.10.x) and with that simple code I got the same public/privkey (also added WIF for easy import to electrum).
NotATether
Legendary
*
Offline Offline

Activity: 1596
Merit: 6728


bitcoincleanup.com / bitmixlist.org


View Profile WWW
January 31, 2021, 05:26:08 AM
 #96

Thnx NotATether, Ive tested it with few mpk/passwords generated with 3 old blockstack versions  (0.10.x) and with that simple code I got the same public/privkey (also added WIF for easy import to electrum).

I am having difficulty installing the required dependencies of your script (module registrar and all its dependencies) alongside blockstack, and as I predicted it is very difficult to find a virtualenv for python2 in the ubuntu apt repositories  Sad

Can we not make this script use python3? Yours doesn't depend on blockstack-client so it's possible as long as registrar has a Python 3 module.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
escobol
Member
**
Offline Offline

Activity: 154
Merit: 39


View Profile
January 31, 2021, 01:34:13 PM
Last edit: February 02, 2021, 01:48:02 PM by escobol
Merited by LoyceV (4), ABCbits (1)
 #97

check

Code:
pip2 install registrar==0.0.3.4

------
Checked on new/clean Ubuntu 18.04 LTS

In terminal:

sudo apt-get update
sudo apt-get upgrade
sudo apt install python-minimal
sudo apt install python-pip
sudo apt-get install libssl-dev libffi-dev
pip2 install registrar==0.0.3.4

then (navigate in terminal to the place where is dirty.py (code) and wallet.json)
python2 dirty.py wallet.json wallet_tesporesset.json

Got all pubs/privs



Thnx NotATether, Ive tested it with few mpk/passwords generated with 3 old blockstack versions  (0.10.x) and with that simple code I got the same public/privkey (also added WIF for easy import to electrum).

I am having difficulty installing the required dependencies of your script (module registrar and all its dependencies) alongside blockstack, and as I predicted it is very difficult to find a virtualenv for python2 in the ubuntu apt repositories  Sad

Can we not make this script use python3? Yours doesn't depend on blockstack-client so it's possible as long as registrar has a Python 3 module.
NotATether
Legendary
*
Offline Offline

Activity: 1596
Merit: 6728


bitcoincleanup.com / bitmixlist.org


View Profile WWW
February 04, 2021, 05:02:43 PM
Merited by LoyceV (4), ABCbits (2)
 #98

escobol has sent me an updated script that works. The previous version malfunctions and terminates with a Python error, nothing malicious or anything, so don't use that one.

Use this updated one instead:

Code:
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
    Blockstack Legacy wallet crack

"""
from registrar.wallet import HDWallet
from registrar.crypto.utils import aes_encrypt, aes_decrypt
from registrar.crypto.utils import get_address_from_privkey, get_pubkey_from_privkey
from binascii import hexlify
from pybitcoin import BitcoinPrivateKey
import json
import sys
import os.path
import os
import base64


if __name__ == "__main__":
  
    result = {}
    print "Blockstack Legacy wallet crack"
    print "-----"
    print ""
    if len(sys.argv) != 3:
         print "Usage: python2 %s /path/to/wallet.json /path/to/destination/wallet.json" % sys.argv[0]
         sys.exit(1)

    src = sys.argv[1]
    dest = sys.argv[2]

    print "Opening wallet file %s..." % src
    f_src = open(src)
    jwallet = json.load(f_src)
    print "Deriving master private key..."
    hex_privkey = jwallet["master_private_key"]
    password = jwallet["wallet_password"]
    hex_password = hexlify(password)

    wallet = HDWallet(hex_privkey)
    child = wallet.get_child_keypairs(count=3, include_privkey=False)
  

    hex_privkey_1 = wallet.get_child_privkey(1)
    btc_privkey_1 = BitcoinPrivateKey(hex_privkey_1)
    wif_1 = btc_privkey_1.to_wif()
  
    hex_privkey_2 = wallet.get_child_privkey(0)
    btc_privkey_2 = BitcoinPrivateKey(hex_privkey_2)
    wif_2 = btc_privkey_2.to_wif()

    hex_privkey_3 = wallet.get_child_privkey(2)
    btc_privkey_3 = BitcoinPrivateKey(hex_privkey_3)
    wif_3 = btc_privkey_3.to_wif()

  
    master = wallet.get_master_privkey()
    btc_privkey = BitcoinPrivateKey(hex_privkey)
    priv_hex = btc_privkey.to_hex()
    priv_wif = btc_privkey.to_wif()

    btc = get_address_from_privkey(hex_privkey)
    btc_pub = get_pubkey_from_privkey(hex_privkey)

    data = {}
    encrypted_key = aes_encrypt(hex_privkey, hex_password)
    data['encrypted_master_private_key'] = encrypted_key
    data['payment_addresses'] = [child[0]]
    data['owner_addresses'] = [child[1]]

    file = open(dest, 'w')
    file.write(json.dumps(data))
    file.close()
    print ""
    print "Wallet created. Make sure to backup the following:"
    print ""
    print "-----"
    print "master_private_key:", hex_privkey
    print "wallet_password:", password
    print "-----"
    print ""
    print "-----"
    print "encrypted_master_private_key:", encrypted_key
    print "-----"
    print "owner_addresses:", [child[1]]
    print "owner_key_hex:", hex_privkey_1
    print "WIF owner:", wif_1
    print "-----"
    print "payment_addresses:", [child[0]]
    print "payment_key_hex", hex_privkey_2
    print "WIF payment:", wif_2
    print "-----"
    print "payment_addresses:", [child[2]]
    print "payment_key_hex", hex_privkey_3
    print "WIF payment:", wif_3
    print "-----"
    print ""
    print "FROM MASTER"
    print "Address:", btc
    print "Priv HEX:", priv_hex
    print "WIF Master:", priv_wif

I confirm that it outputs the private keys for a sample wallet I created.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
21XO (OP)
Jr. Member
*
Offline Offline

Activity: 57
Merit: 29


View Profile
February 04, 2021, 10:25:16 PM
 #99

Okay I pasted the updated code in text editor and saved it as 'dirty.py' on my desktop (where my wallet.json) file is. Here is what I got from Terminal:

Code:
parallels@parallels-Parallels-Virtual-Platform:~/Desktop$ python2 dirty.py wallet.json wallet2.json
Traceback (most recent call last):
  File "dirty.py", line 7, in <module>
    from registrar.wallet import HDWallet
ImportError: No module named registrar.wallet
parallels@parallels-Parallels-Virtual-Platform:~/Desktop$





escobol has sent me an updated script that works. The previous version malfunctions and terminates with a Python error, nothing malicious or anything, so don't use that one.

Use this updated one instead:

Code:
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
    Blockstack Legacy wallet crack

"""
from registrar.wallet import HDWallet
from registrar.crypto.utils import aes_encrypt, aes_decrypt
from registrar.crypto.utils import get_address_from_privkey, get_pubkey_from_privkey
from binascii import hexlify
from pybitcoin import BitcoinPrivateKey
import json
import sys
import os.path
import os
import base64


if __name__ == "__main__":
  
    result = {}
    print "Blockstack Legacy wallet crack"
    print "-----"
    print ""
    if len(sys.argv) != 3:
         print "Usage: python2 %s /path/to/wallet.json /path/to/destination/wallet.json" % sys.argv[0]
         sys.exit(1)

    src = sys.argv[1]
    dest = sys.argv[2]

    print "Opening wallet file %s..." % src
    f_src = open(src)
    jwallet = json.load(f_src)
    print "Deriving master private key..."
    hex_privkey = jwallet["master_private_key"]
    password = jwallet["wallet_password"]
    hex_password = hexlify(password)

    wallet = HDWallet(hex_privkey)
    child = wallet.get_child_keypairs(count=3, include_privkey=False)
  

    hex_privkey_1 = wallet.get_child_privkey(1)
    btc_privkey_1 = BitcoinPrivateKey(hex_privkey_1)
    wif_1 = btc_privkey_1.to_wif()
  
    hex_privkey_2 = wallet.get_child_privkey(0)
    btc_privkey_2 = BitcoinPrivateKey(hex_privkey_2)
    wif_2 = btc_privkey_2.to_wif()

    hex_privkey_3 = wallet.get_child_privkey(2)
    btc_privkey_3 = BitcoinPrivateKey(hex_privkey_3)
    wif_3 = btc_privkey_3.to_wif()

  
    master = wallet.get_master_privkey()
    btc_privkey = BitcoinPrivateKey(hex_privkey)
    priv_hex = btc_privkey.to_hex()
    priv_wif = btc_privkey.to_wif()

    btc = get_address_from_privkey(hex_privkey)
    btc_pub = get_pubkey_from_privkey(hex_privkey)

    data = {}
    encrypted_key = aes_encrypt(hex_privkey, hex_password)
    data['encrypted_master_private_key'] = encrypted_key
    data['payment_addresses'] = [child[0]]
    data['owner_addresses'] = [child[1]]

    file = open(dest, 'w')
    file.write(json.dumps(data))
    file.close()
    print ""
    print "Wallet created. Make sure to backup the following:"
    print ""
    print "-----"
    print "master_private_key:", hex_privkey
    print "wallet_password:", password
    print "-----"
    print ""
    print "-----"
    print "encrypted_master_private_key:", encrypted_key
    print "-----"
    print "owner_addresses:", [child[1]]
    print "owner_key_hex:", hex_privkey_1
    print "WIF owner:", wif_1
    print "-----"
    print "payment_addresses:", [child[0]]
    print "payment_key_hex", hex_privkey_2
    print "WIF payment:", wif_2
    print "-----"
    print "payment_addresses:", [child[2]]
    print "payment_key_hex", hex_privkey_3
    print "WIF payment:", wif_3
    print "-----"
    print ""
    print "FROM MASTER"
    print "Address:", btc
    print "Priv HEX:", priv_hex
    print "WIF Master:", priv_wif

I confirm that it outputs the private keys for a sample wallet I created.
HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4316

<insert witty quote here>


View Profile
February 04, 2021, 10:37:09 PM
 #100

Did you do all of the steps that escobol mentioned in their earlier post:
check

Code:
pip2 install registrar==0.0.3.4

------
Checked on new/clean Ubuntu 18.04 LTS

In terminal:

sudo apt-get update
sudo apt-get upgrade
sudo apt install python-minimal
sudo apt install python-pip
sudo apt-get install libssl-dev libffi-dev
pip2 install registrar==0.0.3.4

The important one is:
Code:
pip2 install registrar==0.0.3.4

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
Pages: « 1 2 3 4 [5] 6 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!