爬虫js解密分析:某某猫小说

前言:本教程仅供学习,不得非法破坏网站。如用于其他暴力等用途,后果自负。如侵权您的网站请留言我,我立刻删除,感谢。
本次来学习一下简单的js逆向教程

为了不直接贴出网站链接,下面是已经经过某种常见的、可逆的加密方式进行加密
aHR0cHM6Ly93d3cuY2l3ZWltYW8uY29tL2NoYXB0ZXIvMTAzNTQzODcy

0x01、查看接口返回的数据

在这里插入图片描述

看到接口返回的数据有点可疑,看到这种chapter_access_key字眼,顾名思义就是章节访问key,先记着有这么一个字眼先,继续观察

在这里插入图片描述
这次又来一个字眼:encrypt,而且数据是加密的,联想上一步,进而得知,可能是:拿chapter_access_key去解密当前的加密数据

0x02、全局搜索encryt_keys

额外说明:这里再附加个格式化JS代码的技巧
在这里插入图片描述
在这里插入图片描述
这就搜索到两处encryt_keys
点进去看看呗

发现两处的地方还是有点不一样,但是怎么区分这个呢?

到这里,你是否还记得上一步的截图当中出现过的接口和当前截图里面有点一样呢?

给你再看清楚一下呗:
在这里插入图片描述
那么解决思路就来了:先看这个函数,看看debug出什么来;不行的话,再看另外那个函数

打上断点,重新加载,调试发现最终的解密函数入口是:

myDecrypt: function(f) {
            var g = new b([]);
            return g.decrypt(f)
        }
        
// 再具体一点就是函数:g.decrypt(f)
// 即是下面这个函数:
decrypt: function(g) {
           巴拉巴拉
           巴拉巴拉
           #¥%@!~%……&*()&
           #¥%@!~%……&*()&
           .
           .
           .
        }
0x03、找到了,那扣它啊!

通过将myDecrypt: function(f)扣出来之后,进行本地调试,然后就是缺啥补啥

ps: 懵懂的我一开始还不知道缺啥补啥是怎么解决,直到问了一些大佬才知道就是:如果不知道怎么解决的话,那就跟着浏览器,然后debug,一步一步看,看它调用了哪些变量/常量/函数!

如果还是不知道怎么看的话,就是将鼠标放在正在变量/函数那里,它会显示蓝色的调用栈,然后点击进去看它,即可得到解决思路。
需要导入:CryptoJS

var CryptoJS = require("C:/Users/Administrator/AppData/Roaming/npm/node_modules/crypto-js");
// var CryptoJS = require("crypto-js");  // 运行报错 Error: Cannot find module 'crypto-js',因此需要指定路径进行导入这个依赖
// console.log(module.paths);  // 上面的报错信息可以使用这个来查看导入的模块路径有哪些
// 然后查看安装路径:
// $ npm prefix -g   # node安装路径
// /Users/xxx/.nvm/versions/node/v10.16.0
// $ npm -g root  # 查看依赖安装路径
// /Users/xxx/.nvm/versions/node/v10.16.0/lib/node_modules  // 然后将这里的路径复制到上面导入的路径处
0x04、踩坑的过程痛苦并快乐着

-[x] 已掉坑:

n = d.base64.decode(n);
^
ReferenceError: d is not defined

调试的时候,看到这个未定义,以为看到base64就是转换为nodejs里面的base64的对应使用就可以了,发现最后没报错但也没有结果!!!

你知道这是很可怕的事情吗,一个没有bug的程序,而且得出的结果不是预期的
鄙人还是太菜了,我哭了,你呢?

然后反复在浏览器进行debug,一个个排除,最终将问题定位到:

n = d.base64.decode(n);

定位到这一行代码的时候,我进去看看这个decode/encode,发现并不是通过转换为nodejs的base64的decode/encode,
这是网址自己封装的加解密方式啊!!!
跪了跪了 ○| ̄|_

跪完还得继续干啊,兄嘚,继续扣相关的js呗!!!

0x05、扣完这些js之后,舒服啊,解密完毕

看一下解密的最终函数代码粗略截图:
在这里插入图片描述

运行结果截图:
在这里插入图片描述

小结:

本次收获到了调试技巧、及大概悉知网站存在偷换的概念/执行方式的可能

点击我进行了解引用来源

至此本文教程写完了,希望能够帮助到各位在爬虫路上的小伙伴们,觉得不错点个赞呗
感谢认真读完这篇教程的您

先别走呗,这里有可能有你需要的干货文章:

爬虫:js逆向目前遇到的知识点集合;
个人总结-js逆向解析思路;
CSS字体反爬实战,10分钟就能学会;
woff字体反爬实战,10分钟就能学会;
爬虫js解密分析:某某云文学;

  • 8
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 6
    评论
Cybersecurity Essentials By 作者: Charles J. Brooks – Christopher Grow – Philip Craig – Donald Short ISBN-10 书号: 1119362393 ISBN-13 书号: 9781119362395 Edition 版本: 1 出版日期: 2018-10-05 pages 页数: (767) $40 An accessible introduction to cybersecurity concepts and practices Cybersecurity Essentials provides a comprehensive introduction to the field, with expert coverage of essential topics required for entry-level cybersecurity certifications. An effective defense consists of four distinct challenges: securing the infrastructure, securing devices, securing local networks, and securing the perimeter. Overcoming these challenges requires a detailed understanding of the concepts and practices within each realm. This book covers each challenge individually for greater depth of information, with real-world scenarios that show what vulnerabilities look like in everyday computing scenarios. Each part concludes with a summary of key concepts, review questions, and hands-on exercises, allowing you to test your understanding while exercising your new critical skills. Cybersecurity jobs range from basic configuration to advanced systems analysis and defense assessment. This book provides the foundational information you need to understand the basics of the field, identify your place within it, and start down the security certification path. Learn security and surveillance fundamentals Secure and protect remote access and devices Understand network topologies, protocols, and strategies Identify threats and mount an effective defense Cybersecurity Essentials gives you the building blocks for an entry level security certification and provides a foundation of cybersecurity knowledge COVER TABLE OF CONTENTS ACKNOWLEDGMENTS ABOUT THE AUTHORS INTRODUCTION PART l:Securing the Infrastructure +CHAPTER 1:Infrastructure Security in the Real World 4CHAPTER 2:Understanding Access-Control and Monitoring Systems +CHAPTER 3:Understanding Video Surveillance Systems +CHAPTER 4:Understanding Intrusion-Detection and Reporting Systems +CHAPTER 5:Infrastructure Security:Review Questions and Hands-On Exercises PART ll:Securing Local Hosts +CHAPTER 6:Local Host Security in the Real World +CHAPTER 7:Securing Devices +CHAPTER 8:Protecting the Inner Perimeter +CHAPTER 9:Protecting Remote Access +CHAPTER 10:Local Host Security:Review Questions and Hands-On Exercises PART ll:Securing Local Networks +CHAPTER 11:Local Network Security in the Real World +CHAPTER 12:Networking Basics +CHAPTER 13:Understanding Networking Protocols +CHAPTER 14:Understanding Network Servers +CHAPTER 15:Understanding Network Connectivity Devices 4CHAPTER 16:Understanding Network Transmission Media Security +CHAPTER 17:Local Network Security:Review Questions PART IV:Securing the Perimeter +CHAPTER 18:Perimeter Security in the Real World +CHAPTER 19:Understanding the Environment +CHAPTER 20:Hiding the Private Network +CHAPTER 21:Protecting the Perimeter +CHAPTER 22:Protecting Data Moving Through the Internet 4CHAPTER 23:Tools and Utilities +CHAPTER 24:Ildentifying and Defending Against Vulnerabilities +CHAPTER 25:Perimeter Security:Review Questions and Hands-On Exercises APPENDIX A:Glossary APPENDIX B:Acronyms APPENDIX C:NIST Preliminary Cybersecurity Framework INDEX END USER LICENSE AGREEMENT

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值