Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wxScanck
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
yaozheng
wxScanck
Commits
94923781
Commit
94923781
authored
Aug 04, 2022
by
TesterYao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
17d45453
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
132 additions
and
3 deletions
+132
-3
dingMessage.py
dingMessage.py
+3
-3
manager.py
manager.py
+68
-0
wx-cli-ck.py
wx-cli-ck.py
+61
-0
No files found.
dingMessage.py
View file @
94923781
...
...
@@ -9,14 +9,14 @@ import urllib
def
send_messages
(
content
):
webhook
=
'https://oapi.dingtalk.com/robot/send?access_token='
headers
=
{
"Content-Type"
:
"application/json; charset=utf-8"
}
token
=
'
fb8da62f0af606820fe8bdfdf8ea261d468f09b57c22faaa454d45855ea82eef
'
secret
=
'SEC
f2cc843306d667575a491650c777d8aa21788c4c60f3f0949d5d0b61c86e5aef
'
token
=
'
76332b31c5604e23d386c771202f4581a3bed8b4e73df7968f34e19b1f284738
'
secret
=
'SEC
b4efc8c7305357f3b0beb1b53650061a7f165ae5e247a03533e02156f3fbad5a
'
data_info
=
{
"msgtype"
:
"text"
,
"text"
:
{
"content"
:
content
},
"at"
:
{
'atMobiles'
:
'15726940779'
}
"at"
:
{
'atMobiles'
:
[
'15010432637'
,
'13875018906'
,
'18518552824'
,
'18612924181'
]
}
}
timestamp
=
str
(
round
(
time
.
time
()
*
1000
))
# 密钥进行编码
...
...
manager.py
View file @
94923781
...
...
@@ -37,3 +37,71 @@ class Zk:
class
Tui
:
def
__init__
(
self
):
self
.
host
=
'https://manager.tuia.cn'
# 获取订单域名列表
self
.
bid_list_url
=
'/advertWeChat/getWeChatForbidDomain'
# 上报订单被封域名接口
self
.
bid_block_url
=
'/advertWeChat/receiveUnsealDomain'
self
.
url_list
=
'/adverts/urlList'
self
.
report_list
=
'/adverts/reportUrl?url='
self
.
finish_url
=
'/adverts/checkFinish?startTime='
self
.
session
=
requests
.
session
()
def
get_valid_list
(
self
):
LOG
.
info
(
'开始获取广告线订单域名巡查列表'
)
r
=
self
.
session
.
get
(
url
=
self
.
host
+
self
.
bid_list_url
)
if
r
.
status_code
==
200
and
r
.
json
()
.
get
(
'desc'
)
==
'查询成功'
:
valid_list
=
r
.
json
()
.
get
(
'data'
)
if
valid_list
:
LOG
.
info
(
'获取巡查列表结果:'
+
str
(
valid_list
))
return
valid_list
else
:
LOG
.
error
(
'获取巡查列表异常,repose:'
+
r
.
text
)
def
post_block_list
(
self
,
b_list
):
LOG
.
info
(
'上报被封域名列表:'
+
str
(
b_list
))
data
=
{
'domainList'
:
b_list
}
r
=
self
.
session
.
post
(
url
=
self
.
host
+
self
.
bid_block_url
,
json
=
data
)
if
r
.
status_code
==
200
and
r
.
json
()
.
get
(
'desc'
)
==
'接收成功'
:
LOG
.
info
(
'上报成功:'
+
r
.
text
)
else
:
LOG
.
error
(
'上报失败,1.5S后重新上报:'
+
r
.
text
)
def
get_urls
(
self
):
LOG
.
info
(
'开始获取广告线被封域名巡查列表'
)
r
=
self
.
session
.
get
(
url
=
self
.
host
+
self
.
url_list
)
if
r
.
status_code
==
200
and
r
.
json
()
.
get
(
'desc'
)
==
'success'
:
valid_list
=
r
.
json
()
.
get
(
'data'
)
if
valid_list
:
LOG
.
info
(
'获取巡查列表结果:'
+
str
(
valid_list
))
return
valid_list
else
:
LOG
.
error
(
'获取巡查列表异常,repose:'
+
r
.
text
)
def
report_urls
(
self
,
b_url
):
LOG
.
info
(
'上报被封域名:'
+
str
(
b_url
))
r
=
self
.
session
.
get
(
url
=
self
.
host
+
self
.
report_list
+
b_url
+
'&ck=65f364dcb386fefee8573e96f70659dc'
)
if
r
.
status_code
==
200
and
r
.
json
()
.
get
(
'desc'
)
==
'success'
:
LOG
.
info
(
'上报成功:'
+
r
.
text
)
else
:
LOG
.
error
(
'上报失败:'
+
r
.
text
)
def
finish
(
self
,
startTime
,
endTime
):
LOG
.
info
(
'广告线被封域名巡查完毕'
)
r
=
self
.
session
.
get
(
url
=
self
.
host
+
self
.
finish_url
+
str
(
startTime
)
+
'&endTime='
+
str
(
endTime
))
if
r
.
status_code
==
200
and
r
.
json
()
.
get
(
'desc'
)
==
'success'
:
LOG
.
info
(
'上报成功:'
+
r
.
text
)
else
:
LOG
.
error
(
'上报失败:'
+
r
.
text
)
if
__name__
==
'__main__'
:
tui
=
Tui
()
print
(
tui
.
get_urls
())
wx-cli-ck.py
0 → 100644
View file @
94923781
from
time
import
sleep
from
urllib.parse
import
urlparse
import
requests
from
dingMessage
import
send_messages
from
log
import
LOG
from
manager
import
Tui
def
check_domain
(
check_url
,
i
=
0
):
try
:
sleep
(
1
)
if
check_url
.
startswith
(
'http'
):
gj_url
=
check_url
url
=
base_url
+
check_url
# 将待巡查链接拼接到巡查接口后面
else
:
gj_url
=
'https://'
+
check_url
url
=
base_url
+
gj_url
LOG
.
info
(
'开始巡查,域名为:
%
s'
%
check_url
)
r
=
session
.
get
(
url
=
url
,
headers
=
headers
,
timeout
=
5
)
# 调用微信官方接口进行域名巡查
res_url
=
r
.
url
# 获取最终的url,如果被封,则应该是微信安全中心的链接
LOG
.
info
(
'巡查最终打开页面链接:
%
s'
%
res_url
)
# 将url打印出来,便于后期排查问题
host
=
urlparse
(
res_url
)
.
hostname
# 判断域名,如果是微信安全中心的域名'weixin110.qq.com',则说明被封
if
host
and
host
==
'weixin110.qq.com'
:
LOG
.
info
(
'巡查结束,域名被封:
%
s'
%
check_url
)
send_messages
(
'广告主落地页链接被封,被封链接为:'
+
gj_url
)
else
:
LOG
.
info
(
'巡查结束,域名正常:
%
s'
%
check_url
)
except
requests
.
exceptions
.
ConnectionError
:
LOG
.
error
(
'域名连接异常:'
+
check_url
)
pass
except
:
if
i
<
3
:
i
+=
1
LOG
.
error
(
'微信域名巡查,执行巡查时脚本出错,正在进行第'
+
str
(
i
)
+
'次重试'
)
sleep
(
20
)
check_domain
(
check_url
,
i
)
else
:
LOG
.
error
(
'微信域名巡查脚本,执行巡查时出错,请及时处理!!!'
)
if
__name__
==
'__main__'
:
tui
=
Tui
()
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'
}
ck_url_list
=
[
'm.sxyddc555.cn/site/danding/wxpayment.html'
]
while
True
:
for
ck_url
in
ck_url_list
:
check_domain
(
ck_url
)
sleep
(
20
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment