Commit f4b41fcc authored by TesterYao's avatar TesterYao

1

parent 571d11b1
import requests
from log import LOG
# 全民对接
class QM:
def __init__(self):
self.host = 'https://gateway.hjff18.com'
# ssp上报被封域名或链接
self.block_list_url = '/mall/domain/ta/jc'
self.session = requests.session()
def post_block_list(self, b_url):
LOG.info('全民上报被封域名:'+b_url)
if b_url.startswith('http'):
r = self.session.post(url=self.host+ self.block_list_url,json={'domain':b_url})
else:
b_url = 'https://' + b_url
data = {
'domain': b_url
}
r = self.session.post(url=self.host+ self.block_list_url,json=data)
print('上报结果:' + r.text)
if r.status_code == 200 and r.json().get('desc') == "成功":
LOG.info('上报成功:'+ r.text)
else:
LOG.error('上报失败,1.5S后重新上报:' + r.text)
if __name__ == '__main__':
qm = QM()
qm.post_block_list('www.baidu.com')
from time import sleep
from urllib.parse import urlparse
import requests
from quanmin import QM
from dingMessage import send_messages
from log import LOG
from manager import Tui
def check_domain(check_url,i=0):
tag = False
try:
sleep(1)
......@@ -25,7 +25,7 @@ def check_domain(check_url,i=0):
host = urlparse(res_url).hostname # 判断域名,如果是微信安全中心的域名'weixin110.qq.com',则说明被封
if host and host == 'weixin110.qq.com':
LOG.info('巡查结束,域名被封:%s' % check_url)
send_messages('广告主落地页链接被封,被封链接为:'+gj_url)
tag = True
else:
LOG.info('巡查结束,域名正常:%s' % check_url)
......@@ -40,6 +40,7 @@ def check_domain(check_url,i=0):
check_domain(check_url, i)
else:
LOG.error('微信域名巡查脚本,执行巡查时出错,请及时处理!!!')
return tag
def get_pg_list():
pg_url = 'https://engine.tuia.cn/apollo/getIdMapStrByKeyStr?keyStr=wx.ad.page'
......@@ -47,9 +48,8 @@ def get_pg_list():
pg_lsit = []
if r.ok:
res = eval(r.text)
for k,v in res.items():
pg_lsit.append(v)
return pg_lsit
return res
......@@ -57,12 +57,15 @@ if __name__ == '__main__':
base_url = 'http://mp.weixinbridge.com/mp/wapredirect?url=' # 微信官方接口,可用于域名巡查,后面拼接上需要巡查的域名或链接
session = requests.session()
headers = {'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36'}
qm = QM()
while True:
try:
ck_url_list = get_pg_list()
for ck_url in ck_url_list:
check_domain(ck_url)
for k, v in ck_url_list.items():
if check_domain(v):
send_messages('广告主落地页链接被封,被封链接为:' + v)
if k.startswith('全民'):
qm.post_block_list(v)
sleep(2)
sleep(10)
except:
......@@ -75,4 +78,3 @@ if __name__ == '__main__':
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment