把woff字符串存为fron.woff文件,将其存为xml文件。
对其中的数字编码分析
固定的编码中on的数字是一样的
找到页面和on的数字序列的关系确定,on数字表示的数字
响应中的value值后三位数字对应编码(如 unib861),再找到编码对应的数字即为胜点。
找胜点最高的召唤师需要扣代码运行,然后正则匹配出编码对应的他的名字。
以下代码:
import re
from fontTools.ttLib import TTFont
import requests
import base64
from functools import partial # 这玩意儿能锁定一个函数的参数
import subprocess
subprocess.Popen = partial(subprocess.Popen, encoding="utf-8") # 固定写法
import execjs
data_num_max = -1
data_name = ''
def get_html(page):
headers = {
"user-agent": "yuanrenxue.project",
"cookie": "m=bc98cc04471bb884cf5897467ce82164|1721718766000; Hm_lvt_c99546cf032aaa5a679230de9a95c7db=1719309899,1720073150,1720407417,1721718767; HMACCOUNT=6AD7C63244175A6D; no-alert3=true; Hm_lvt_9bcbda9cbf86757998a2339a0437208e=1719455297,1720073157,1720407423,1721724724; tk=-6517094651670550611; sessionid=74e9r7j0jn9iguy7rt5kt9vziuj06zri; Hm_lpvt_9bcbda9cbf86757998a2339a0437208e=1721724792; Hm_lpvt_c99546cf032aaa5a679230de9a95c7db=1721728396"
}
url = f"https://match.yuanrenxue.com/api/match/7?page={page}"
print(url)
req = requests.get(url=url, headers=headers).json()
return req
def with_ttf(woff):
b64_code = woff
with open('font.woff', 'wb') as f:
f.write(base64.decodebytes(b64_code.encode()))
def get_xml(data):
global data_num_max, data_name
font = TTFont('font.woff')
font.saveXML('sss.xml')
data_value = data.get('value').strip().replace('&#x', 'uni')
data_value_list = data_value.split(" ")
map_num_list = []
for data_v in data_value_list:
map_num = {
"10100100100101010010010010": '0',
"100110101001010101011110101000": '2',
"111111111111111": '4',
"1110101001001010110101010100101011111": '5',
"1001101111": '1',
"10010101001110101011010101010101000100100": '9',
"101010101101010001010101101010101010010010010101001000010": '8',
"10101100101000111100010101011010100101010100": '3',
"1111111": '7',
"10101010100001010111010101101010010101000": '6'
}
flags_num = list(font['glyf'][data_v].flags)
# print(flags_num)
flags_num_str = "".join([str(flag) for flag in flags_num])
map_num_list.append(map_num[flags_num_str])
x = int("".join(map_num_list))
if x > data_num_max:
print(x)
data_num_max = x
data_name = str(data['value'])
# return data_num_max , data_name
if __name__ == '__main__':
str_list = []
for page in range(1, 6):
res = get_html(page)
woff = res.get('woff')
with_ttf(woff)
for data in res.get('data'):
get_xml(data)
print(res.get('data'))
with open('y7.js', 'r', encoding='utf-8') as f:
s = f.read()
res = execjs.compile(s).call('get_res', res.get('data'), page)
str_list.append(res)
print(f'最大值:{data_num_max}')
data_name = str(data_name).replace(' ', '')
print(f'名字:{data_name}')
# 找到对应的名字
for i in str_list:
# 执行匹配
match = re.findall(r'-li-span-3">(.*?)LP</span>', i)
for i in match:
if data_name in i:
print(i)
break
function each(obj, callback) {
if (Array.isArray(obj)) {
for (var i = 0; i < obj.length; i++) {
callback(i, obj[i]);
}
} else {
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
callback(key, obj[key]);
}
}
}
}
function get_res(data, page) {
window = {}
if (page) {
window.page = page
} else {
window.page = 1
}
ttf = data.woff;
// $('.font').text('').append('<style type="text/css">@font-face { font-family:"fonteditor";src: url(data:font/truetype;charset=utf-8;base64,' + ttf + '); }</style>');
// data = data.data;
let html = '';
let mad = `<tr><td><span class="ranking-li-span-1"></span></td><td><!--<img class="ranking-li-img-1"src="//ossweb-img.qq.com/images/lol/img/profileicon2/profileicon3018.jpg"alt="玩家头像">--><span class="ranking-li-span-3">九不想乖</span></td><td><span class="ranking-li-span-4"><img src="//ossweb-img.qq.com/images/lol/space/rank/2019pre/season_2019_challenger.png"alt="段位">最强王者Ⅰ</span></td><td><span class="ranking-li-span-5 fonteditor">random_rank_number</span></td><td><span class="ranking-li-span-6">random_level</span></td><td><span class="ranking-li-span-7"><a target="_blank"><img class="ranking-li-img-1"src="/static/match/match7/img/img_number.png"></a><a target="_blank"><img class="ranking-li-img-1"src="/static/match/match7/img/img_number.png"></a><a target="_blank"><img class="ranking-li-img-1"src="/static/match/match7/img/img_number.png"></a><a target="_blank"><img class="ranking-li-img-1"src="/static/match/match7/img/img_number.png"></a><a target="_blank"><img class="ranking-li-img-1"src="/static/match/match7/img/img_number.png"></a></span></td><td><div class="m-ranking-winrate-2"><!--i的width属性等于胜率--><i class="u-ranking-winrate-i"id="ranking_4"data-win="win_rank"style="width: win_rank;"></i><a class="u-winrate ">win_rank</a><a class="u-playnumber">win_number</a></div></td></tr>`;
let yyq = 1;
let img_num = 1;
let imgnum_arr = [1, 8, 3, 2, 4, 5, 7, 5, 15, 3, 9, 8, 5, 1, 3];
let level_arr = [1, 4, 3, 2, 9, 15];
let name = ['极镀ギ紬荕', '爷灬霸气傀儡', '梦战苍穹', '傲世哥', 'мaη肆風聲', '一刀メ隔世', '横刀メ绝杀', 'Q不死你R死你', '魔帝殤邪', '封刀不再战', '倾城孤狼', '戎马江湖', '狂得像风', '影之哀伤', '謸氕づ独尊', '傲视狂杀', '追风之梦', '枭雄在世', '傲视之巅', '黑夜刺客', '占你心为王', '爷来取你狗命', '御风踏血', '凫矢暮城', '孤影メ残刀', '野区霸王', '噬血啸月', '风逝无迹', '帅的睡不着', '血色杀戮者', '冷视天下', '帅出新高度', '風狆瑬蒗', '灵魂禁锢', 'ヤ地狱篮枫ゞ', '溅血メ破天', '剑尊メ杀戮', '塞外う飛龍', '哥‘K纯帅', '逆風祈雨', '恣意踏江山', '望断、天涯路', '地獄惡灵', '疯狂メ孽杀', '寂月灭影', '骚年霸称帝王', '狂杀メ无赦', '死灵的哀伤', '撩妹界扛把子', '霸刀☆藐视天下', '潇洒又能打', '狂卩龙灬巅丷峰', '羁旅天涯.', '南宫沐风', '风恋绝尘', '剑下孤魂', '一蓑烟雨', '领域★倾战', '威龙丶断魂神狙', '辉煌战绩', '屎来运赚', '伱、Bu够档次', '九音引魂箫', '骨子里的傲气', '霸海断长空', '没枪也很狂', '死魂★之灵'];
each(data, function (index, val) {
let ppo = mad;
for (let imgnum = 1; imgnum <= 5; imgnum++) {
ppo = ppo.replace('img_number', yyq * window.page + imgnum_arr[imgnum])
}
html += ppo.replace('九不想乖', name[yyq + (window.page - 1) * 10]).replace('win_number', imgnum_arr[yyq] * level_arr[window.page] * 88 + '场').replace(/win_rank/g, imgnum_arr[yyq] + 60 + level_arr[window.page] + '%').replace('random_level', imgnum_arr[yyq] * level_arr[window.page] + 100 * level_arr[window.page]).replace('img_number', yyq * window.page).replace('random_rank_number', val.value.replace(/ /g, '') + 'LP');
yyq += 1;
img_num += 1
})
return html
}
function get_con(sb) {
console.log(sb);
return sb;
}
console.log(get_res([{'value': '륇 륇 륇 썑 '}, {'value': 'ꕃ ꈔ 섴 '}, {'value': '륇 ꕃ ꈔ ꈔ '}, {'value': 'ꕃ 앸 섴 롳 '}, {'value': '섴 섴 좖 좖 '}, {'value': '썑 륇 '}, {'value': 'ꕃ 썑 ꡂ 앸 '}, {'value': '롳 좖 좖 앸 '}, {'value': 'ꕃ 륇 썑 덙 '}, {'value': '롳 섴 앸 앸 '}], 3))