某抑云音乐歌曲链接接口逆向之补环境

上文链接

某抑云音乐歌曲链接接口逆向-CSDN博客


 

代码运行

补充基础环境

Window环境
///
// window
window = global;
Window = function Window(){}
Window.prototype.addEventListener = function addEventListener( type, event, opt ){
    debugger
}
window[ 'availHeight' ] = 1050;
window[ 'availWidth' ] = 1920;
window[ 'width' ]  = 1920;
window[ 'height' ] = 1080
window[ 'DeviceOrientationEvent' ] = function DeviceOrientationEvent(){
    debugger
}
window[ 'DeviceMotionEvent' ] = function DeviceMotionEvent(){
    debugger
}
window['outerHeight'] = 1050;
window[ 'outerWidth' ] = 1920;
window.__proto__ = Window.prototype;
Navigator环境
///
// navigator
navigator = {
    appCodeName: "Mozilla",
    appName: "Netscape",
    appVersion: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36",
    language: "en",
    languages: [ "en", "zh-CN",  "zh",  "ja" ],
    platform: "Win32",
    product: "Gecko",
    productSub: "20030107",
    userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36",
    vendor: "Google Inc.",
}
Navigator = function Navigator(){}
Navigator.prototype.webdriver = false;
navigator.__proto__ = Navigator.prototype;
Location环境 
///
// location
location = {
    hash: "",
    host: host,
    hostname: hostname,
    href: href,
    origin: origin,
    pathname: path,
    port: "",
    protocol: "https:",
    search: ""
}
Location = function Location(){}
location.__proto__ = Location.prototype;
window.location = location;

存在变量请自行替换 

Document环境
///
// document
document = {}
HTMLDocument = function Document(){}
document.__proto__ = HTMLDocument.prototype;
window.document = document;

调试环境补充

 第一次调试

 由此可以得到错误: document.body.classList;

来到原始站点调试输出

那么补充到 Document 中

document = {
    body:{
        classList: ""
    }
}

 

第二次调试

由此可以得到错误:Unexpected token in JSON at position 1

 该自执行函数通看下来, 其实是没做什么事情 可先进行注释。

第三次调试

 由此可以得到错误:document.createDocumentFragment is not a function

 来到原始站点调试输出 可知该方法为底层返回一个 native code

参考链接:Document.createDocumentFragment() - Web API 接口参考 | MDN

HTMLDocument.prototype.createDocumentFragment = function createDocumentFragment(){
    debugger;
    return {}
}

第四次调试

由此可以得到错误:document.getElementsByTagName is not a function

来到源网站控制台输出

由此可以看出 document.getElementsByTagName("head")返回是站点头部得合集

HTMLDocument.prototype.getElementsByTagName = function getElementsByTagName( node ){
    debugger;

    if( 'head' == node ){
        return [ '<head></head>' ]
    }
}

第五次调试

由此可以得到错误:document.createElement is not a function

参考链接:Document.createElement() - Web API 接口参考 | MDN

HTMLDocument.prototype.createElement = function createElement( node ){

    debugger;

    if( 'a' == node ){
        return '<a></a>'
    }
    
}

第六次调试

由此可以得到错误:document.getElementById is not a function

参考链接:Document:getElementById() 方法 - Web API 接口参考 | MDN 

HTMLDocument.prototype.getElementById = function getElementById( id ){
    debugger;

    return null
}

注:此处我们还应知道变量 H1x 内容,在源站点此处打上断点进行调试输出即可。

第七次调试

由此可以得到错误:top is not defined

 

(function() {
    // 此处发现判定top是否等于self
    // 等于则返回
    // 不等于得话则执行下面得代码
    if (window.NMJ_VipCashier || top === self) {
        return
    }
    var gr2x = document.getElementById("g_top");
    if (a1x.v1x(gr2x, "module") === "discover" && a1x.v1x(gr2x, "sub") === "discover" && top["GDegradeConfig"] && top["GDegradeConfig"].degrade) {
    return
    }
    var host = window.location.host;
    var online = /music\.163\.com$/.test(host);
    var test = (/[a-z-]+\.igame\.163\.com$/.exec(host) || [])[0] || "qa.igame.163.com";
    var base = online ? "music.163.com" : test;
    var g1x = document.createElement("script");
g1x.setAttribute("type", "text/javascript");
g1x.setAttribute("src", "//st." + base + "/npm-packages/vipcashier/vipcashier.umd.js");
    document.head.appendChild(g1x)
    }
)();

来到源网站控制台输出

self = window;
top = {};

 注:上述代码通读下来 发现对我们来说没有做什么实际得东西  可以先注释

第八次调试

 由此可以得到错误:Cannot read properties of undefined (reading 'split')

 发现关键词:document.domain

document = {
    domain: domain,
    body:{
        classList: 0
    }
}

存在变量请自行替换 

第九次调试

发现吐出值了。 

结果验证

可以给出结果。

至此已完

如何逆向某抑云音乐歌曲链接接口逆向-CSDN博客

  • 15
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值