请求加密
响应解密
字体解密
地址: aHR0cHM6Ly95b3V6eS5jbi8=
字体加密暂时没有公开密文,看我代码应该能搞出来
# -*- coding: utf-8 -*-
import re
import html, js2py
from hashlib import md5
class DecryptFont:
"""
解密字体
"""
str_code="评论区"
kv_data="评论区"
def _str_index_list(self):
"""
字体文件中字体和位置的映射
:return:
"""
return re.findall(r'\S+?', self.str_code) # 从文件中提取
def _ascii_index_dict(self):
"""
字体文件中 获取id和字符编码的映射关系
:return:
"""
#
# with open('./font_file/yfe2.xml', 'r', encoding='utf-8') as f:
# xml_data = f.read()
# kv_data = re.findall(r'<GlyphID id="(\d+)" name="(\S+)"/>', xml_data)
y_dict = dict(self.kv_data)
reversed_dict = dict(zip(y_dict.values(), y_dict.keys()))
return reversed_dict
@staticmethod
def _tran_code(string):
# 编码为 Unicode 转义序列
unicode_escape = string.encode('unicode_escape')
# 转为字符串并打印
unicode_escape_string = unicode_escape.decode('utf-8')
return unicode_escape_string
def decrypt_str(self, S_str):
reversed_dict = self._ascii_index_dict()
dd_list = self._str_index_list()
r_s = ""
for S in S_str:
code = self._tran_code(S)
if r'\uc' in code:
S = dd_list[int(reversed_dict[code.upper().replace(r'\UC', 'uniC')])]
elif r'\ud' in code:
S = dd_list[int(reversed_dict[code.upper().replace(r'\UD', 'uniD')])]
r_s += S
return r_s
class DecryptResData:
'''
响应值解密
'''
js_code = """
function cnDeCryptV2(str) {
var k = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", l = k.length, b, b0, b1, b2, b3, d = 0, s;
s = new Array(Math.floor(str.length / 4)),
b = s.length;
for (var i = 0; i < b; i++)
b0 = k.indexOf(str.charAt(d)),
d++,
b1 = k.indexOf(str.charAt(d)),
d++,
b2 = k.indexOf(str.charAt(d)),
d++,
b3 = k.indexOf(str.charAt(d)),
d++,
s[i] = ((b1 + b0 * l) * l + b2) * l + b3;
b = eval("String.fromCharCode(" + s.join(",") + ")");
var w = "";
return b.split("|").forEach((function(e, t) {
t > 0 && (-1 != e.search(/【(.*?)】/) ? w += e.replace("【", "").replace("】", "") : e.length > 0 && (w += "&#x" + e + ";"))
}
)),
w
}
"""
def __init__(self):
self.context = js2py.EvalJs()
self.context.execute(self.js_code)
def decrypt(self, k):
result = self.context.cnDeCryptV2(k)
return html.unescape(result)
class DecryptReqData:
'''
请求参数加密
'''
key = '9SASji5OWnG41iRKiSvTJHlXHmRySRp1'
def encrypt(self, data):
sign_data = f"{data.lower()}&{self.key.lower()}"
return md5(sign_data.encode()).hexdigest()
if __name__ == '__main__':
dd = "퀾큎퀤퀷"
res = DecryptFont().decrypt_str(dd)
print(res)
网友评论