forked from donspablo/bitscanner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbitscanner.py
executable file
Β·131 lines (116 loc) Β· 3.11 KB
/
bitscanner.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
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
M = True
N = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
O = print
P = enumerate
Q = divmod
H = len
I = open
J = range
A = str
import os, pickle as E, hashlib as C, binascii as D, multiprocessing as R
from ellipticcurve.privateKey import PrivateKey as V
K = "database/"
def W():
return D.hexlify(os.urandom(32)).decode("utf-8").upper()
def X(private_key):
A = V().fromString(bytes.fromhex(private_key))
return "04" + A.publicKey().toString().hex().upper()
def Y(public_key):
F = "00"
A = []
G = N
B = C.new("ripemd160")
I = D.unhexlify(public_key.encode())
B.update(C.sha256(I).digest())
K = (F + B.hexdigest()).encode()
L = C.sha256(D.unhexlify(K)).digest()
H = F + B.hexdigest() + C.sha256(L).hexdigest()[0:8]
O = [A != "0" for A in H].index(M) // 2
E = int(H, 16)
while E > 0:
E, P = Q(E, 58)
A.append(G[P])
for R in J(O):
A.append(G[0])
return "".join(A[::-1])
def Z(private_key, public_key, address, database):
F = "\n"
G = "Wallet Address: "
H = "a"
J = public_key
C = database
D = private_key
B = address
if B in C[0] or B in C[1] or B in C[2] or B in C[3]:
with I("success.txt", H) as E:
E.write(
G + F
+ A(B) + F
+ "Public Key: "
+ A(J) + F
+ "Private Key (Hex): "
+ A(D) +F
+ "Private Key (WIF): "
+ A(S(D))
+ F + F
)
else:
with I("failed.txt", H) as E:
E.write(
+ G + F
+ A(B) + F
+ "Public key: "
+ A(J) + F
+ "Private Key (Hex): "
+ A(D) + F
+ "Private Key (WIF): "
+ A(S(D))
+ F + F
)
def S(private_key):
I = "80"
J = private_key
M = C.sha256(D.unhexlify(I + J)).hexdigest()
E = C.sha256(D.unhexlify(M)).hexdigest()
E = D.unhexlify(I + J + E[0:8])
K = F = N
A = L = 0
B = ""
for (O, G) in P(E[::-1]):
A += 256 ** O * G
while A >= H(K):
R, S = Q(A, H(K))
B, A = F[S] + B, R
B = F[A] + B
for G in E:
if G == 0:
L += 1
else:
break
return F[0] * L + B
def a(database):
while M:
A = W()
B = X(A)
C = Y(B)
Z(A, B, C, database)
if __name__ == "__main__":
B = [set() for A in J(4)]
T = H(os.listdir(K))
L = T // 2
U = L // 2
for (F, b) in P(os.listdir(K)):
O("\rscanning bitcoin database(s): " + A(F + 1) + "/" + A(T), end=" ")
with I(K + b, "rb") as G:
if F < L:
if F < U:
B[0] = B[0] | E.load(G)
else:
B[1] = B[1] | E.load(G)
elif F < L + U:
B[2] = B[2] | E.load(G)
else:
B[3] = B[3] | E.load(G)
O("Scan Completed, Bitscanner initialized!")
for c in J(R.cpu_count()):
R.Process(target=a, args=(B,)).start()