This repository has been archived by the owner on Jun 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiota_recovery.py
73 lines (57 loc) · 2.07 KB
/
iota_recovery.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
from iota import Iota
from string import ascii_uppercase
char_set = ascii_uppercase + "9"
# Generates addresses of a given seed using the "get_new_addresses()" function
def addressGenerator(seed, iota_node, n_addresses):
api = Iota(iota_node, seed)
gna_result = api.get_new_addresses(count=n_addresses) # This is the actual function to generate the addresses
addresses = gna_result['addresses']
total = 0
i = 0
founds = []
while i < n_addresses:
address = [addresses[i]]
balance = addressBalance(address, iota_node)
print ("Address " + str(address[0]) + " has a balance of: " + str(balance))
total += balance
i += 1
if balance:
founds.append(address)
if total > 0:
print ("The above addresses have a total balance of " + str(total) + " Iota tokens!!!")
return founds
else:
print ("No balance on those addresses!")
return False
# Sends a request to the IOTA node and gets the current confirmed balance
def addressBalance(address, iota_node):
api = Iota(iota_node)
gb_result = api.get_balances(address)
balance = gb_result['balances']
return (balance[0])
def generateSeedAddresses(iota_target_seed, n_addresses, iota_node):
money_found = False
for idx, character in enumerate(iota_target_seed):
idxp = idx+1
print("\n----Current step: {} letter replaced {}".format(idx, character))
for new_char in char_set:
print("--Using", new_char)
working_seed = iota_target_seed[:idx] + new_char + iota_target_seed[idxp:]
money_found = addressGenerator(working_seed, iota_node, n_addresses)
if money_found:
print("MONEY FOUND!!! SEED: {}, WALLETS: {}".format(working_seed, money_found))
print("\n\n\n\n\n\n")
break
if money_found:
break
def main():
# Get inputs
iota_target_seed = str(input("Target seed: "))
n_addresses = int(input("Number of addresses: "))
iota_node = "https://nodes.iota.cafe:443" # Node Server
print ("This can take a while...")
print("\n\n\n")
# Start generation of seeds and checking its balance
generateSeedAddresses(iota_target_seed, n_addresses, iota_node)
if __name__ == '__main__':
main()