补环境专题一(常用参数)

开发参考文档 

dHTML(超文本标记语言) | MDN

补环境专题一(常用参数)_第1张图片

看报错 

 global

这是浏览器没有的东西,如过出现的了。就把这个删除改掉或者直接改为 window

 window

node里是不会有window的直接缺了就直接定义一个

window = this;

referrer

 这个一般是 document里的东西后面跟上网站本身/zh-CN/docs/Web/API/Document/referrer

document = {
referrer:"https://www.toutiao.com"
}

href

一般是Location: href   下面的东西 也是填自己这个网页

location ={
href:"https://www.toutiao.com"
}

 length

这是长度的,太多对象都会用到所用VM2模块去处理vm2 - npm         npm install vm2

VM2​​​​​​

//为了在node里面运行V8的环境
var fs =require('fs');      //引入操作文件的模块
const {VM} = require('vm2');  //生成一个纯净的v8引擎的环境
const vm = new VM();
//引入需要操作的js代码
var data = fs.readFileSync('../babel1_测试/babel测试.js','utf-8')
debugger
vm.run(data);   //运行js代码
debugger   



//调试版
var fs =require('fs');      //引入操作文件的模块
const {VM,VMScript} =require('vm2');
const file=`${__dirname}/code.js`;  //要调试的js
const windowfile=`${__dirname}/window.js`;  //补的环境
const script =new VMScript(fs.readFileSync(windowfile)+fs.readFileSync(file),'vm2');
debugger
VM.run(script);
debugger

protocol

浏览器的下面的协议在不一定在那个下面

location ={
protocol:"https:";
}

userAgent

浏览器信息       这个简单

navigator = {
    userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36';
}

process

检查是不是node环境下运行的用vm2可以过   V8下是没有的

plugins

检查浏览器插件在Navigator 下面 /zh-CN/docs/Web/API/Navigator

navigator={
plugins =[];
}

webdriver

浏览器驱动 不是在V8引擎下的

getOwnPropertyNames

属性名获取是在Object下的一个方法,从原型链上去取的,V8自带的

platform

处理器架构

navigator ={
    platform: 'Win32';
}

cookie 

document = {
    cookie = '';
}

//或者这样
window.document.cookie = '值 '

createEvent 

监听事件

document={

  createEvent:function(eventname){
        //先找到创建了什么事件
        console.log(eventname);
        return {
            //看看有没有调用初始化事件
            initEvent:function(x,x1,x2){
                console.log('initEvent',x);

            },
            //监听事件
            addEventListener:function(x,x1){
                console.log('addEventListener',x,x1)
            }
        }

    }


}  

canvas指纹

 生成方法

var ccc =  document.createElement('canvas');
ccc.toDataURL()

补的方法

document ={
    createElement : function(tagName){
        var tag=(tagName + '').toLowerCase();
        //假如传入的参数是这个就把正常浏览器返回的那个答案给出去
        if(tag=='canvas'){
            return {
                toDataURL:function(){ return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAACWCAYAAABkW7XSAAAAAXNSR0IArs4c6QAABGJJREFUeF7t1AEJAAAMAsHZv/RyPNwSyDncOQIECEQEFskpJgECBM5geQICBDICBitTlaAECBgsP0CAQEbAYGWqEpQAAYPlBwgQyAgYrExVghIgYLD8AAECGQGDlalKUAIEDJYfIEAgI2CwMlUJSoCAwfIDBAhkBAxWpipBCRAwWH6AAIGMgMHKVCUoAQIGyw8QIJARMFiZqgQlQMBg+QECBDICBitTlaAECBgsP0CAQEbAYGWqEpQAAYPlBwgQyAgYrExVghIgYLD8AAECGQGDlalKUAIEDJYfIEAgI2CwMlUJSoCAwfIDBAhkBAxWpipBCRAwWH6AAIGMgMHKVCUoAQIGyw8QIJARMFiZqgQlQMBg+QECBDICBitTlaAECBgsP0CAQEbAYGWqEpQAAYPlBwgQyAgYrExVghIgYLD8AAECGQGDlalKUAIEDJYfIEAgI2CwMlUJSoCAwfIDBAhkBAxWpipBCRAwWH6AAIGMgMHKVCUoAQIGyw8QIJARMFiZqgQlQMBg+QECBDICBitTlaAECBgsP0CAQEbAYGWqEpQAAYPlBwgQyAgYrExVghIgYLD8AAECGQGDlalKUAIEDJYfIEAgI2CwMlUJSoCAwfIDBAhkBAxWpipBCRAwWH6AAIGMgMHKVCUoAQIGyw8QIJARMFiZqgQlQMBg+QECBDICBitTlaAECBgsP0CAQEbAYGWqEpQAAYPlBwgQyAgYrExVghIgYLD8AAECGQGDlalKUAIEDJYfIEAgI2CwMlUJSoCAwfIDBAhkBAxWpipBCRAwWH6AAIGMgMHKVCUoAQIGyw8QIJARMFiZqgQlQMBg+QECBDICBitTlaAECBgsP0CAQEbAYGWqEpQAAYPlBwgQyAgYrExVghIgYLD8AAECGQGDlalKUAIEDJYfIEAgI2CwMlUJSoCAwfIDBAhkBAxWpipBCRAwWH6AAIGMgMHKVCUoAQIGyw8QIJARMFiZqgQlQMBg+QECBDICBitTlaAECBgsP0CAQEbAYGWqEpQAAYPlBwgQyAgYrExVghIgYLD8AAECGQGDlalKUAIEDJYfIEAgI2CwMlUJSoCAwfIDBAhkBAxWpipBCRAwWH6AAIGMgMHKVCUoAQIGyw8QIJARMFiZqgQlQMBg+QECBDICBitTlaAECBgsP0CAQEbAYGWqEpQAAYPlBwgQyAgYrExVghIgYLD8AAECGQGDlalKUAIEDJYfIEAgI2CwMlUJSoCAwfIDBAhkBAxWpipBCRAwWH6AAIGMgMHKVCUoAQIGyw8QIJARMFiZqgQlQMBg+QECBDICBitTlaAECBgsP0CAQEbAYGWqEpQAAYPlBwgQyAgYrExVghIgYLD8AAECGQGDlalKUAIEDJYfIEAgI2CwMlUJSoCAwfIDBAhkBAxWpipBCRAwWH6AAIGMgMHKVCUoAQIGyw8QIJARMFiZqgQlQMBg+QECBDICBitTlaAECBgsP0CAQEbAYGWqEpQAgQdWMQCX4yW9owAAAABJRU5ErkJggg=='}
            }

        }
    return {}

    }
}

你可能感兴趣的:(web逆向,javascript,前端,开发语言)