-
Notifications
You must be signed in to change notification settings - Fork 18
/
scan.py
37 lines (32 loc) · 1.29 KB
/
scan.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from privatekey import PrivateKey
from bit import Key
class Scan:
def __init__(self, file, wordlist):
self.file = file
self.wordlist = wordlist
self.pkey = PrivateKey()
self.discoveries = []
self.balancetotal = 0
self.noemptyaddr = 0
def launch(self, compressed=False):
for password in self.wordlist:
self.pkey.from_passphrase(password)
if compressed:
wif = self.pkey.privatekey_to_wif(compressed=True)
else:
wif = self.pkey.privatekey_to_wif()
key = Key(wif)
balance = key.get_balance('btc')
# If the balance is not empty
if balance != "0":
if key.address not in self.discoveries:
print(f'{key.address} : {balance}')
self.discoveries.append(key.address)
self.file.write_discovery(key.address, password, self.pkey.wif, balance)
self.balancetotal += float(balance)
self.noemptyaddr += 1
else:
print(f'Empty balance for : {password}')
print(f'You have found a total of {self.balancetotal} btc')
print(f'Addresses with btc : {self.noemptyaddr}')
return self.discoveries