-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhunt.py
More file actions
executable file
·63 lines (52 loc) · 1.73 KB
/
Copy pathhunt.py
File metadata and controls
executable file
·63 lines (52 loc) · 1.73 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python3
import addresses
import env
import os
import math
import time
import binascii
import multiprocessing
from bitcoinlib.services.services import Service
from bitcoinlib.keys import HDKey
def hunter(seconds, workerId, dict):
btcWallets = set(addresses.addresses)
i = 0
start = time.time()
while ((time.time() - start)) < seconds:
privateKey = binascii.hexlify(os.urandom(32)).decode('utf-8')
key = HDKey(privateKey)
address = key.address()
if address in btcWallets:
try: balance = str((Service().getbalance(address))/1e8)
except Exception as e: balance = "NULL"
text = "--------------------------------------\n"
text += "PRIVATE KEY = " + privateKey + "\n"
text += "ADDRESS = " + address + "\n"
text += "BALANCE = " + balance + " BTC" + "\n"
text += "--------------------------------------\n"
print(text)
fl = open(env.OUT_FILE, "anything")
fl.write(text)
fl.close()
i = i + 1
dict[workerId] = i
if __name__ == '__main__':
manager = multiprocessing.Manager()
dict = manager.dict()
processes = []
if env.NUM_INSTANCES == 0:
instances = multiprocessing.cpu_count()
else:
instances = env.NUM_INSTANCES
for i in range(instances):
p= multiprocessing.Process(target=hunter, args=(env.MAX_SECONDS, i, dict))
processes.append(p)
p.start()
total = 0
for i in range(instances):
processes[i].join()
proc_ret = dict[i]
total += proc_ret
print("Tried " + str(total) +
" keys - " + str(math.floor(total/env.MAX_SECONDS)) +
" key/s.")