Python 破解 MD5 暗号

# !/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)
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值