# !/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""
@des :https://www.whg6.com/html/musictools/ 暗号破解
"""
import requests
import re
def md5_decode(secret):
"""
md5 解密接口 抓取自 http://www.ttmd5.com/
只能解析不带盐值的
:param secret:待解密字符串
:return:
True:
{
"cipher": "49ba59abbe56e057",
"flag": 1,
"plain": "123456",
"type": "",
"time": 0.0042200088500977,
"msg": ""
}
False:
flag != 1 都是破解失败
"""
host = "http://www.ttmd5.com"
url = "{}/do.php?c=Decode&m=getMD5&md5={}".format(host,secret)
res = requests.get(url)
return res.json()
def get_clear_code():
"""
解析页面js弹框中携带的加密后的MD5值,
通过调用网络上爬取到的md5解密接口获取原始文本,
即为网站下载通道对应的暗号
:return:
"""
url = "https://www.whg6.com/html/musictools/"
response = requests.get(url)
response.encoding="utf-8"
com = re.compile("name == '(.*?)'")
res = re.search(com,response.text)
anhao = res.groups()[0]
clear_code = md5_decode(anhao)["plain"]
return clear_code
if __name__ == '__main__':
clear_code = get_clear_code()
print(clear_code)
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/156895.html