forked from Anarbb/BitGen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
109 lines (96 loc) · 2.93 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
from btcaddr import Wallet
from check import check_balance, last_seen
import threading
from multiprocessing.pool import ThreadPool as Pool
import argparse
import requests
import os
parser = argparse.ArgumentParser()
parser.add_argument(
"-t",
"--threads",
help="amount of threads (default: 100)",
type=int,
default=100,
)
parser.add_argument(
"-s",
"--savedry",
help="save empty wallets",
action="store_true",
default=False,
)
parser.add_argument(
"-p",
"--proxy",
help="use a proxy (host:port) (coming soon)",
)
parser.add_argument(
"--proxy_auth",
help="proxy credantials (user:pass) (coming soon)",
)
parser.add_argument(
"-v",
"--verbose",
help="increases output verbosity",
action="store_true",
)
args = parser.parse_args()
lock = threading.Lock()
class bcolors:
GREEN = "\033[92m" # GREEN
YELLOW = "\033[93m" # YELLOW
RED = "\033[91m" # RED
RESET = "\033[0m" # RESET COLOR
def makeDir():
path = "results"
if not os.path.exists(path):
os.makedirs(path)
def getInternet():
try:
try:
requests.get("http://1.1.1.1")
except requests.ConnectTimeout:
requests.get("https://1.0.0.1/")
return True
except requests.ConnectionError:
return False
def main():
with lock:
while 1:
wallet = Wallet()
prv = wallet.key.__dict__["mainnet"].__dict__["wif"]
addr = wallet.address.__dict__["mainnet"].__dict__["pubaddr1"]
balance = int(check_balance(addr))
if balance == 0:
if last_seen(addr) == 0:
if args.savedry:
with open("results/dry.txt", "a") as w:
w.write(
f"Address: {addr} | Balance: {balance} | Private key: {prv}\n"
)
print(f"{bcolors.RED}{addr} : {prv} : {balance} BTC")
else:
with open("results/moist.txt", "a") as w:
w.write(
f"Address: {addr} | Balance: {balance} | Private key: {prv} | Last seen: {last_seen(addr)}\n"
)
print(
f"{bcolors.YELLOW}{last_seen(addr)} : {balance} : {prv} : {addr}"
)
else:
with open("results/wet.txt", "a") as w:
w.write(
f"Address: {addr} | Balance: {balance} | Private key: {prv} | Last seen: {last_seen(addr)}\n"
)
print(f"{last_seen(addr)} {bcolors.OK} : {balance} : {prv} : {addr}")
if __name__ == "__main__":
if not getInternet():
print(bcolors.RED + "no internet connection")
makeDir()
threads = args.threads
pool = Pool(threads)
for _ in range(threads):
pool.apply_async(main, ())
pool.close()
pool.join()