提交 781c61e6 编写于 作者: H hjdhnx

增加了新的解析

上级 420de7a0
......@@ -14,7 +14,7 @@ from utils.web import *
from utils.system import getHost
from utils.config import playerConfig
from utils.log import logger
from utils.encode import base64Encode,baseDecode,fetch,post,request,getCryptoJS,getPreJs,buildUrl,getHome
from utils.encode import base64Encode,base64Decode,fetch,post,request,getCryptoJS,getPreJs,buildUrl,getHome
from utils.encode import verifyCode,setDetail,join,urljoin2,parseText,requireCache
from utils.encode import md5 as mmd5
from utils.safePython import safePython
......@@ -74,7 +74,7 @@ def md5(text):
return mmd5(text)
py_ctx = {
'requests':requests,'print':print,'base64Encode':base64Encode,'baseDecode':baseDecode,
'requests':requests,'print':print,'base64Encode':base64Encode,'base64Decode':base64Decode,
'log':logger.info,'fetch':fetch,'post':post,'request':request,'getCryptoJS':getCryptoJS,
'buildUrl':buildUrl,'getHome':getHome,'setDetail':setDetail,'join':join,'urljoin2':urljoin2,
'PC_UA':PC_UA,'MOBILE_UA':MOBILE_UA,'UC_UA':UC_UA,'UA':UA,'IOS_UA':IOS_UA,
......@@ -1351,7 +1351,7 @@ class CMS:
# print(play_url)
if play_url.find('http') == -1: # 字符串看起来被编码的
try:
play_url = baseDecode(play_url) # 自动base64解码
play_url = base64Decode(play_url) # 自动base64解码
except:
pass
# print(unquote(play_url))
......
......@@ -14,7 +14,7 @@ from controllers.classes import getClasses,getClassInfo
from utils.files import getPics,custom_merge,getAlist,get_live_url,get_multi_rules,getCustonDict
from js.rules import getRules,getPys
from utils.encode import parseText,base64Encode,baseDecode
from utils.encode import parseText,base64Encode,base64Decode
from base.R import R
from utils.system import getHost,is_linux
from utils.cfg import cfg
......@@ -168,7 +168,7 @@ def get_lives():
live_text = f.read()
if len(live_text) > 100 and live_text.find('http') < 0:
try:
live_text = baseDecode(live_text)
live_text = base64Decode(live_text)
logger.info(f'{path} base64解码完毕')
except:
pass
......
// 星驰免嗅
// let jxUrl = 'https://vip.swuii.top/player/?url=';
let jxUrl = 'https://vip.swuii.top/player/analysis.php?v=';
fetch_params.headers.Referer = jxUrl;
try {
let html = request(jxUrl + vipUrl);
eval(html.match(/var config = {[\s\S]*?}/)[0]);
url = config.url;
_0x4909f4 = url;
let _0xc6d095='';
log(url);
eval(getCryptoJS());
var _0x4909f4 = atob(_0x4909f4);
log(_0x4909f4);
// log(_0x4909f4.length);
var _0x3e9518 = _0x4909f4.length;
// log(_0x4909f4);
var _0x2c3abf = [];
var _0x1c7cc5 = [];
var _0xfc0e29 = "202205051426239465";
var _0x1a1b75 = _0xfc0e29.length;
var _0x320253 = {"EmMtr": function (_0xcb360, _0x190522) {
return _0xcb360 < _0x190522;
}, "INrFk": function (_0x118889, _0x267e98) {
return _0x118889 % _0x267e98;
}, "YJmqv": function (_0x31bf52, _0x2fd6b6) {
return _0x31bf52 % _0x2fd6b6;
}, "IVJrP": function (_0x43c04f, _0x1fa873) {
return _0x43c04f % _0x1fa873;
}, "aTggn": function (_0x13bd41, _0x2f040c) {
return _0x13bd41 + _0x2f040c;
}, "txtvd": function (_0x450d4d, _0x107d6d) {
return _0x450d4d % _0x107d6d;
}, "EpjZa": function (_0x54d0f7, _0x37f36f) {
return _0x54d0f7 ^ _0x37f36f;
}, "WgDgB": function (_0x166316, _0x170b36) {
return _0x166316 < _0x170b36;
}, "vwjta": function (_0x13d5f4, _0x4d75ba) {
return _0x13d5f4 + _0x4d75ba;
}};
for (i = 0; _0x320253["EmMtr"](i, 256); i++) {
_0x2c3abf[i] = _0xfc0e29[_0x320253["YJmqv"](i, _0x1a1b75)]["charCodeAt"]();
_0x1c7cc5[i] = i;
}
// log(_0x1c7cc5);
for (j = i = 0; _0x320253["EmMtr"](i, 256); i++) {
j = _0x320253["INrFk"](_0x320253["vwjta"](j, _0x1c7cc5[i]) + _0x2c3abf[i], 256);
tmp = _0x1c7cc5[i];
_0x1c7cc5[i] = _0x1c7cc5[j];
_0x1c7cc5[j] = tmp;
}
// log(_0x2c3abf);
// log(_0x1c7cc5);
for (a = j = i = 0; _0x320253["WgDgB"](i, _0x3e9518); i++) {
a = _0x320253["IVJrP"](a + 1, 256);
j = _0x320253["aTggn"](j, _0x1c7cc5[a]) % 256;
tmp = _0x1c7cc5[a];
_0x1c7cc5[a] = _0x1c7cc5[j];
_0x1c7cc5[j] = tmp;
k = _0x1c7cc5[_0x320253["txtvd"](_0x320253["aTggn"](_0x1c7cc5[a], _0x1c7cc5[j]), 256)];
_0xc6d095 += String["fromCharCode"](_0x320253["EpjZa"](_0x4909f4[i]["charCodeAt"](), k));
// log(_0x4909f4[i]);
}
// log(_0x1c7cc5);
log(_0xc6d095);
url = unescape(_0xc6d095);
if (/m3u8|mp4/.test(url)) {
realUrl = url;
}else {
realUrl = toast(vipUrl+'解析失败:'+url);
}
log('解析到真实播放地址:'+realUrl);
}catch (e) {
log('解析发生错误:'+e.message);
realUrl = vipUrl;
}
\ No newline at end of file
!function(e) {
var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var base64DecodeChars = new Array(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1);
function base64encode(str) {
var out, i, len;
var c1, c2, c3;
len = str.length;
i = 0;
out = "";
while (i < len) {
c1 = str.charCodeAt(i++) & 0xff;
if (i == len) {
out += base64EncodeChars.charAt(c1 >> 2);
out += base64EncodeChars.charAt((c1 & 0x3) << 4);
out += "==";
break;
}
c2 = str.charCodeAt(i++);
if (i == len) {
out += base64EncodeChars.charAt(c1 >> 2);
out += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
out += base64EncodeChars.charAt((c2 & 0xF) << 2);
out += "=";
break;
}
c3 = str.charCodeAt(i++);
out += base64EncodeChars.charAt(c1 >> 2);
out += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
out += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
out += base64EncodeChars.charAt(c3 & 0x3F);
}
return out;
}
function base64decode(str) {
var c1, c2, c3, c4;
var i, len, out;
len = str.length;
i = 0;
out = "";
while (i < len) {
do {
c1 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
} while (i < len && c1 == -1);
if (c1 == -1) break;
do {
c2 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
} while (i < len && c2 == -1);
if (c2 == -1) break;
out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4));
do {
c3 = str.charCodeAt(i++) & 0xff;
if (c3 == 61) return out;
c3 = base64DecodeChars[c3];
} while (i < len && c3 == -1);
if (c3 == -1) break;
out += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2));
do {
c4 = str.charCodeAt(i++) & 0xff;
if (c4 == 61) return out;
c4 = base64DecodeChars[c4];
} while (i < len && c4 == -1);
if (c4 == -1) break;
out += String.fromCharCode(((c3 & 0x03) << 6) | c4);
}
return out;
}
function utf16to8(str) {
var out, i, len, c;
out = "";
len = str.length;
for (i = 0; i < len; i++) {
c = str.charCodeAt(i);
if ((c >= 0x0001) && (c <= 0x007F)) {
out += str.charAt(i);
} else if (c > 0x07FF) {
out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
} else {
out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
}
}
return out;
}
function utf8to16(str) {
var out, i, len, c;
var char2, char3;
out = "";
len = str.length;
i = 0;
while (i < len) {
c = str.charCodeAt(i++);
switch (c >> 4) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
out += str.charAt(i - 1);
break;
case 12:
case 13:
char2 = str.charCodeAt(i++);
out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F));
break;
case 14:
char2 = str.charCodeAt(i++);
char3 = str.charCodeAt(i++);
out += String.fromCharCode(((c & 0x0F) << 12) | ((char2 & 0x3F) << 6) | ((char3 & 0x3F) << 0));
break;
}
}
return out;
}
function CharToHex(str) {
var out, i, len, c, h;
out = "";
len = str.length;
i = 0;
while (i < len) {
c = str.charCodeAt(i++);
h = c.toString(16);
if (h.length < 2) h = "0" + h;
out += "\\x" + h + " ";
if (i > 0 && i % 8 == 0) out += "\r\n";
}
return out;
}
this.atob = base64decode, this.btoa = base64encode;
}(this);
......@@ -14,7 +14,7 @@ def gzinflate(compressed: bytes) -> bytes:
def base64Encode(text):
return base64.b64encode(text.encode("utf8")).decode("utf-8") #base64编码
def baseDecode(text:str):
def base64Decode(text:str):
return base64.b64decode(text).decode("utf-8") #base64解码
def un_encode(a:str):
......
......@@ -51,6 +51,7 @@
[获取本地设备信息](https://m.jb51.net/article/140716.htm)
###### 2022/11/25
- [X] 优化腾云驾雾源,方便追剧
- [X] 增加新解析
###### 2022/11/24
- [X] 优化alist的历史记录和收藏
- [X] 设置中心环境变量增加前端的保存校验
......
......@@ -20,6 +20,7 @@ import os
from utils.web import UC_UA,PC_UA
from ast import literal_eval
from utils.log import logger
import quickjs
def getPreJs():
base_path = os.path.dirname(os.path.abspath(os.path.dirname(__file__))) # 上级目
......@@ -42,6 +43,44 @@ def getCryptoJS():
def md5(str):
return hashlib.md5(str.encode(encoding='UTF-8')).hexdigest()
def getLib(js):
base_path = os.path.dirname(os.path.abspath(os.path.dirname(__file__))) # 上级目录
lib_path = os.path.join(base_path, f'libs/{js}')
if not os.path.exists(lib_path):
return ''
with open(lib_path,encoding='utf-8') as f:
return f.read()
# def atob(text):
# if isinstance(text,PyJsString):
# text = parseText(str(text))
# qjs = quickjs.Context()
# print(text)
# js = getLib('atob.js')
# print(js)
# ret = qjs.eval(f'{js};atob("{text}")')
# print(ret)
def atob(text):
"""
解码
:param text:
:return:
"""
if isinstance(text,PyJsString):
text = parseText(str(text))
return base64.b64decode(text.encode("utf8")).decode("latin1")
def btoa(text):
"""
编码
:param text:
:return:
"""
if isinstance(text,PyJsString):
text = parseText(str(text))
return base64.b64encode(text.encode("latin1")).decode("utf8")
def requireCache(lib:str):
base_path = os.path.dirname(os.path.abspath(os.path.dirname(__file__))) # 上级目
os.makedirs(os.path.join(base_path, f'libs'), exist_ok=True)
......@@ -129,7 +168,10 @@ def base64Encode(text):
text = str(text).replace("'","").replace('"','')
return base64.b64encode(text.encode("utf8")).decode("utf-8") #base64编码
def baseDecode(text):
def base64Decode(text):
if isinstance(text,PyJsString):
text = parseText(str(text))
# print(text)
return base64.b64decode(text).decode("utf-8") #base64解码
def parseText(text:str):
......
......@@ -9,7 +9,7 @@ import json
import requests
from utils.web import *
from utils.log import logger
from utils.encode import base64Encode,baseDecode,fetch,post,request,getCryptoJS,getPreJs,buildUrl,getHome,parseText
from utils.encode import base64Encode,base64Decode,fetch,post,request,getCryptoJS,getPreJs,buildUrl,getHome,parseText,atob
from utils.encode import setDetail,join,urljoin2,parseText,requireCache
from utils.encode import md5 as mmd5
from utils.parser import runPy,runJScode,JsObjectWrapper,PyJsObject,PyJsString
......@@ -65,10 +65,10 @@ def md5(text):
return mmd5(text)
py_ctx = {
'requests':requests,'print':print,'base64Encode':base64Encode,'baseDecode':baseDecode,
'requests':requests,'print':print,'base64Encode':base64Encode,'base64Decode':base64Decode,
'log':logger.info,'fetch':fetch,'post':post,'request':request,'getCryptoJS':getCryptoJS,
'buildUrl':buildUrl,'getHome':getHome,'setDetail':setDetail,'join':join,'urljoin2':urljoin2,
'PC_UA':PC_UA,'MOBILE_UA':MOBILE_UA,'UC_UA':UC_UA,'IOS_UA':IOS_UA,
'setItem':setItem,'getItem':getItem,'clearItem':clearItem,'stringify':stringify,'encodeUrl':encodeUrl,
'requireObj':requireObj,'md5':md5
'requireObj':requireObj,'md5':md5,'atob':atob
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册