# !/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)
Python 破解 MD5 暗号
最新推荐文章于 2024-01-21 15:35:54 发布