diff --git a/btcrecover/btcrpass.py b/btcrecover/btcrpass.py index 71566c79..67ef3330 100644 --- a/btcrecover/btcrpass.py +++ b/btcrecover/btcrpass.py @@ -176,8 +176,8 @@ def init_wildcards(wildcard_custom_list_e = None, # N.B. that tstr() will not convert string.*case to Unicode correctly if the locale has # been set to one with a single-byte code page e.g. ISO-8859-1 (Latin1) or Windows-1252 wildcard_sets = { - tstr("h") : tstr(string.hexdigits), - tstr("*") : tstr("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"), + tstr("H") : tstr(string.hexdigits), + tstr("B") : tstr("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"), tstr("d") : tstr(string.digits), tstr("a") : tstr(string.ascii_lowercase), tstr("A") : tstr(string.ascii_uppercase), @@ -4856,8 +4856,10 @@ def return_verified_password_or_false(self, passwords): # Raw Privatekey #Work out what kind of private key we are handling WIFPrivKey = False + if len(password) == 64: # Likely Hex Private Key (Don't need to do anything) pass + elif len(password) == 52 and password[0] in ["L","K"]: #Compressed Private Key try: password = binascii.hexlify(base58.b58decode_check(password)[1:-1]) @@ -4871,7 +4873,8 @@ def return_verified_password_or_false(self, passwords): # Raw Privatekey WIFPrivKey = True except: continue - + else: # Unsupported Private Key + continue # Convert the private key from text to raw private key... try: diff --git a/docs/Usage_Examples/basic_password_recoveries.md b/docs/Usage_Examples/basic_password_recoveries.md index 20a02498..d07a3083 100644 --- a/docs/Usage_Examples/basic_password_recoveries.md +++ b/docs/Usage_Examples/basic_password_recoveries.md @@ -357,7 +357,7 @@ python btcrecover.py --slip39 --wallet-type ethereum --addrs 0x0Ef61684B1E671dcB ## Raw Private Keys## BTCRecover an also be used to recover from situations where you have a damaged private key. -This is handled in a similar way to a password recovery, so your private key guesses go in a tokenlist, using the %h wildcard to substitute hexidecimal characters or %b to substitute base58 characters. You can use either a tokenlist or a passwordlist, depending on your situation, as well as the standard typos. If you are using a tokenlist, you will just need to ensure that the private keys being produced match the length and characters required for a private key... +This is handled in a similar way to a password recovery, so your private key guesses go in a tokenlist, using the %H wildcard to substitute hexidecimal characters or %B to substitute base58 characters. You can use either a tokenlist or a passwordlist, depending on your situation, as well as the standard typos. If you are using a tokenlist, you will just need to ensure that the private keys being produced match the length and characters required for a private key... If you know the address that the private key corresponds to, you can supply that, alternatively you can use an AddressDB. @@ -369,7 +369,7 @@ You will also notice that the leading "0x" needs to be removed from the private {% include "eth_privkey_tokenlist.txt" %} ``` -The tokenlist above is an example is a standard Eth private key (with the leading 0x removed) where there are three damanged parts. One single character (%h), one two-character (%2h) and one three-character (%3h) It will take about 20 mintes to run... +The tokenlist above is an example is a standard Eth private key (with the leading 0x removed) where there are three damanged parts. One single character (%H), one two-character (%2H) and one three-character (%3H) It will take about 20 mintes to run... ``` python btcrecover.py --rawprivatekey --addrs 0xB9644424F9E639D1D0F27C4897e696CC324948BB --wallet-type ethereum --tokenlist ./docs/Usage_Examples/eth_privkey_tokenlist.txt diff --git a/docs/Usage_Examples/btc_privkey_tokenlist.txt b/docs/Usage_Examples/btc_privkey_tokenlist.txt index e408e690..aafcca99 100644 --- a/docs/Usage_Examples/btc_privkey_tokenlist.txt +++ b/docs/Usage_Examples/btc_privkey_tokenlist.txt @@ -1,4 +1,4 @@ 1ADF94484E9C820D69BC9770542B678DB677E7C354DC4BD27D7E9AC351698CB7 -KzTgU27AYQSojvpXaJHS5rm%*oB7k83Q3oCDGAeoD3Rz2BbLFoP19 -5JYsdUthE1KzGA%*Xwfomeocw6vwzoTNXzcbJq9e7LcAyt1Svoo8 -KzPyZwq13F8tyXJ9si1ovGYo%*btQADi6qD9XbDHRWtfWud7PriHV \ No newline at end of file +KzTgU27AYQSojvpXaJHS5rm%BoB7k83Q3oCDGAeoD3Rz2BbLFoP19 +5JYsdUthE1KzGA%BXwfomeocw6vwzoTNXzcbJq9e7LcAyt1Svoo8 +KzPyZwq13F8tyXJ9si1ovGYo%BbtQADi6qD9XbDHRWtfWud7PriHV \ No newline at end of file diff --git a/docs/Usage_Examples/eth_privkey_tokenlist.txt b/docs/Usage_Examples/eth_privkey_tokenlist.txt index c541050a..6cafff74 100644 --- a/docs/Usage_Examples/eth_privkey_tokenlist.txt +++ b/docs/Usage_Examples/eth_privkey_tokenlist.txt @@ -1 +1 @@ -5db77aa7aea5%2h7d6b4c64dab21%h972cf4763d4937d3e6e17f580436dcb10%3h \ No newline at end of file +5db77aa7aea5%2H7d6b4c64dab21%H972cf4763d4937d3e6e17f580436dcb10%3H \ No newline at end of file diff --git a/docs/tokenlist_file.md b/docs/tokenlist_file.md index c728df48..676dbb91 100644 --- a/docs/tokenlist_file.md +++ b/docs/tokenlist_file.md @@ -180,8 +180,8 @@ The `%d` is a wildcard which is replaced by all combinations of a single digit. * `%%` - a single `%` (so that `%`’s in your password aren’t confused as wildcards) * `%^` - a single `^` (so it’s not confused with an anchor if it’s at the beginning of a token) * `%S` - a single `$` (yes, that’s `%` and a capital `S` that gets replaced by a dollar sign, sorry if that’s confusing) - * `%h` - a single hexidcimal character (0-9, A-F) - * `%*` - a single Base58 character (Bitcoin Base58 Character Set) + * `%H` - a single hexidcimal character (0-9, A-F) + * `%B` - a single Base58 character (Bitcoin Base58 Character Set) * `%U` - a single Unicode character (All Unicode characters up to 65,535) * `%e` - Custom String Repeating wildcard, [Read about behaviour and usage](custom_wildcards.md) * `%f` - Custom String Repeating wildcard, [Read about behaviour and usage](custom_wildcards.md)