js混淆加密解密源码(JS逆向--某vid值的加密分析)
js混淆加密解密源码(JS逆向--某vid值的加密分析)import time import execjs def get_ctime(): now = time.time() print(now) l_time = time.localtime(now) print(l_time) f_time = time.strftime("%Y-%m-%d %H:%M:%S" l_time) return f_time ctime=get_ctime() print(ctime) url='https://w.yangshipin.cn/video?type=0&vid=o000017kuww&channel=m_h5&channel_origin=m_h5' def getvid(url): node = execjs.get() fp = o
一、vid值分析
1、F12开发者工具抓包,全局搜索vid,所有vid下断,最终确定这一个关键点
2、刷新页面,在此处断了下来,t来自于该函数M()(window.location.href)
window.location.href:获取url的地址
3、跟进M函数查看,通过这段代码即可取出vid的值
4、JS实现获取vid
function aiyou(t e) {
var n={}
var r = n[t] || {};
if (t) {
var o = t.indexOf("?");
if (o >= 0) {
var i = t.slice(o 1 t.length);
(i = i.replace(/#.*/ "")).split("&").forEach((function(t) {
var e = t.indexOf("=");
if (e > 0) {
var n = t.slice(0 e)
o = t.slice(e 1 t.length);
r[n] = o
}
}
))
}
n[t] = r
}
return e ? r[e] || "" : r
}
二、获取固定的时间格式
import time
def get_ctime():
now = time.time()
print(now)
l_time = time.localtime(now)
print(l_time)
f_time = time.strftime("%Y-%m-%d %H:%M:%S" l_time)
return f_time
ctime=get_ctime()
print(ctime)
三、最终python代码实现
import time
import execjs
def get_ctime():
now = time.time()
print(now)
l_time = time.localtime(now)
print(l_time)
f_time = time.strftime("%Y-%m-%d %H:%M:%S" l_time)
return f_time
ctime=get_ctime()
print(ctime)
url='https://w.yangshipin.cn/video?type=0&vid=o000017kuww&channel=m_h5&channel_origin=m_h5'
def getvid(url):
node = execjs.get()
fp = open('./jiami.js' 'r' encoding='utf-8')
ctx = node.compile(fp.read())
ret = ctx.eval("aiyou('%s')" % url)
return ret['vid']
vid=getvid(url)
print(vid)
参数={
"ctime":ctime
"ua":"mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml like gecko) chrome/112.0.0.0 safari/537.36"
"hh_ua":"mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml like gecko) chrome/112.0.0.0 safari/537.36"
"platform":"4330701"
"guid":"lhq1oezr_kleoxtxxsd"
"Pwd":"1698957057"
"version":"wc-1.25.0"
"url":"https://w.yangshipin.cn/video?type=0&vid=o000017kuww&channel=m_h5&channel_origin=m_h5"
"hh_ref":"https://w.yangshipin.cn/video?type=0&vid=o000017kuww&channel=m_h5&channel_origin=m_h5"
"vid":vid
"isfocustab":"1"
"isvisible":"1"
"idx":"0"
"val":"1046"
"pid":"lhq1pku9_6f9kyp4ykcf"
"bi":"0"
"bt":"0"
"defn":"hd"
"vurl":"https://mp4playali-cdn.ysp.cctv.cn/o000017kuww.jbZe10002.mp4?sdtfrom=4330701&guid=lhq1oezr_kleoxtxxsd&vkey=71B322817DFA1F51DDA2EA67F315D619CFA9FC2F3D4408FA24ADFE853F87D7DD90DE01AE77D1D2059D1A877C80BFF781D0A087718AA371D6E7A7F713F824B63C39AA31EDE610545602904F26009F7256415C2D1A88F5C7EE9E008B1989F1BDD0807707CED85EA7D4426B75C3780D9380A34C7BB3E31FD663F92E8441085C8478&platform=2"
"step":"6"
"val1":"1"
"val2":"1"
"fact1":""
"fact2":""
"fact3":""
"fact4":""
"fact5":""
}