forked from ashraful1978/iceFind
-
Notifications
You must be signed in to change notification settings - Fork 1
/
iceFind.py
269 lines (240 loc) · 10.4 KB
/
iceFind.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
import random, time, sys, os, hmac, struct, datetime, subprocess
from datetime import datetime
from random import randint
import hashlib, base58, binascii, threading, json
import secp256k1 as ice
import multiprocessing, multiprocessing.pool, threading, logging, traceback, concurrent.futures, re
from threading import Lock, Thread, enumerate
from multiprocessing import Pool, Event, Process, Queue, Value, cpu_count
def RandomInteger(minN, maxN):
return random.randrange(minN, maxN)
def load_settings():
global coins_to_search, start_range, end_range, arr, stop, settings_config
filename = "config.json"
settings_config = json.loads(open(f"{filename}","r").read())
coins_string = ""
for coin in settings_config["coins"]:
if settings_config["coins"][coin]["enabled"] == True:
coins_to_search.append(coin)
load_addresses(settings_config["coins"][coin]["address_file"])
for coin in coins_to_search: coins_string += " - "+coin+"\n"
addr_count = len(arr)
now = datetime.now()
time = now.strftime("%H:%M:%S")
print(f"[{time}] Addresses loaded: " + str(addr_count))
print(f"""
Change Script Configurations at: \"{filename}\"
""")
range = settings_config["myRange"]
start_range = range["min"]
end_range = range["max"]
jump_size = settings_config["jump_size"]
if end_range > 904625697166532776746648320380374280100293470930272690489102837043110636675 or start_range<1:
print("\n Invalid range!\n Change Range at \"config.json\" before executing!\n")
stop = True
if stop == False:
print(f"""
Searching from {start_range} to {end_range}
Magnitude/Jump {jump_size}
""")
def load_addresses(filename):
global addresses, arr
now = datetime.now()
time = now.strftime("%H:%M:%S")
print(f"[{time}] Creating database from \"{filename}\" ...Please Wait...")
with open(filename) as in_file:
for addr in in_file:
bit_addr = addr.strip()
arr.add(bit_addr)
def get_page(page):
global addresses, arr, coins_to_search, found, settings_config, actual_page
actual_page = page
#default Values
max = 904625697166532776746648320380374280100293470930272690489102837043110636675
stride = 1
num = int(page,10)
previous = num - 1
if previous == 0:
previous = 1
next = num + stride
if next > max:
next = max
startPrivKey = (num - 1) * 128+1
starting_key_hex = hex(startPrivKey)[2:].zfill(64)
if startPrivKey == 115792089237316195423570985008687907852837564279074904382605163141518161494273:
ending_key_hex = hex(startPrivKey+63)[2:].zfill(64)
else:
ending_key_hex = hex(startPrivKey+127)[2:].zfill(64)
for i in range(0,128):
dec = int(startPrivKey)
HEX = "%064x" % dec
privKey_C = ice.btc_pvk_to_wif(HEX)
privKey = ice.btc_pvk_to_wif(HEX, False)
starting_key_hex = hex(startPrivKey)[2:].zfill(64)
privKeyPage = str(int(str(starting_key_hex),16)/128).split(".")[0]
if startPrivKey == 115792089237316195423570985008687907852837564279074904382605163141518161494336:
break
for coin in coins_to_search:
if coin == "BTC":
CAddr = ice.privatekey_to_address(0, True, dec).strip() # Compressed
UAddr = ice.privatekey_to_address(0, False, dec).strip() # Uncompressed
SAddr = ice.privatekey_to_address(1, True, dec).strip() # P2SH
BAddr = ice.privatekey_to_address(2, True, dec).strip() # Bech32
if CAddr in arr or UAddr in arr or SAddr in arr or BAddr in arr:
found+=1
with open("winner.txt", "a", encoding="utf-8") as f:
output = f"""\n
=====================================
: Private Key Page : {privKeyPage}
: Private Key HEX : {starting_key_hex}
: Private Key WIF UnCompressed : {privKey}
: Private Key WIF Compressed : {privKey_C}
=====================================
: BTC Address Compressed : {CAddr}
: BTC Address UnCompressed : {UAddr}
: BTC Address Bech32 : {BAddr}
: BTC Address Segwit : {SAddr}
====================================="""
f.write(output)
startPrivKey += 1
addresses.clear()
def search(typeScan):
global start_time, total_tested_pages, start_range, end_range, stop, sequencialTypes
while stop == False:
try:
if typeScan==typeScans[0]:
try:
jump_size = settings_config["jump_size"]
i = start_range
while i<=end_range:
get_page(str(i))
total_tested_pages += 1
i+=jump_size
except Exception as e:
print(str(e))
stop = True
elif typeScan==typeScans[1]:
try:
jump_size = settings_config["jump_size"]
i = end_range
while i>=start_range:
get_page(str(i))
total_tested_pages += 1
i-=jump_size
except Exception as e:
print(str(e))
stop = True
elif typeScan==typeScans[2]:
for i in range(start_range,end_range):
try:
get_page(str(i))
total_tested_pages += 1
except Exception as e:
print(str(e))
stop = True
elif typeScan==typeScans[3]:
for i in reversed(range(start_range,end_range)):
try:
get_page(str(i))
total_tested_pages += 1
except Exception as e:
print(str(e))
stop = True
elif typeScan==typeScans[4]:
try:
basePage = RandomInteger(start_range,end_range)
stSeqRand = basePage-1000
edSeqRand = basePage+1000
for i in range(stSeqRand,edSeqRand):
get_page(str(i))
total_tested_pages += 1
except Exception as e:
print(str(e))
elif typeScan==typeScans[5]:
while True:
try:
page = str(RandomInteger(start_range,end_range))
get_page(page)
total_tested_pages += 1
except Exception as e:
print(str(e))
break
elif typeScan==typeScans[6]:
try:
for i in range(start_range,end_range):
if i%2==0:
get_page(str(i))
total_tested_pages += 1
except Exception as e:
print(str(e))
stop = True
elif typeScan==typeScans[7]:
try:
for i in reversed(range(start_range,end_range)):
if i%2==0:
get_page(str(i))
total_tested_pages += 1
except Exception as e:
print(str(e))
stop = True
elif typeScan==typeScans[8]:
try:
for i in range(start_range,end_range):
if i%2!=0:
get_page(str(i))
total_tested_pages += 1
except Exception as e:
print(str(e))
stop = True
elif typeScan==typeScans[9]:
try:
for i in reversed(range(start_range,end_range)):
if i%2!=0:
get_page(str(i))
total_tested_pages += 1
except Exception as e:
print(str(e))
stop = True
else:
break
except Exception as e:
print(str(e))
def search_stats():
global start_time, total_tested_pages, typeScan, coins_to_search, stop, actual_page
while stop == False:
now = time.time()
since_start = now - start_time
try:
pages_per_second = int(total_tested_pages/since_start)*10
addresses_per_second = pages_per_second*128*len(coins_to_search)
except:
pages_per_second = 0
addresses_per_second = (pages_per_second*128)*len(coins_to_search)
dots = random.choice([" ","> ",">> ",">>>"])
print(" Searching %s [%s Addresses/s - %s Pages/s] | MODE: %s | Actual Page: %s | Found: %s"%(dots,addresses_per_second,pages_per_second,typeScan,actual_page,found), end="\r")
if __name__ == "__main__":
addresses = list()
arr = set()
found = start_rang = end_range = total_tested_pages = 0
stop = False
coins_to_search = []
start_time = time.time()
settings_config = {}
load_settings()
if stop == False:
typeScans = ["Range + Jump [Forward]","Range + Jump [Backward]","Sequencial [Forward]","Sequencial [Backward]","Sequencial + Random","Random","Odd Numbers [Forward]","Odd Numbers [Backward]","Even Numbers [Forward]","Even Numbers [Backward]"]
scanN = 0
print(" Please choose how to scan:")
for scan in typeScans:
print(" ",scanN,"=>",scan)
scanN+=1
inputUserTypeScan = -1
while inputUserTypeScan<0 or inputUserTypeScan>len(typeScans):
inputUserTypeScan = int(input("\n Scan Type Number : "))
typeScan = typeScans[inputUserTypeScan]
nThreads = 1
for i in range(nThreads):
x = threading.Thread(target=search, args=(typeScan,))
x.start()
x = threading.Thread(target=search_stats)
x.start()