# -*- coding: utf-8 -*- """ Created on 2024-09-22 --------- @summary: 磐云 360 --------- @author: Lzz """ import requests import execjs import re def get_aw(tg1, tg2, tg3): ex_js = ''' function gaw(tg1,tg2,tg3){ var x08c924 = parseInt(tg1); x08c924 = x08c924 * parseInt(tg2); x08c924 = x08c924 + parseInt(tg3); x08c924 = (x08c924 * 0x3 + 0x7); if (x08c924 < 0x7b) x08c924 = x08c924 + 0x929; if (x08c924 > 0x929) x08c924 = Math["floor"](x08c924 / 0x7b); return x08c924 } ''' ctx = execjs.compile(ex_js) aw = ctx.call('gaw', tg1, tg2, tg3) return aw def get_ck(url=None, proxies=False): if not url: url = "http://www.yngp.com/page/supervision/supervisionList.html" session = requests.Session() session.proxies = proxies session.verify = False try: headers = { "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Cache-Control": "no-cache", "Content-Type": "application/x-www-form-urlencoded", "Origin": "http://www.yngp.com", "Pragma": "no-cache", "Proxy-Connection": "keep-alive", "Referer": url, "Upgrade-Insecure-Requests": "1", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36" } res2 = session.get(url, headers=headers, timeout=30) torg_list = "".join(re.findall('\|function\|(.*?)version', res2.text)) if torg_list: torg_list = torg_list.split('|') tg1 = torg_list[1] tg2 = torg_list[3] tg3 = torg_list[-2] aw = get_aw(tg1, tg2, tg3) data1 = { "answer": f"{aw}" } res = session.post(url, headers=headers, data=data1, timeout=30) urly = "http://www.yngp.com/api/common/otheruse.linklist.svc" respo = session.post(urly, headers=headers, timeout=30) if session.cookies.get_dict().get('JSESSIONID'): return session.cookies.get_dict() else: return {} except: return {}