-
Notifications
You must be signed in to change notification settings - Fork 9
/
OnTimeHacker.py
432 lines (400 loc) · 17 KB
/
OnTimeHacker.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
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
#!/usr/bin/env python3
# _*_ coding:utf-8 _*_
'''
Program:OnTimeHacker
Function:Get Src Notice OnTime
Version:Python3
Create_Time:2021/4/15
Update_Time:2022/3/23
Author:bywalks
Blog:http://www.bywalks.com
Github:https://github.com/bywalks
'''
import sys
import json
import time
from requests.packages import urllib3
import requests
from bs4 import BeautifulSoup
banner = '''
____ _______ _ _ _ _
/ __ \ |__ __(_) | | | | | |
| | | |_ __ | | _ _ __ ___ ___| |__| | __ _ ___| | _____ _ __
| | | | '_ \| | | | '_ ` _ \ / _ | __ |/ _` |/ __| |/ / _ | '__|
| |__| | | | | | | | | | | | | __| | | | (_| | (__| | __| |
\____/|_| |_|_| |_|_| |_| |_|\___|_| |_|\__,_|\___|_|\_\___|_|
By Bywalks | V 1.1
[+]爬取各个SRC平台的公告通知
[+]对各大SRC当日推出公告进行推送到微信,结合系统定时任务可实现SRC平台公告监测
[+]目前支持的SRC平台[当前共计23家]:
360、爱奇艺、阿里、百度、哔哩哔哩、贝壳、Boss、58、菜鸟、滴滴、斗鱼、
瓜子、合合、享道、京东、焦点、快手、美团、水滴、顺丰、腾讯、中通、字节
'''
urllib3.disable_warnings()
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36'
}
def Send_VX(src_name, src_title):
notice = "[+]%s今日存在公告通知:%s" %(src_name,src_title)
print(notice)
try:
requests.get('https://sc.ftqq.com/%s.send?text=%s&desp=%s' % (key,src_name,src_title))
except Exception as e:
print(e)
def src_360():
print("[+]开始监测360 SRC..")
try:
url = 'https://security.360.cn/News/news?type=-1'
r = requests.get(url, headers=headers,timeout=5,verify=False)
bs = BeautifulSoup(r.text, 'lxml')
notice_list = bs.select('.news-content')[0].select('li')
src_time = notice_list[4].select('.new-list-time')[0].text.strip()
src_title = notice_list[4].select('a')[0].text
if src_time == current_time:
Send_VX("360",src_title)
except Exception as e:
print(e)
def iqiyi():
print("[+]开始监测爱奇艺 SRC..")
try:
url = 'https://security.iqiyi.com/api/publish/notice/list?sign=6ce5b4f7ad460b2ae3046422f61f905e4e3ecd03'
r = requests.get(url,headers=headers,timeout=5,verify=False)
r_json = json.loads(r.text)
notice_list = r_json['data']
src_time = notice_list[0]['create_time_str']
src_title = notice_list[0]['title']
if src_time == current_time:
Send_VX('爱奇艺',src_title)
except Exception as e:
print(e)
def alibaba():
print("[+]开始监测阿里巴巴 SRC..")
try:
url = 'https://security.alibaba.com/api/asrc/pub/announcements/list.json?&page=1'
r = requests.get(url,headers=headers,timeout=5,verify=False)
r_json = json.loads(r.text)
notice_list = r_json['data']['rows']
src_time = notice_list[0]['lastModify'].split(' ')[0]
src_title = notice_list[0]['title']
if src_time == current_time:
Send_VX('阿里',src_title)
except Exception as e:
print(e)
def baidu():
print("[+]开始监测百度 SRC..")
try:
url = 'https://bsrc.baidu.com/v2/api/announcement?type=&page=1&pageSize=10'
r = requests.get(url,headers=headers,timeout=5,verify=False)
r_json = json.loads(r.text)
notice_list = r_json['retdata']['announcements']
src_time = notice_list[0]['createTime'].split(' ')[0]
src_title = notice_list[0]['title']
if src_time == current_time:
Send_VX('百度', src_title)
except Exception as e:
print(e)
def bilibili():
print("[+]开始监测哔哩哔哩 SRC..")
try:
url = 'https://security.bilibili.com/announcement/'
r = requests.get(url,headers=headers,timeout=5,verify=False)
bs = BeautifulSoup(r.text, 'lxml')
notice_list = bs.select('td')
src_time = notice_list[2].text.replace('\n', '')
src_title = notice_list[3].text.replace('\n', '')
if src_time == current_time:
Send_VX('哔哩哔哩', src_title)
except Exception as e:
print(e)
def ke():
print("[+]开始监测贝壳 SRC..")
try:
url = 'https://security.ke.com/api/notices/list'
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36',
'Referer': 'https://security.ke.com/notices'
}
r = requests.post(url, headers=headers, data={"page": 1})
r_json = json.loads(r.text)
notice_list = r_json['data']['list']
src_time = notice_list[0]['createTime'].split(' ')[0]
src_title = notice_list[0]['title']
if src_time == current_time:
Send_VX('贝壳', src_title)
except Exception as e:
print(e)
def boss():
print("[+]开始监测Boss SRC..")
try:
url = 'https://src.zhipin.com/announcement'
r = requests.get(url,headers=headers,timeout=5,verify=False)
bs = BeautifulSoup(r.text, 'lxml')
notice_list = bs.select('.announcement_list')[0].select('li')
src_time = notice_list[0].select('.list_date')[0].text.strip()[0:4]+"-"+notice_list[0].select('.list_date')[0].text.strip()[5:7]+"-"+notice_list[0].select('.list_date')[0].text.strip()[8:10]
src_title = notice_list[0].select('.list_title')[0].text
if src_time == current_time:
Send_VX('贝壳', src_title)
except Exception as e:
print(e)
def src_58():
print("[+]开始监测58 SRC..")
try:
url = 'https://security.58.com/notice/'
r = requests.get(url,headers=headers,timeout=5,verify=False)
bs = BeautifulSoup(r.text, 'lxml')
notice_list = bs.select('.time')
src_time = notice_list[0].text
src_title = bs.select('.box')[0].select('a')[0].text
if src_time == current_time:
Send_VX('贝壳', src_title)
except Exception as e:
print(e)
def cainiao():
print("[+]开始监测菜鸟 SRC..")
try:
url = 'https://sec.cainiao.com/announcement.htm'
r = requests.get(url,headers=headers,timeout=5,verify=False)
bs = BeautifulSoup(r.text, 'lxml')
notice_list = bs.select('td')
src_time = notice_list[0].text.split('\n')[0].strip().split('][')[0].replace('[', '')
src_title = notice_list[0].text.split('\n')[1].strip()
if src_time == current_time:
Send_VX('菜鸟', src_title)
except Exception as e:
print(e)
def didi():
print("[+]开始监测滴滴 SRC..")
try:
url = 'http://sec.didichuxing.com/rest/article/list?page=1&size=5&option=0'
r = requests.get(url,headers=headers,timeout=5,verify=False)
r_json = json.loads(r.text)
notice_list = r_json['data']
timeStamp = notice_list[0]['time']
src_time = time.strftime("%Y-%m-%d", time.localtime(float(timeStamp / 1000)))
src_title = notice_list[0]['title']
if src_time == current_time:
Send_VX('滴滴', src_title)
except Exception as e:
print(e)
def douyu():
print("[+]开始监测斗鱼 SRC..")
try:
url = 'https://security.douyu.com/api/v1/announcement_list?announcement_type=1¤t=1&size=10'
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36',
'Referer': 'https://security.douyu.com/'
}
r = requests.get(url,headers=headers,timeout=5,verify=False)
r_json = json.loads(r.text)
notice_list = r_json['data']['records']
src_time = notice_list[0]['publish_time']
src_title = notice_list[0]['title']
if src_time == current_time:
Send_VX('斗鱼', src_title)
except Exception as e:
print(e)
def guazi():
print("[+]开始监测瓜子 SRC..")
try:
url = 'https://security.guazi.com/gzsrc/notice/queryNoticesList'
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36'}
r = requests.post(url, headers=headers, data="pageNo=1")
r_json = json.loads(r.text)
notice_list = r_json['data']['list']
src_time = notice_list[0]['publishDate'].split(' ')[0]
src_title = notice_list[0]['title']
if src_time == current_time:
Send_VX('瓜子', src_title)
except Exception as e:
print(e)
def hehe():
print("[+]开始监测合合 SRC..")
try:
url = 'https://security.intsig.com/index.php?m=&c=page&a=index'
r = requests.get(url,headers=headers,timeout=5,verify=False)
bs = BeautifulSoup(r.text, 'lxml')
notice_list = bs.select('.announcement_list')[0].select('li')
src_time = notice_list[0].select('.list_date')[0].text.strip()[0:4]+"-"+notice_list[0].select('.list_date')[0].text.strip()[5:7]+"-"+notice_list[0].select('.list_date')[0].text.strip()[8:10]
src_title = notice_list[0].select('.list_title')[0].text
if src_time == current_time:
Send_VX('合合', src_title)
except Exception as e:
print(e)
def xiangdao():
print("[+]开始监测享道 SRC..")
try:
url = 'https://src.saicmobility.com/news/'
r = requests.get(url,headers=headers,timeout=5,verify=False)
bs = BeautifulSoup(r.text, 'lxml')
src_time = bs.select('.side')[0].select('.news-date')[0].text.strip()[0:4]+"-"+bs.select('.side')[0].select('.news-date')[0].text.strip()[5:6]+"-"+bs.select('.side')[0].select('.news-date')[0].text.strip()[7:9]
src_title = bs.select('.side')[0].select('.news-title')[0].text
if '-' in src_time[5:7]:
src_time=src_time[0:5]+"0"+src_time[5:9]
if src_time == current_time:
Send_VX('享道', src_title)
except Exception as e:
print(e)
def jd():
print("[+]开始监测京东 SRC..")
try:
url = 'https://security.jd.com/notice/list?parent_type=2&child_type=0&offset=0&limit=12'
r = requests.get(url,headers=headers,timeout=5,verify=False)
r_json = json.loads(r.text)
notice_list = r_json['data']['notices']
src_time = notice_list[0]['CreateTime'].split(' ')[0]
src_title = notice_list[0]['Title']
if src_time == current_time:
Send_VX('京东', src_title)
except Exception as e:
print(e)
def jiaodian():
print("[+]开始监测焦点 SRC..")
try:
url = 'https://security.focuschina.com/home/announcement.html'
r = requests.get(url,headers=headers,timeout=5,verify=False)
bs = BeautifulSoup(r.text, 'lxml')
notice_list = bs.select('.content-bd')[0].select('li')
src_time = notice_list[0].select('.anno-lst-date')[0].text.strip()
src_title = notice_list[0].select('a')[0].text.strip()[16:36]
if src_time == current_time:
Send_VX('焦点', src_title)
except Exception as e:
print(e)
def kuaishou():
print("[+]开始监测快手 SRC..")
try:
url = 'https://security.kuaishou.com/api/user/notice/list?'
headers = {
'Referer': 'https://security.kuaishou.com/',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36'}
r = requests.get(url, headers=headers,timeout=5,verify=False)
r_json = json.loads(r.text)
notice_list = r_json['data']
recent_notice = notice_list[len(notice_list)-1]
src_time = recent_notice['create_time'].split(' ')[0]
src_title = recent_notice['notice_title']
if src_time == current_time:
Send_VX('快手', src_title)
except Exception as e:
print(e)
def meituan():
print("[+]开始监测美团 SRC..")
try:
url = 'https://security.meituan.com/api/announce/list?typeId=0&curPage=1&perPage=5'
r = requests.get(url, headers=headers,timeout=5,verify=False)
r_json = json.loads(r.text)
notice_list = r_json['data']['items']
timeStamp = notice_list[0]['createTime']
src_time = time.strftime("%Y-%m-%d", time.localtime(float(timeStamp / 1000)))
src_title = notice_list[0]['name']
if src_time == current_time:
Send_VX('美团', src_title)
except Exception as e:
print(e)
def shuidi():
print("[+]开始监测水滴 SRC..")
try:
url = 'https://api.shuidihuzhu.com/api/wide/announce/getAnnouncePageList'
headers = {
'Content-Type': 'application/json; charset=UTF-8',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36'
}
r = requests.post(url, headers=headers, data='{"pageNum":1,"pageSize":10}',timeout=5,verify=False)
r_json = json.loads(r.text)
notice_list = r_json['data']['list']
timeStamp = notice_list[0]['updateTime']
src_time = time.strftime("%Y-%m-%d", time.localtime(float(timeStamp / 1000)))
src_title = notice_list[0]['title']
if src_time == current_time:
Send_VX('水滴', src_title)
except Exception as e:
print(e)
def shunfeng():
print("[+]开始监测顺丰 SRC..")
try:
url = 'http://sfsrc.sf-express.com/notice/getLatestNotices'
r = requests.post(url, headers=headers, data="limit=10&offset=0",timeout=5,verify=False)
r_json = json.loads(r.text)
notice_list = r_json['rows']
timeStamp = notice_list[0]['modifyTime']
src_time = time.strftime("%Y-%m-%d", time.localtime(float(timeStamp / 1000)))
src_title = notice_list[0]['noticeTitle']
if src_time == current_time:
Send_VX('顺丰', src_title)
except Exception as e:
print(e)
def tencent():
print("[+]开始监测腾讯 SRC..")
try:
url = 'https://security.tencent.com/index.php/announcement'
r = requests.get(url, headers=headers,timeout=5,verify=False)
bs = BeautifulSoup(r.text, 'html.parser')
notice_list = bs.select('.section-announcement')[0].select('li')
src_time = notice_list[0].select('span')[0].text.replace('/', '-')
src_title = notice_list[0].select('a')[0].text
if src_time == current_time:
Send_VX('腾讯', src_title)
except Exception as e:
print(e)
def zto():
print("[+]开始监测中通 SRC..")
try:
url = 'https://sec.zto.com/api/notice/list'
r = requests.get(url, headers=headers,timeout=5,verify=False)
r_json = json.loads(r.text)
notice_list = r_json
src_time = notice_list[0]['updated_at'].split('.')[0].replace('T', ' ').split(' ')[0]
src_title = notice_list[0]['title']
if src_time == current_time:
Send_VX('中通', src_title)
except Exception as e:
print(e)
def bytedance():
print("[+]开始监测字节 SRC..")
try:
url = 'https://src.bytedance.com/notice/getNotices/'
r = requests.get(url, headers=headers,timeout=5,verify=False)
bs = BeautifulSoup(r.text, 'lxml')
notice_list = bs.select('.announcement_list')[0].select('li')
src_time = notice_list[0].select('span')[0].text.split(' ')[0].replace('年', '-').replace('月', '-').replace('日', '')
if '-' in src_time[5:7]:
src_time=src_time[0:5]+"0"+src_time[5:9]
src_title = notice_list[0].select('a')[0].text
if src_time == current_time:
Send_VX('字节', src_title)
except Exception as e:
print(e)
if __name__ == '__main__':
print(banner)
global key
key = '' # 填写上你 Server酱的 key,key 申请地址:http://sc.ftqq.com/
number = 3
if key == '':
print('[+]Tips:请在代码中填写上你 Server酱的 key,key 申请地址:http://sc.ftqq.com/')
sys.exit()
current_time = time.strftime("%Y-%m-%d", time.localtime())
src_360()
iqiyi()
alibaba()
baidu()
bilibili()
ke()
boss()
src_58()
cainiao()
didi()
douyu()
guazi()
hehe()
xiangdao()
jd()
jiaodian()
kuaishou()
meituan()
shuidi()
shunfeng()
tencent()
zto()
bytedance()