当前位置:   article > 正文

某狗音乐逆向(js逆向)_酷狗 js

酷狗 js

免责声明:
    本篇博文的初衷是分享自己学习逆向分析时的个人感悟,所涉及的内容仅供学习、交流,请勿将其用于非法用途!!!任何由此引发的法律纠纷均与作者本人无关,请自行负责!!!

1.请求分析

直接抓包分析这个参数改变的内容,我们可以直接找到这个加密参数的内容所在的位置,现在我们直接进行搜索这个加密参数进行分析

找到这个位置

找到变化的参数

有两个改变的参数,但是我们根据内容可以直接猜测出来这个time是指的是时间戳,所以我们直接进行下一步的内容读取即可

直接进行搜索这个内容,我们可以直接找到这个加密的位置,然后进行步入,找到最终生成加密参数的位置,然后进行补全代码。

直接打上断点,然后进行刷新界面,观察是否断到这个位置

成功打上断点,然后进行参数和函数效果的分析

我们可以发现参数是一个s.join("")加密函数是一个d()函数,然后现在我们直接进行内容的输出,通过控制台的形式

我们可以看出来这个内容就是参数拼接的内容

这个最终的加密参数是一个32位的密文,那么我们就需要去检查一下是否是md5加密的内容

控制台验证

加密工具验证

所以我们可以直接确定就是一个将参数拼接,然后随着时间戳的变化,整体参数是一个改变的值的一个过程,所以这个时候我们可以直接来调试然后确定到最终的内容

点击调试按钮,出现这个内容,相比于上面的多了三个额外的值

我们直接调试到最后观察内容是那一部分的。

这边继续抓包进行分析,我们可以直接找到这个内容的位置,

相应内容

所以我们可以发现这个加密的参数,应该是13个字符串组成的数组形式

所以直接拷贝然后引入md5,修改歌曲的id,然后返回python调用,这个内容就制作完成

  1. const CryptoJS = require("crypto-js");
  2. function main(name){
  3. n = Math.floor((new Date).getTime())+500
  4. si = [
  5. "NVPh5oo715z5DIWAeQlhMDsWXXQV4hwt",
  6. "appid=1014",
  7. `clienttime=${n}`,
  8. "clientver=20000",
  9. "dfid=4XSHcA2sKzHm1846L94fusi4",
  10. `encode_album_audio_id=${name}`,
  11. "mid=7761953a3ef1ef1d09d6e453a78f0424",
  12. "platid=4",
  13. "srcappid=2919",
  14. "token=",
  15. "userid=0",
  16. "uuid=7761953a3ef1ef1d09d6e453a78f0424",
  17. "NVPh5oo715z5DIWAeQlhMDsWXXQV4hwt"
  18. ]
  19. end_Signature = CryptoJS.MD5(si.join("")).toString()
  20. end_Result = {
  21. 'time':n,
  22. 's': end_Signature
  23. }
  24. return end_Result
  25. }

这部分内容就是最终的需要。

python代码

  1. import requests
  2. import json
  3. import execjs
  4. headers = {
  5. "authority": "wwwapi.kugou.com",
  6. "accept": "*/*",
  7. "accept-language": "zh-CN,zh;q=0.9",
  8. "origin": "https://www.kugou.com",
  9. "referer": "https://www.kugou.com/",
  10. "sec-ch-ua": "\"Not_A Brand\";v=\"8\", \"Chromium\";v=\"120\", \"Google Chrome\";v=\"120\"",
  11. "sec-ch-ua-mobile": "?0",
  12. "sec-ch-ua-platform": "\"Windows\"",
  13. "sec-fetch-dest": "empty",
  14. "sec-fetch-mode": "cors",
  15. "sec-fetch-site": "same-site",
  16. "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
  17. }
  18. url = "https://wwwapi.kugou.com/play/songinfo"
  19. name = "9qi99wa5"
  20. end_Result = execjs.compile(open('D:\桌面\pythoncode\酷狗音乐逆向\demo.js', 'r', encoding='utf-8').read()).call('main',name)
  21. print(end_Result)
  22. params = {
  23. "srcappid": "2919",
  24. "clientver": "20000",
  25. "clienttime": end_Result['time'],
  26. "mid": "7761953a3ef1ef1d09d6e453a78f0424",
  27. "uuid": "7761953a3ef1ef1d09d6e453a78f0424",
  28. "dfid": "4XSHcA2sKzHm1846L94fusi4",
  29. "appid": "1014",
  30. "platid": "4",
  31. "encode_album_audio_id": str(name),
  32. "token": "",
  33. "userid": "0",
  34. "signature": end_Result['s']
  35. }
  36. print(params)
  37. response = requests.get(url, headers=headers, params=params)
  38. data = bytes(response.text, 'ascii').decode('unicode_escape')
  39. print(data)
  40. with open("D:\桌面\pythoncode\酷狗音乐逆向\demo.txt",'w',encoding='utf-8') as file:
  41. file.write(data)

搜索或者是其他数据的内容都是这种形式的加密,需要的话,就直接调式到位置进行复制就行。

完善代码,直接搜索
python代码

  1. import requests
  2. import json
  3. import execjs
  4. headers = {
  5. "authority": "wwwapi.kugou.com",
  6. "accept": "*/*",
  7. "accept-language": "zh-CN,zh;q=0.9",
  8. "origin": "https://www.kugou.com",
  9. "referer": "https://www.kugou.com/",
  10. "sec-ch-ua": "\"Not_A Brand\";v=\"8\", \"Chromium\";v=\"120\", \"Google Chrome\";v=\"120\"",
  11. "sec-ch-ua-mobile": "?0",
  12. "sec-ch-ua-platform": "\"Windows\"",
  13. "sec-fetch-dest": "empty",
  14. "sec-fetch-mode": "cors",
  15. "sec-fetch-site": "same-site",
  16. "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
  17. }
  18. url = "https://wwwapi.kugou.com/play/songinfo"
  19. url_search = "https://complexsearch.kugou.com/v2/search/song"
  20. music = input("搜索的歌曲内容:")
  21. end_Result_end = execjs.compile(open('D:\桌面\pythoncode\酷狗音乐逆向\demo.js', 'r', encoding='utf-8').read()).call('main_search',music)
  22. params = {
  23. "callback": "callback123",
  24. "srcappid": "2919",
  25. "clientver": "1000",
  26. "clienttime": end_Result_end['time'],
  27. "mid": "7761953a3ef1ef1d09d6e453a78f0424",
  28. "uuid": "7761953a3ef1ef1d09d6e453a78f0424",
  29. "dfid": "4XSHcA2sKzHm1846L94fusi4",
  30. "keyword": music,
  31. "page": "1",
  32. "pagesize": "30",
  33. "bitrate": "0",
  34. "isfuzzy": "0",
  35. "inputtype": "0",
  36. "platform": "WebFilter",
  37. "userid": "0",
  38. "iscorrection": "1",
  39. "privilege_filter": "0",
  40. "filter": "10",
  41. "token": "",
  42. "appid": "1014",
  43. "signature": end_Result_end['s']
  44. }
  45. print(params)
  46. cookies = {
  47. }
  48. search_music = requests.get(url_search, headers=headers, cookies=cookies, params=params).text
  49. search_music = json.loads(str(search_music[12:-2]))
  50. music_list = search_music['data']['lists']
  51. print("-------搜索--------")
  52. for music_message in music_list:
  53. SingerName = music_message['SingerName']
  54. SongName = music_message['SongName']
  55. id = music_message['EMixSongID']
  56. print(SingerName,SongName,id)
  57. print("--------------------",end="\n\n")
  58. print("-------歌曲---------")
  59. name = input("输入歌曲id:")
  60. end_Result = execjs.compile(open('D:\桌面\pythoncode\酷狗音乐逆向\demo.js', 'r', encoding='utf-8').read()).call('main',name)
  61. print(end_Result)
  62. params = {
  63. "srcappid": "2919",
  64. "clientver": "20000",
  65. "clienttime": end_Result['time'],
  66. "mid": "7761953a3ef1ef1d09d6e453a78f0424",
  67. "uuid": "7761953a3ef1ef1d09d6e453a78f0424",
  68. "dfid": "4XSHcA2sKzHm1846L94fusi4",
  69. "appid": "1014",
  70. "platid": "4",
  71. "encode_album_audio_id": str(name),
  72. "token": "",
  73. "userid": "0",
  74. "signature": end_Result['s']
  75. }
  76. print(params)
  77. response = requests.get(url, headers=headers, params=params).json()
  78. # data = bytes(response.text, 'ascii').decode('unicode_escape')
  79. playerUrl = response['data']['play_url']
  80. print(playerUrl)
  81. print(response)

js代码

  1. const CryptoJS = require("crypto-js");
  2. function main(name){
  3. n = Math.floor((new Date).getTime())+500
  4. si = [
  5. "NVPh5oo715z5DIWAeQlhMDsWXXQV4hwt",
  6. "appid=1014",
  7. `clienttime=${n}`,
  8. "clientver=20000",
  9. "dfid=4XSHcA2sKzHm1846L94fusi4",
  10. `encode_album_audio_id=${name}`,
  11. "mid=7761953a3ef1ef1d09d6e453a78f0424",
  12. "platid=4",
  13. "srcappid=2919",
  14. "token=",
  15. "userid=0",
  16. "uuid=7761953a3ef1ef1d09d6e453a78f0424",
  17. "NVPh5oo715z5DIWAeQlhMDsWXXQV4hwt"
  18. ]
  19. end_Signature = CryptoJS.MD5(si.join("")).toString()
  20. end_Result = {
  21. 'time':n,
  22. 's': end_Signature
  23. }
  24. return end_Result
  25. }
  26. function main_search(name){
  27. var time = parseInt(new Date().getTime())
  28. demo = [
  29. "NVPh5oo715z5DIWAeQlhMDsWXXQV4hwt",
  30. "appid=1014",
  31. "bitrate=0",
  32. "callback=callback123",
  33. `clienttime=${time}`,
  34. "clientver=1000",
  35. "dfid=4XSHcA2sKzHm1846L94fusi4",
  36. "filter=10",
  37. "inputtype=0",
  38. "iscorrection=1",
  39. "isfuzzy=0",
  40. `keyword=${name}`,
  41. "mid=7761953a3ef1ef1d09d6e453a78f0424",
  42. "page=1",
  43. "pagesize=30",
  44. "platform=WebFilter",
  45. "privilege_filter=0",
  46. "srcappid=2919",
  47. "token=",
  48. "userid=0",
  49. "uuid=7761953a3ef1ef1d09d6e453a78f0424",
  50. "NVPh5oo715z5DIWAeQlhMDsWXXQV4hwt"
  51. ]
  52. end_Signature = CryptoJS.MD5(demo.join("")).toString()
  53. console.log(demo.join(""))
  54. end_Result = {
  55. 'time':time,
  56. 's': end_Signature,
  57. }
  58. return end_Result
  59. }
  60. console.log(main_search("如愿"))

效果展示

只是用于分享知识,不得用于商用或侵犯权益,如有此情况本人概不负责。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/608994
推荐阅读
相关标签
  

闽ICP备14008679号