-
Notifications
You must be signed in to change notification settings - Fork 0
/
check.py
51 lines (39 loc) · 1.19 KB
/
check.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
import urllib3.request
import os
from datetime import datetime
log_dir = './log/'
log_name = 'debug.log'
log_file = open(log_dir+log_name, 'w')
def getDate():
return datetime.today().strftime('%Y-%m-%d-%H:%M:%S')
def logging(text):
global log_file
time = getDate()
log_file.write(time+" "+str(text)+"\n")
def writeJson(num, data):
log = open("result/check/"+str(num)+".json", 'a')
log.write(data)
log.close()
http = urllib3.PoolManager()
start_url = "https://hackerone.com/reports/"
end_url = ".json"
limit = 1000000
for idx,val in enumerate(range(1,limit)):
#time.sleep(3)
fname = './result/check/'+str(val)+".json"
url = start_url+str(val)+end_url
logging("Progress : "+"("+str(val)+"/"+str(limit)+")")
logging(url)
if not os.path.exists(fname):
try:
#r = http.request('GET', url, timeout=3)
r = http.request('GET', url)
except Exception as e:
logging(str(traceback.print_tb(e.__traceback__)))
logging(r.status)
if r.status == 200:
#logging("Success")
writeJson(str(val), r.data.decode('utf-8'))
else:
logging("Fail")
log_file.close()