35-JS VMP技术介绍

认识js vmp

js vmp其实就是一个微型解释器,然后传入一串很长的字符串或者指令集映射为原生 JS 逻辑然后进行加密,也是相混淆一样对代码进行保护的作用,他总体代码如下:

javascript 复制代码
// 1. VM核心
function VM() {
  this.stack = [];
  this.ip = 0;
  this.run = function(bytecode) {
    while (this.ip < bytecode.length) {
      const op = bytecode[this.ip];
      switch(op) {
        case 0x01: this.stack.push(bytecode[++this.ip]); this.ip++; break;
        case 0x02: 
          const a = this.stack.pop();
          const b = this.stack.pop();
          this.stack.push(a + b);
          this.ip++;
          break;
      }
    }
    return this.stack.pop();
  };
}

// 2. 字节码(业务逻辑:输入值+10)
function genBytecode(input) {
  return [0x01, input, 0x01, 10, 0x02];
}

// 3. 沙箱
const sandbox = { Math: { random: () => Math.random() } };

// 4. 桥接层
function bridge(input) {
  antiDebug(); // 先执行反逆向
  const bytecode = genBytecode(Number(input));
  const vm = new VM();
  return vm.run(bytecode);
}

// 5. 反逆向层
function antiDebug() {
  if (window.outerHeight - window.innerHeight > 200) {
    throw new Error("禁止调试!");
  }
}

// 测试调用
try {
  console.log(bridge(20)); // 输出30
} catch (e) {
  console.log(e.message);
}

当我们遇到长字符串然后有个大循环里面还有switch case 语句(或 if 嵌套)时很可能就是JS vmp,给大家看一个典型的jsvmp的例子(X日头条):

解决办法:当你有很强的js代码阅读能力时可以跟下来然后扣代码或者纯算,要不就直接全扣然后补环境

小结

本文到此结束,JS VMP本人理解其实就是混淆加强版,看不懂就去全扣补环境就行,加油加油

相关推荐
进击的雷神16 小时前
网站 SEO 功能怎么测:从手工检查到自动化脚本的实战思路
运维·爬虫·自动化·官网seo·收录
深蓝电商API19 小时前
TLS 指纹为什么越来越重要?
爬虫·tls 指纹
2601_9622035120 小时前
小白爬虫——selenium入门超详细教程
爬虫·selenium·测试工具
IT毕设实战小研3 天前
电影数据可视化推荐系统
大数据·后端·爬虫·python·算法·信息可视化·课程设计
笔触狂放3 天前
第3章 抓取静态网页数据
爬虫·python
笔触狂放3 天前
第1章 认识网络爬虫
爬虫
深蓝电商API3 天前
Referer 校验原理
爬虫·referer
天空1103 天前
你的网站在 AI 眼里是什么样:三类「人能看见、AI 看不见」的内容
爬虫·seo
zx_741484814 天前
【Python入门】爬虫实战:Requests + XPath 从基础到实战
开发语言·爬虫·python
for_ever_love__4 天前
python爬虫: GET请求与POST请求
开发语言·爬虫·python·网络编程