-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
73 lines (60 loc) · 1.91 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
from html.parser import HTMLParser
import requests
import random
def checkAdr(adr, privateKey):
# print(adr, privateKey)
r = requests.get('https://blockchain.info/address/' + adr + '?format=json&offset=0')
if r.status_code == 200:
j = r.json()
balance = j['final_balance']
balanceRe = j['total_received']
if balance > 0:
print(balance, 'adr:', adr, 'privateKey:', privateKey)
if balanceRe > 0:
print('re:', balanceRe, 'adr:', adr, 'privateKey:', privateKey)
else:
print('status code is not 200')
class MyHTMLParser(HTMLParser):
def __init__(self):
self.counter = 0
self.getA = 0
super().__init__()
def handle_starttag(self, tag, attrs):
if tag == 'span':
self.counter += 1
if self.counter == 1:
# print('attrs:', attrs)#private Key
self.curPrivateKey = attrs[0][1]
if self.counter == 2:
self.getA = 1
def handle_endtag(self, tag):
if tag == 'span':
self.counter -= 1
def handle_data(self, data):
if self.getA != 0 and self.getA != 3:
self.getA += 1
elif self.getA == 3:
# print('data:', data)#public key
checkAdr(data, self.curPrivateKey)
self.getA = 0
parser = MyHTMLParser()
def doPage(p):
page = requests.get('http://directory.io/' + str(p))
parser.feed(page.text)
print('page', p, 'done')
# done:
# 1 299
# 1000 1010
# 1111
# 1111111111
# 123456789042
# 100000000000000000000
# 10000000000000000000000000000000 10000000000000000000000000000010
def doRange(f, t):
for x in range(f, t):
doPage(x)
#for x in range(1, 11):
# x_ = 10**x
# doRange(x_, x_ + 11)
for x in range(100):
doPage(random.randint(1, 904625697166532776746648320380374280100293470930272690489102837043110636675))