function v_mk(){ function v_filter(f){ var js = [ "Object", "Function", "Array", "Number", "parseFloat", "parseInt", "Infinity", "NaN", "undefined", "Boolean", "String", "Symbol", "Date", "RegExp", "Error", "EvalError", "RangeError", "ReferenceError", "SyntaxError", "TypeError", "URIError", "globalThis", "JSON", "Math", "ArrayBuffer", "Uint8Array", "Int8Array", "Uint16Array", "Int16Array", "Uint32Array", "Int32Array", "Float32Array", "Float64Array", "Uint8ClampedArray", "BigUint64Array", "BigInt64Array", "BigInt", "Set", "WeakMap", "WeakSet", "Proxy", "Reflect", "decodeURI", "decodeURIComponent", "encodeURI", "encodeURIComponent", "escape", "unescape", "eval", "isFinite", "isNaN", "DataView", "Map", "console", ] return js.indexOf(f) != -1 } function v_filter2(f){ var js = [ "alert", "atob", "btoa", "blur", "cancelAnimationFrame", "cancelIdleCallback", "captureEvents", "clearInterval", "clearTimeout", "close", "confirm", "createImageBitmap", "fetch", "find", "focus", "getComputedStyle", "getSelection", "matchMedia", "moveBy", "moveTo", "open", "postMessage", "print", "prompt", "queueMicrotask", "releaseEvents", "requestAnimationFrame", "requestIdleCallback", "resizeBy", "resizeTo", "scroll", "scrollBy", "scrollTo", "setInterval", "setTimeout", "stop", "webkitCancelAnimationFrame", "webkitRequestAnimationFrame", "showDirectoryPicker", "showOpenFilePicker", "showSaveFilePicker", "openDatabase", "webkitRequestFileSystem", "webkitResolveLocalFileSystemURL", ] return js.indexOf(f) != -1 } function v_get_model_from_native(objfunc) { var c; try{ new objfunc c = 1 }catch(e){ if (e.stack.indexOf('Illegal constructor') != -1){ c = 0 }else{ c = 1 } } var n = /function ([^ (]+)/.exec(objfunc+'')[1] if (v_filter(n)){ return '' } var v = Object.getOwnPropertyDescriptors(objfunc.prototype) var e = (/\[object ([^\]]+)\]/.exec(objfunc.prototype.__proto__+'') || [])[1] if (e == 'Object'){ e = undefined } var ret = [ `class ${n}${e?" extends "+e:""}{`, ` constructor(){ ${e?'var _tmp=v_t;v_t=false;super();v_t=_tmp;':'_odt(this, _y, {[_e]:!1,[_c]:!1,[_w]:!1,[_v]:{}});'}if (${n}._init){${n}._init(this)};${c?' ':' if(v_t){ throw _ntpe() }'} }` ] var b = [] for (var i in v){ var r = [] if ('get' in v[i] || 'set' in v[i]){ // console.log(v[i]) if ('get' in v[i]){ var Illegal_invocation = '' try{ console.log('v[i].get()', v, i, v[i].get()) }catch(e){ if (e.stack.indexOf('Illegal invocation')!=-1){ Illegal_invocation = `if(!(this instanceof ${n})){throw _tpe('Illegal invocation')}` } } r.push(`get ${i}(){${Illegal_invocation}return _gs("[${n}].get ${i}", this[_y].${i})}`) } if ('set' in v[i]){ if (v[i].set){ r.push(`set ${i}(v){return _gs("[${n}].set ${i}", this[_y].${i}=v)}`) } } r = r.join('; ') ret.push(` `+r) } else if (i !== 'constructor') { if (typeof v[i].value == 'number' || typeof v[i].value == 'boolean'){ b.push(['number', i, v[i]]) continue } else if (typeof v[i].value == 'function'){ var funcname = (/function ([^ (]+)/.exec(v[i].value + '') || [])[1] // r = `${funcname}(){if(this[_y].${i}){return this[_y].${i}(...arguments)}return _fu("[${n}].${i}(*)", arguments)}` r = `${funcname}(){return _fu("[${n}].${i}(*)", arguments, this[_y].${i}?this[_y].${i}(...arguments):void 0)}` // r = `${funcname}(){return _fu("[${n}].${i}(*)", this[_y].${i}?this[_y].${i}(...arguments):arguments)}` } else{ continue throw Error(i) } ret.push(` `+r) } if (i !== 'constructor'){ b.push(['function', i, v[i]]) } ret.join('\n') } ret.push('}') ret.push(`${n}._new = function(){var _tmp=v_t;v_t=false;var r=new ${n};v_t=true;v_t=_tmp;return hook_obj(r, ' (o) ${n}')}`) // ret.push(`${n}._new = function(){var _tmp=v_t;v_t=false;var r=new ${n};if (${n}._init){${n}._init(r)};v_t=true;v_t=_tmp;return hook_obj(r, ' (o) ${n}')}`) ret.push(`saf_class(${n})`) ret.push(`_ods(${n}.prototype, {`) for (var [tp, i, val] of b){ if (tp == 'number' || tp == 'boolean'){ var jsondata = JSON.stringify(val) jsondata = jsondata.replace('"writable":', '[_w]:').replace('"enumerable":', '[_e]:').replace('"configurable":', '[_c]:').replace('"value":', '[_v]:').replace(/:true/g, ':!0').replace(/:false/g, ':!1') ret.push(` ${JSON.stringify(i)}: ${jsondata},`) }else{ var jsondata = JSON.stringify(val) jsondata = jsondata.replace('"writable":', '[_w]:').replace('"enumerable":', '[_e]:').replace('"configurable":', '[_c]:').replace('"value":', '[_v]:').replace(/:true/g, ':!0').replace(/:false/g, ':!1') ret.push(` ${JSON.stringify(i)}: ${jsondata},`) } } var s = Object.getOwnPropertySymbols(v) for (var i in s){ var symbolname = /\((.+)\)/.exec(s[i].toString())[1] if (typeof v[s[i]].value == 'function' && !((v[s[i]].value+'').startsWith("function ["))){ var funcname = (/function ([^ (]+)/.exec(v[s[i]].value+'') || ["", ""])[1] // var meta_funcname = n+'_'+funcname // v[s[i]].value = meta_funcname // ret.unshift(`${meta_funcname} = saf(function ${funcname}(){})`) // var jsondata = JSON.stringify(v[s[i]]).replace(`"${meta_funcname}"`, `${meta_funcname}`) v[s[i]].value = 'vilameplaceholder' var jsondata = JSON.stringify(v[s[i]]).replace(`"vilameplaceholder"`, `saf(function ${funcname}(){})`) }else{ var jsondata = JSON.stringify(v[s[i]]) } jsondata = jsondata.replace('"writable":', '[_w]:').replace('"enumerable":', '[_e]:').replace('"configurable":', '[_c]:').replace('"value":', '[_v]:').replace(/:true/g, ':!0').replace(/:false/g, ':!1') ret.push(` [${symbolname}]: ${jsondata},`) } ret.push(`});`) ret.push(`_ods(${n}, {`) var k = Object.getOwnPropertyDescriptors(objfunc) var b = Object.keys(k) for (var i = 0; i < b.length; i++) { if (b[i] !== 'prototype'){ var jsondata = JSON.stringify(k[b[i]]) jsondata = jsondata.replace('"writable":', '[_w]:').replace('"enumerable":', '[_e]:').replace('"configurable":', '[_c]:').replace('"value":', '[_v]:').replace(/:true/g, ':!0').replace(/:false/g, ':!1') ret.push(` ${JSON.stringify(b[i])}: ${jsondata},`) } } ret.push(`});`) // tail for (var i = 0; i < ret.length; i++) { ret[i] = ` ` + ret[i] } ret.unshift(`function make_${n}(){`) ret.push(` return ${n}`) ret.push(`}`) ret.push(`var ${n} = make_${n}()`) ret = ret.join('\n') + '\n' if (v_global_func.indexOf(n) == -1){ v_global_func.push(n) } var rr = {'key': [n, e], 'string': ret} return rr } var v_str_saf = ` // saf var saf,saf_class; ;(function(){ var $toString = Function.toString , cacheI = [] , cacheS = [] , idxI = [].indexOf.bind(cacheI) , pushI = [].push.bind(cacheI) , pushS = [].push.bind(cacheS) Object.defineProperty(Function.prototype, 'toString', { "enumerable": !1, "configurable": !0, "writable": !0, "value": function toString() { return typeof this == 'function' && cacheS[idxI(this)] || $toString.call(this); } }) function safe_func(func, name){ if (-1 == idxI(func)){ pushI(func) pushS(\`function \${name || func.name || ''}() { [native code] }\`) } return func }; safe_func(Function.prototype.toString, 'toString') saf = safe_func var ogpds = Object.getOwnPropertyDescriptors var ok = Object.keys saf_class=function(t) { saf(t);for (var e=ogpds(t.prototype),o=ok(e),n=0;n_le?'':' '.repeat(_le-title.length) if(_lin){ var linfo = Error() var line = linfo.stack.split('\\n')[4] var lines = /([^\\(\\) ]+):\\d+:\\d+/.exec(line) var line = lines?line.replace(lines[0], lines[0].replace(lines[1], v_encodeURI('file:///' + lines[1].replace(/\\\\/g, '/')))):'' }else{ var line = '' } _bl(title + arguments[3], util.inspect(arguments[4]).split('\\n')[0], _join(_slice(arguments,5), ' '), line) }catch(e){_bl('[ LOG ERROR ]', e.stack)}} var _gs = function(a, b){ // _bl(' >>>', a, util.inspect(b).split('\\n').slice(0, 1).join('\\n')) // 暂时无大用,输出多了影响观察 return b; } var _ogs = function(a, b){ // if(v_t){_bl(' o=>', a, util.inspect(b).split('\\n').slice(0, 1).join('\\n'))} return b; } var _fu = function(a, b, c){ if(v_t){_bl(' (*)', a, util.inspect(b).split('\\n').slice(0, 10).join('\\n')+'...', '===>', c)} return c } function hook_obj_prototype(obj, hook_ca){ var name = /function\\s+([^(\\s]+)/.exec(obj+'')[1] function _obj(){return obj.apply(this, arguments)} saf(_obj, name) var _desc = Object.getOwnPropertyDescriptors(obj) var _proto = _desc['prototype'] var e = 'enumerable' var w = 'writable' var c = 'configurable' var _e = _proto[e] var _w = _proto[w] var _c = _proto[c] delete _desc['prototype'] if (hook_ca){ _obj = new Proxy(_obj, { construct:function(a,b,c){ if (v_t){_m(name,'[construct]',b,'<==>',typeof c=='function'?(c+'').slice(0,100):c?_sfy(c).slice(0,100)+'...':c)}; return Reflect.construct(a,b,c) }, apply: function(a,b,c){ try{ var r = Reflect.apply(a,b,c) if (v_t){_m(name,'[apply]',c,'<==>',r)}; return r }catch(e){ if (v_t){_m(name,'[apply]',c,'<==>','[ ERROR ]')}; return } } }) } _desc['prototype'] = {value:new Proxy(_proto.value, { get:function(a,b){ var r = Reflect.get(a,b) var l = r if (typeof r == "number" || typeof r == "boolean" || _iar(r)){ l = _sfy(r) } else if(typeof r == 'function'){ l = (r + '').slice(0,100)+'...' } else{ l = r } if (v_t){_m(name,'[prototype.get]',b,'<==>',l)}; return r; }, set:function(a,b,c){ if (v_t){_m(name,'[prototype.set]',b,'<==>',typeof c=='function'?(c+'').slice(0,100):c?_sfy(c).slice(0,100)+'...':c)}; return Reflect.set(a,b,c) }, }),[e]:_e,[w]:_w,[c]:_c} return _ods(_obj, _desc) } function hook_obj(r,n){ if (!_h){return r} return new Proxy(r, { get:function(a,b){ try{ var r = Reflect.get(a,b) }catch(e){ _m(n?n:a,'[get]',b,'<==>','[ ERROR ]') throw e } var l = r if (typeof r == "number" || typeof r == "boolean" || _iar(r)){ l = r; } else if(typeof r == 'function'){ l = (r + '').slice(0,100)+'...' } else{ l = r } if (v_t&&typeof b!='symbol'&&b!='toJSON'){_m(n?n:a,'[get]',b,'<==>',l)}; if (b == 'hasOwnProperty'){ var tmp = a[b] return function(){ return _fu('hasOwnProperty', arguments, tmp.apply(this, arguments)) } } if (b == '__proto__' && !_isvm){ // vm2 使用时就不好处理 this.__proto__ = window.__proto__ ,需注意 if (!a[_y]){ a[_y] = {} } if (!a[_y]['fake__proto__']){ if (a[b] && a[b] !== _objp){ a[_y]['fake__proto__'] = hook_obj(a[b],n+'.__proto__') } } return a[_y]['fake__proto__'] } return r; }, set:function(a,b,c){ if (v_t&&typeof b!='symbol'){_m(n?n:a,'[set]',b,'<==>',typeof c=='function'?(c+'').slice(0,100)+'...':c?_sfy(c).slice(0,100)+'...':c)}; return Reflect.set(a,b,c) }, }) } console.log('start') // 勿删 Function = hook_obj_prototype(Function, true) // Function 的 construct 和 apply 非常重要,需要特别关注 // Object = hook_obj_prototype(Object) // Array = hook_obj_prototype(Array) Number = hook_obj_prototype(Number) Boolean = hook_obj_prototype(Boolean) String = hook_obj_prototype(String) Symbol = hook_obj_prototype(Symbol) RegExp = hook_obj_prototype(RegExp) Error = hook_obj_prototype(Error) ReferenceError = hook_obj_prototype(ReferenceError) // Date = hook_obj_prototype(Date) function hook_especially(e){ if (e == Object){ var check = [ 'defineProperties','defineProperty','keys','assign' ], name = 'Object' } if (e == Date.prototype){ var check = [ 'getTime','valueOf' ], name = 'Date.prototype' } if (e == Date){ var check = [ 'now' ], name = 'Date' } if (e == Math){ var check = [ 'random' ], name = 'Math' } return new Proxy(e, {get: function(a,b){ if (check.indexOf(b) != -1){ if (v_t){_bl(\` >>> get \${name}.\${b}\`)} } return Reflect.get(a,b) }}) } // 高频函数调用 Object = hook_especially(Object) Date = hook_especially(Date) Date.prototype = hook_especially(Date.prototype) // Math = hook_especially(Math) var v_parse = JSON.parse var v_stringify = JSON.stringify var v_decodeURI = decodeURI var v_decodeURIComponent = decodeURIComponent var v_encodeURI = encodeURI var v_encodeURIComponent = encodeURIComponent var v_escape = escape var v_unescape = unescape JSON.parse = saf(function parse(){return _fu('JSON.parse', arguments, v_parse.apply(this, arguments))}) JSON.stringify = saf(function stringify(){return _fu('JSON.stringify', arguments, v_stringify.apply(this, arguments))}) decodeURI = saf(function decodeURI(){return _fu('decodeURI', arguments, v_decodeURI.apply(this, arguments))}) decodeURIComponent = saf(function decodeURIComponent(){return _fu('decodeURIComponent', arguments, v_decodeURIComponent.apply(this, arguments))}) encodeURI = saf(function encodeURI(){return _fu('encodeURI', arguments, v_encodeURI.apply(this, arguments))}) encodeURIComponent = saf(function encodeURIComponent(){return _fu('encodeURIComponent', arguments, v_encodeURIComponent.apply(this, arguments))}) escape = saf(function escape(){return _fu('escape', arguments, v_escape.apply(this, arguments))}) unescape = saf(function unescape(){return _fu('unescape', arguments, v_unescape.apply(this, arguments))}) if (_isvm){ delete v_this.Buffer delete v_this.VMError }else{ delete global.Buffer } function make_EventTarget(){ class EventTarget{ constructor(){ _odt(this, _y, {[_e]:!1,[_c]:!1,[_w]:!1,[_v]:{}});if (EventTarget._init){EventTarget._init(this)}; } addEventListener(){return _fu("[EventTarget].addEventListener(*)", arguments, (this||window)[_y].addEventListener?(this||window)[_y].addEventListener(...arguments):void 0)} dispatchEvent(){return _fu("[EventTarget].dispatchEvent(*)", arguments, (this||window)[_y].dispatchEvent?(this||window)[_y].dispatchEvent(...arguments):void 0)} removeEventListener(){return _fu("[EventTarget].removeEventListener(*)", arguments, (this||window)[_y].removeEventListener?(this||window)[_y].removeEventListener(...arguments):void 0)} } EventTarget._new = function(){var _tmp=v_t;v_t=false;var r=new EventTarget;v_t=true;v_t=_tmp;return hook_obj(r, ' (o) EventTarget')} saf_class(EventTarget) _ods(EventTarget.prototype, { "addEventListener": {[_w]:!0,[_e]:!0,[_c]:!0}, "dispatchEvent": {[_w]:!0,[_e]:!0,[_c]:!0}, "removeEventListener": {[_w]:!0,[_e]:!0,[_c]:!0}, [Symbol.toStringTag]: {[_v]:"EventTarget",[_w]:!1,[_e]:!1,[_c]:!0}, }); _ods(EventTarget, { "length": {[_v]:0,[_w]:!1,[_e]:!1,[_c]:!0}, "name": {[_v]:"EventTarget",[_w]:!1,[_e]:!1,[_c]:!0}, "arguments": {[_v]:null,[_w]:!1,[_e]:!1,[_c]:!1}, "caller": {[_v]:null,[_w]:!1,[_e]:!1,[_c]:!1}, }); return EventTarget } var EventTarget = make_EventTarget() function make_WindowProperties(){ class WindowProperties extends EventTarget{ constructor(){ super(); if(v_t){ throw _ntpe() } } } saf(WindowProperties, 'EventTarget'); _ods(WindowProperties.prototype, { [Symbol.toStringTag]: { value: "WindowProperties", configurable: !0 } }); return WindowProperties } var WindowProperties = make_WindowProperties() delete WindowProperties.prototype.constructor // WindowProperties 这个是特殊的,另外 WindowProperties 在 window 环境里面不存在,注意 function make_Window(){ class Window extends WindowProperties{ constructor(){ super(); if(v_t){ throw _ntpe() } } } saf_class(Window) _ods(Window.prototype, { "TEMPORARY": {"value":0,[_w]:!1,[_e]:!0,[_c]:!1}, "PERSISTENT": {"value":1,[_w]:!1,[_e]:!0,[_c]:!1}, [Symbol.toStringTag]: {"value":"Window",[_w]:!1,[_e]:!1,[_c]:!0}, }); _ods(Window, { "length": {"value":0,[_w]:!1,[_e]:!1,[_c]:!0}, "name": {"value":"Window",[_w]:!1,[_e]:!1,[_c]:!0}, "arguments": {"value":null,[_w]:!1,[_e]:!1,[_c]:!1}, "caller": {"value":null,[_w]:!1,[_e]:!1,[_c]:!1}, "TEMPORARY": {"value":0,[_w]:!1,[_e]:!0,[_c]:!1}, "PERSISTENT": {"value":1,[_w]:!1,[_e]:!0,[_c]:!1}, }); return Window } var Window = make_Window() function make_MemoryInfo(){ class MemoryInfo{ constructor(){ _odt(this, _y, {[_e]:!1,[_c]:!1,[_w]:!1,[_v]:{}});if (MemoryInfo._init){MemoryInfo._init(this)}; if(v_t){ throw _ntpe() } } get jsHeapSizeLimit(){if(!(this instanceof MemoryInfo)){throw _tpe('Illegal invocation')}return _gs("[console.memory].get jsHeapSizeLimit", this[_y].jsHeapSizeLimit)} get totalJSHeapSize(){if(!(this instanceof MemoryInfo)){throw _tpe('Illegal invocation')}return _gs("[console.memory].get totalJSHeapSize", this[_y].totalJSHeapSize)} get usedJSHeapSize(){if(!(this instanceof MemoryInfo)){throw _tpe('Illegal invocation')}return _gs("[console.memory].get usedJSHeapSize", this[_y].usedJSHeapSize)} } MemoryInfo._new = function(){var _tmp=v_t;v_t=false;var r=new MemoryInfo;v_t=true;v_t=_tmp;return hook_obj(r, ' (o) MemoryInfo')} saf_class(MemoryInfo) _ods(MemoryInfo.prototype, { "jsHeapSizeLimit": {[_e]:!0,[_c]:!0}, "totalJSHeapSize": {[_e]:!0,[_c]:!0}, "usedJSHeapSize": {[_e]:!0,[_c]:!0}, [Symbol.toStringTag]: {"value":"MemoryInfo",[_w]:!1,[_e]:!1,[_c]:!0}, }); return MemoryInfo } var MemoryInfo = make_MemoryInfo() MemoryInfo._init = function(_this){ _this[_y].jsHeapSizeLimit = 4294705152 _this[_y].totalJSHeapSize = 27739528 _this[_y].usedJSHeapSize = 21954156 } ` } function v_make_model_from_obj(obj, prefix){ var customized = ['MimeTypeArray', 'PluginArray'] var ret = [] var v = obj.constructor var newname = /function ([^(]+)/.exec(v+'')[1] // if (v_filter(newname)){ // return '' // } ret.push(`function init_${newname}(n,r){`) if (newname == 'Promise'){ ret.push(` r = new ${newname}(function(resolve, reject){})`) }else{ ret.push(` r = new ${newname}`) } ret.push(` if(r._init){r._init(r)}`) if (customized.indexOf(newname) == -1){ var v = Object.getOwnPropertyDescriptors(obj.constructor.prototype) var k = Object.keys(v) for (var i in k){ var name = k[i] if ('get' in v[name]){ // if (typeof obj[name] !== 'object' || obj[name] == null){ var tpname = /\[object (.*)\]/.exec(Object.prototype.toString.call(obj[name]))[1] console.log(name, tpname) if (['Null','Undefined','String','Boolean','Array','Object','Number'].indexOf(tpname) != -1){ var key = name var val = obj[name] ret.push(` r[_y].${key} = ${JSON.stringify(val)}`) }else{ var inglobal; try{ eval(tpname) inglobal = true }catch(e){ inglobal = false } // console.log(name, tpname, inglobal, obj[name]) if (inglobal){ var rv = v_get_model_from_native(eval(tpname)) var qq = v_make_model_from_obj(obj[name], prefix) rv['string'] += qq rv['have_init'] = true // console.log(rv['string']) prefix.unshift(rv) ret.push(` r[_y].${name} = init_${tpname}();`) }else{ // 这里暂时处理不了那种 global 中没有的模型类,比如 DeprecatedStorageQuota 这个 console.log('unhandle obj.', name) // console.log(v_get_model_from_native(obj[name].__proto__) + v_make_model_from_obj(obj[name])) } } } } var v = Object.getOwnPropertyDescriptors(obj) var k = Object.keys(v) ret.push(` _ods(r, {`) var indx = ret.length for (var i in k){ var name = k[i] if ('get' in v[name]){ // 按道理是不应该走到这里的 v[name]['get'] = 'vilameplaceholder_get' if ('set' in v[name]){ v[name]['set'] = 'vilameplaceholder_set' } var jsondata = JSON.stringify(v[name]) jsondata = jsondata.replace('"writable":', '[_w]:').replace('"enumerable":', '[_e]:').replace('"configurable":', '[_c]:').replace('"get":', '[_g]:').replace('"set":', '[_s]:').replace(/:true/g, ':!0').replace(/:false/g, ':!1') jsondata = jsondata.replace('"vilameplaceholder_get"', `saf(function ${name}(){return _ogs("[${newname}.${name}] get", this[_y].${name})})`) jsondata = jsondata.replace('"vilameplaceholder_set"', `saf(function ${name}(v){return _ogs("[${newname}.${name}] set", this[_y].${name}=v)})`) console.log(name, v[name], 'unknown', jsondata) ret.push(` ${JSON.stringify(name)}: ${jsondata},`) } if ('value' in v[name]){ var inglobal; var init_obj; try{ if ((eval(name) + '').indexOf('{ [native code] }') != -1 && (eval(name) + '').indexOf('$') == -1){ inglobal = true }else{ inglobal = false } }catch(e){ inglobal = false } if (inglobal){ try{ // console.log('==============', name, v[name].value, v) var rv = v_get_model_from_native(eval(name)) prefix.unshift(rv) init_obj = rv.trim()?true:false }catch(e){ init_obj = false } } // "[object Null]" // "[object Undefined]" // "[object String]" // "[object Boolean]" // "[object Array]" // var tpname = /\[object (.*)\]/.exec(Object.prototype.toString.call(v[name].value))[1] // console.log(name, v[name]) try{ if (init_obj || (newname == 'Window' && v_global_func.indexOf(name) != -1) || v_filter(name) || v_filter2(name)){ if (v_filter2(name)){ v[name].value = 'vilameplaceholder' // var jsondata = JSON.stringify(v[name]).replace(`"vilameplaceholder"`, `saf(function ${name}(){if(window[_y].${name}){return window[_y].${name}(...arguments)}})`) // var jsondata = JSON.stringify(v[name]).replace(`"vilameplaceholder"`, `saf(function ${name}(){var _tmp;if(window[_y].${name}){_tmp=1;}return _fu("[window].${name}(*)", _tmp?window[_y].${name}(...arguments):arguments, _tmp)})`) var jsondata = JSON.stringify(v[name]).replace(`"vilameplaceholder"`, `saf(function ${name}(){return _fu("[window].${name}(*)", arguments, window[_y].${name}?window[_y].${name}(...arguments):void 0)})`) }else{ v[name].value = 'vilameplaceholder' var jsondata = JSON.stringify(v[name]).replace(`"vilameplaceholder"`, `${name}`) } }else{ if (newname == 'Window'){ console.log(v[name], name, '11111111111111') console.log(v[name].value+'', ) } var jsondata = JSON.stringify(v[name]) } if (!(newname=='Window' && (name.startsWith('v_')||name.startsWith('$')||name=='saf_class'||name=='saf'|| ((v[name].value+'').indexOf('[Command Line API]')!=-1) ))){ jsondata = jsondata.replace('"writable":', '[_w]:').replace('"enumerable":', '[_e]:').replace('"configurable":', '[_c]:').replace('"value":', '[_v]:').replace(/:true/g, ':!0').replace(/:false/g, ':!1') ret.push(` ${JSON.stringify(name)}: ${jsondata},`) } }catch(e){ console.log(e.stack,v,name) if (e.stack.indexOf('circular') != -1){ ret.push(` ${JSON.stringify(name)}: r,`) } } } } if (indx == ret.length){ ret.pop() }else{ ret.push(` });`) } } // ret.push(` return r`) ret.push(` return hook_obj(r,n)`) ret.push(`}`) return ret.join('\n') } // v = v_mk_head_WindowProperties() // v += v_get_model_from_native(NetworkInformation) + v_make_model_from_obj(navigator.connection) // console.log(v) // eval(v) // console.log(r) var v_global_s = [] var v_global_func = [] function v_global_init(s){ var top = ['EventTarget'] for (var i = 0; i < s.length; i++) { var t = s[i]['key'] if (t&&!t[1]){ if (top.indexOf(t[0]) == -1){ top.push(t[0]) } } } for (var x = 0; x < 10; x++) { for (var i = 0; i < s.length; i++) { var t = s[i]['key'] if (t&&t[0]&&top.indexOf(t[1])!=-1){ if (top.indexOf(t[0]) == -1){ top.push(t[0]) } } } } // console.log(top) var ret = [] for (var j = 0; j < top.length; j++) { if (top[j] == 'EventTarget'){ continue } var temp = [] for (var i = 0; i < s.length; i++) { if (s[i]['key']&&s[i]['key'][0]===top[j]){ // ret.push(s[i]['string']) temp.push(s[i]) } } var ctnue = false for (var i = 0; i>4);do{if(61==(o=255&r.charCodeAt(c++)))return n;o=t[o]}while(c>2);do{if(61==(h=255&r.charCodeAt(c++)))return n;h=t[h]}while(c>2),t+=a.charAt((3&h)<<4),t+="==";break}if(c=r.charCodeAt(e++),e==o){t+=a.charAt(h>>2),t+=a.charAt((3&h)<<4|(240&c)>>4),t+=a.charAt((15&c)<<2),t+="=";break}i=r.charCodeAt(e++),t+=a.charAt(h>>2),t+=a.charAt((3&h)<<4|(240&c)>>4),t+=a.charAt((15&c)<<2|(192&i)>>6),t+=a.charAt(63&i)}return t}}} var atob_btoa = mk_atob_btoa() window[_y].btoa = atob_btoa.btoa window[_y].atob = atob_btoa.atob // styleMedia = init_StyleMedia('styleMedia') // speechSynthesis = init_SpeechSynthesis('speechSynthesis') // 将构造的各种参数直接传给 global 和环境下的 this 使用 Object.defineProperties(v_this, {[Symbol.toStringTag]:{value:'Window'}}) Object.defineProperties(v_this, Object.getOwnPropertyDescriptors(window)) if (_isvm){ v_this.__proto__ = window.__proto__ }else{ Object.defineProperties(global, Object.getOwnPropertyDescriptors(window)) } delete console.Console console.memory = MemoryInfo._new() // performance 的时间校准模拟 _odt(performance[_y], 'timeOrigin', {get(){return _ti + 0.333}}) _odt(performance[_y].timing[_y], 'navigationStart', {get(){return _ti}}) _odt(performance[_y].timing[_y], 'unloadEventStart', {get(){return _ti + 11}}) _odt(performance[_y].timing[_y], 'unloadEventEnd', {get(){return _ti + 11}}) _odt(performance[_y].timing[_y], 'redirectStart', {get(){return 0}}) _odt(performance[_y].timing[_y], 'redirectEnd', {get(){return 0}}) _odt(performance[_y].timing[_y], 'fetchStart', {get(){return _ti + 1}}) _odt(performance[_y].timing[_y], 'domainLookupStart', {get(){return _ti + 1}}) _odt(performance[_y].timing[_y], 'domainLookupEnd', {get(){return _ti + 1}}) _odt(performance[_y].timing[_y], 'connectStart', {get(){return _ti + 1}}) _odt(performance[_y].timing[_y], 'connectEnd', {get(){return _ti + 1}}) _odt(performance[_y].timing[_y], 'secureConnectionStart', {get(){return 0}}) _odt(performance[_y].timing[_y], 'requestStart', {get(){return _ti + 5}}) _odt(performance[_y].timing[_y], 'responseStart', {get(){return _ti + 7}}) _odt(performance[_y].timing[_y], 'responseEnd', {get(){return _ti + 8}}) _odt(performance[_y].timing[_y], 'domLoading', {get(){return _ti + 15}}) _odt(performance[_y].timing[_y], 'domInteractive', {get(){return _ti + 50}}) _odt(performance[_y].timing[_y], 'domContentLoadedEventStart', {get(){return _ti + 50}}) _odt(performance[_y].timing[_y], 'domContentLoadedEventEnd', {get(){return _ti + 50}}) _odt(performance[_y].timing[_y], 'domComplete', {get(){return _ti + 50}}) _odt(performance[_y].timing[_y], 'loadEventStart', {get(){return _ti + 51}}) _odt(performance[_y].timing[_y], 'loadEventEnd', {get(){return _ti + 51}}) performance[_y].getEntriesByType = function(key){ if (key === undefined){ throw _tpe(\`Failed to execute 'getEntriesByType' on 'Performance': 1 argument required, but only 0 present.\`) } return [] } PerformanceNavigationTiming._init = function(_this){ _this[_y].connectEnd = 1.699999988079071 _this[_y].connectStart = 1.699999988079071 _this[_y].decodedBodySize = 440595 _this[_y].domComplete = 873.5 _this[_y].domContentLoadedEventEnd = 781.0999999642372 _this[_y].domContentLoadedEventStart = 776.5 _this[_y].domInteractive = 754.3000000119209 _this[_y].domainLookupEnd = 1.699999988079071 _this[_y].domainLookupStart = 1.699999988079071 _this[_y].duration = 873.8000000119209 _this[_y].encodedBodySize = 104181 _this[_y].entryType = "navigation" _this[_y].fetchStart = 1.699999988079071 _this[_y].initiatorType = "navigation" _this[_y].loadEventEnd = 873.8000000119209 _this[_y].loadEventStart = 873.5 _this[_y].name = window[_y].location[_y].href _this[_y].nextHopProtocol = "http/1.1" _this[_y].redirectCount = 0 _this[_y].redirectEnd = 0 _this[_y].redirectStart = 0 _this[_y].requestStart = 9 _this[_y].responseEnd = 320.0999999642372 _this[_y].responseStart = 72.19999998807907 _this[_y].secureConnectionStart = 1.699999988079071 _this[_y].serverTiming = [] _this[_y].startTime = 0 _this[_y].transferSize = 104937 _this[_y].type = "navigate" _this[_y].unloadEventEnd = 80 _this[_y].unloadEventStart = 80 _this[_y].workerStart = 0 } window[_y].performance[_y]['cache'] = [PerformanceNavigationTiming._new()] window[_y].performance[_y].mark = function(name){ var _this = window[_y].performance if (name === undefined){ throw _tpe(\`Failed to execute 'mark' on 'Performance': 1 argument required, but only 0 present.\`) } var r = PerformanceMark._new() r[_y].detail = null r[_y].duration = 0 r[_y].entryType = "mark" r[_y].name = name if (!_this[_y].timeStamp){_odt(_this[_y], 'startTime', {value:(++window[_y]._timing_idx)*200 + ((_rd() * 30)^0)})} _this[_y]['cache'].push(r) } window[_y].performance[_y].getEntries = function(){ return window[_y].performance[_y]['cache'] } window[_y].performance[_y].now = function(){ return (++window[_y]._timing_idx)*200 + ((_rd() * 30)^0) } BatteryManager._init = function(_this){ _this[_y].charging = true _this[_y].chargingTime = 0 _this[_y].dischargingTime = Infinity _this[_y].level = 1 _this[_y].onchargingchange = null _this[_y].onchargingtimechange = null _this[_y].ondischargingtimechange = null _this[_y].onlevelchange = null } HTMLCollection._init = function(_this){ _odt(_this[_y], 'length', {get:function(){ return _ojk(_this).length }}) _this[_y].item = function(e){ if (!arguments.length){ throw _tpe("Failed to execute 'item' on 'HTMLCollection': 1 argument required, but only 0 present.") } return _this[e] || null } } NodeList._init = function(_this){ _odt(_this[_y], 'length', {get:function(){ return _ojk(_this).length }}) } // 应对部分字体加密搞的一定随机性的处理 HTMLSpanElement._init = function(_this){ _ods(_this[_y], { offsetWidth: { get: function(){ return 12+((_rd()>0.8)?1:0) } }, offsetHeight: { get: function(){ return 12+((_rd()>0.8)?1:0) } } }) } window[_y].getComputedStyle = function(element, pseudoElt){ return element.style } HTMLScriptElement._init = function(_this){ _this[_y].src = '' _this[_y].type = '' _this[_y].noModule = false _this[_y].charset = _this[_y].async = true _this[_y].defer = false _this[_y].crossOrigin = null _this[_y].text = '' _this[_y].referrerPolicy = null _this[_y].event = '' _this[_y].htmlFor = '' _this[_y].integrity = '' } window[_y].listeners = {} // 全部监听事件,方便管理 function v_hook_getElement(e){ e[_y].getElementById = function(){return window[_y].v_getele(...arguments)} e[_y].getElementsByClassName = function(){return window[_y].v_geteles(...arguments)} e[_y].getElementsByName = function(){return window[_y].v_geteles(...arguments)} e[_y].getElementsByTagName = function(){return window[_y].v_geteles(...arguments)} e[_y].getElementsByTagNameNS = function(){return window[_y].v_geteles(...arguments)} e[_y].querySelectorAll = function(){return window[_y].v_geteles(...arguments)} e[_y].querySelector = function(){return window[_y].v_getele(...arguments)} e[_y].style = CSSStyleDeclaration._new() e[_y].children = HTMLCollection._new() e[_y].childNodes = NodeList._new() e[_y]._listeners = {}; e[_y].addEventListener = function(type, callback){ if(!(type in this._listeners)) { this._listeners[type] = []; } this._listeners[type].push(callback); if(!(type in window[_y].listeners)) { window[_y].listeners[type] = []; } window[_y].listeners[type].push(callback); } e[_y].removeEventListener = function(type, callback){ if(!(type in this._listeners)) { return; } var stack = this._listeners[type]; for(var i = 0, l = stack.length; i < l; i++) { if(stack[i] === callback){ stack.splice(i, 1); return this.removeEventListener(type, callback); } } } e[_y].dispatchEvent = function(event){ if(!(event.type in this._listeners)) { return true; } var stack = this._listeners[event.type]; event[_y].target = this; for(var i = 0, l = stack.length; i < l; i++) { stack[i].call(this, event); } return true } e[_y].getBoundingClientRect = function(){ var r = DOMRect._new() r.x = 123 r.y = 333 r.width = 100 r.height = 200 return r } _odt(e[_y], 'innerHTML', {set: function(ihtml){ var x = /^ *< *([^> ]+) *[^>]+>(.*)< *\\/ *([^> ]+) *> *$/.exec(ihtml) if (x && (x[1] == x[3]) && x[1]){ var r = document[_y].createElement(x[1]) _odt(r, 'innerHTML', {get: function(){return x[2]}}) e[_y].children[0] = r e[_y].childNodes[0] = r e[_y].firstChild = r } return ihtml }}) } v_hook_getElement(window) v_hook_getElement(document) document[_y].createElement = function(name){ var htmlmap = { HTMLElement: ["abbr", "address", "article", "aside", "b", "bdi", "bdo", "cite", "code", "dd", "dfn", "dt", "em", "figcaption", "figure", "footer", "header", "hgroup", "i", "kbd", "main", "mark", "nav", "noscript", "rp", "rt", "ruby", "s", "samp", "section", "small", "strong", "sub", "summary", "sup", "u", "var", "wbr"], HTMLAnchorElement: ["a"], HTMLImageElement: ["img"], HTMLFontElement: ["font"], HTMLOutputElement: ["output"], HTMLAreaElement: ["area"], HTMLInputElement: ["input"], HTMLFormElement: ["form"], HTMLParagraphElement: ["p"], HTMLAudioElement: ["audio"], HTMLLabelElement: ["label"], HTMLFrameElement: ["frame"], HTMLParamElement: ["param"], HTMLBaseElement: ["base"], HTMLLegendElement: ["legend"], HTMLFrameSetElement: ["frameset"], HTMLPictureElement: ["picture"], HTMLBodyElement: ["body"], HTMLLIElement: ["li"], HTMLHeadingElement: ["h1", "h2", "h3", "h4", "h5", "h6"], HTMLPreElement: ["listing", "pre", "xmp"], HTMLBRElement: ["br"], HTMLLinkElement: ["link"], HTMLHeadElement: ["head"], HTMLProgressElement: ["progress"], HTMLButtonElement: ["button"], HTMLMapElement: ["map"], HTMLHRElement: ["hr"], HTMLQuoteElement: ["blockquote", "q"], HTMLCanvasElement: ["canvas"], HTMLMarqueeElement: ["marquee"], HTMLHtmlElement: ["html"], HTMLScriptElement: ["script"], HTMLDataElement: ["data"], HTMLMediaElement: [], HTMLIFrameElement: ["iframe"], HTMLTimeElement: ["time"], HTMLDataListElement: ["datalist"], HTMLMenuElement: ["menu"], HTMLSelectElement: ["select"], HTMLTitleElement: ["title"], HTMLDetailsElement: ["details"], HTMLMetaElement: ["meta"], HTMLSlotElement: ["slot"], HTMLTableRowElement: ["tr"], HTMLDialogElement: ["dialog"], HTMLMeterElement: ["meter"], HTMLSourceElement: ["source"], HTMLTableSectionElement: ["thead", "tbody", "tfoot"], HTMLDirectoryElement: ["dir"], HTMLModElement: ["del", "ins"], HTMLSpanElement: ["span"], HTMLTemplateElement: ["template"], HTMLDivElement: ["div"], HTMLObjectElement: ["object"], HTMLStyleElement: ["style"], HTMLTextAreaElement: ["textarea"], HTMLDListElement: ["dl"], HTMLOListElement: ["ol"], HTMLTableCaptionElement: ["caption"], HTMLTrackElement: ["track"], HTMLEmbedElement: ["embed"], HTMLOptGroupElement: ["optgroup"], HTMLTableCellElement: ["th", "td"], HTMLUListElement: ["ul"], HTMLFieldSetElement: ["fieldset"], HTMLOptionElement: ["option"], HTMLTableColElement: ["col", "colgroup"], HTMLUnknownElement: [], HTMLTableElement: ["table"], HTMLVideoElement: ["video"] } var _tmp; var ret; var htmlmapkeys = _ojk(htmlmap) name = name.toLocaleLowerCase() for (var i = 0; i < htmlmapkeys.length; i++) { if (htmlmap[htmlmapkeys[i]].indexOf(name) != -1){ _tmp = v_t v_t = false ret = window[htmlmapkeys[i]] v_t = _tmp ret = ret._new() break } } if (!ret){ ret = HTMLUnknownElement._new() } ret[_y].style = CSSStyleDeclaration._new() ret[_y].tagName = name.toUpperCase() ret[_y].appendChild = function(e){ e[_y].contentWindow = window e[_y].contentDocument = HTMLDocument._new() v_hook_getElement(e[_y].contentDocument) e[_y].contentDocument.head = document[_y].createElement('head') e[_y].contentDocument.body = document[_y].createElement('body') e[_y].contentDocument.documentElement = document[_y].createElement('html') e[_y].parentNode = ret e[_y].parentElement = ret } ret[_y].children = HTMLCollection._new() v_hook_getElement(ret) return ret } document[_y].head = document[_y].createElement('head') document[_y].body = document[_y].createElement('body') document[_y].documentElement = document[_y].createElement('html') document[_y].defaultView = window document[_y].scripts = HTMLCollection._new() document[_y].scripts[0] = document.createElement('script') document[_y].scripts[1] = document.createElement('script') document[_y].forms = HTMLCollection._new() document[_y].forms[0] = document.createElement('form') document[_y].forms[1] = document.createElement('form') _odt(document[_y], 'URL', {get(){return location[_y].href}}) Image._init = function(_this){ _this[_y].style = CSSStyleDeclaration._new() _this[_y].tagName = "IMG" _this[_y].children = HTMLCollection._new() _this[_y].appendChild = function(e){ e[_y].contentWindow = window } v_hook_getElement(_this) } window[_y]._timing_idx = 0 // 每次创建一个对象自增约两百,让对象数据更真实一点 Event._init = function(_this){ _this[_y].bubbles = false _this[_y].cancelBubble = false _this[_y].cancelable = false _this[_y].composed = false _this[_y].currentTarget = null _this[_y].defaultPrevented = false _this[_y].eventPhase = 0 _this[_y].isTrusted = false _this[_y].path = [] _this[_y].returnValue = true _this[_y].srcElement = null _this[_y].target = null if (!_this[_y].timeStamp){_odt(_this[_y], 'timeStamp', {value:(++window[_y]._timing_idx)*200 + ((_rd() * 30)^0)})} _this[_y].type = "" } MouseEvent._init = function(_this){ _this[_y].altKey = false _this[_y].bubbles = false _this[_y].button = 0 _this[_y].buttons = 0 _this[_y].cancelBubble = false _this[_y].cancelable = false _this[_y].clientX = 0 _this[_y].clientY = 0 _this[_y].composed = false _this[_y].ctrlKey = false _this[_y].currentTarget = null _this[_y].defaultPrevented = false _this[_y].detail = 0 _this[_y].eventPhase = 0 _this[_y].fromElement = null _this[_y].isTrusted = false _this[_y].layerX = 0 _this[_y].layerY = 0 _this[_y].metaKey = false _this[_y].movementX = 0 _this[_y].movementY = 0 _this[_y].offsetX = 0 _this[_y].offsetY = 0 _this[_y].pageX = 0 _this[_y].pageY = 0 _this[_y].path = [] _this[_y].relatedTarget = null _this[_y].returnValue = true _this[_y].screenX = 0 _this[_y].screenY = 0 _this[_y].shiftKey = false _this[_y].sourceCapabilities = null _this[_y].srcElement = null _this[_y].target = null if (!_this[_y].timeStamp){_odt(_this[_y], 'timeStamp', {value:(++window[_y]._timing_idx)*200 + ((_rd() * 30)^0)})} _this[_y].toElement = null _this[_y].type = "" _this[_y].view = null _this[_y].which = 1 _this[_y].x = 0 _this[_y].y = 0 _this[_y].initMouseEvent = function( type, canBubble, cancelable, view, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget){ if (type !== undefined){ _this[_y].type = type } if (canBubble !== undefined){ _this[_y].canBubble = canBubble } if (cancelable !== undefined){ _this[_y].cancelable = cancelable } if (view !== undefined){ _this[_y].view = view } if (detail !== undefined){ _this[_y].detail = detail } if (screenX !== undefined){ _this[_y].screenX = screenX; _this[_y].movementX = screenX } if (screenY !== undefined){ _this[_y].screenY = screenY; _this[_y].movementY = screenY } if (clientX !== undefined){ _this[_y].clientX = clientX; _this[_y].layerX = clientX; _this[_y].offsetX = clientX; _this[_y].pageX = clientX; _this[_y].x = clientX; } if (clientY !== undefined){ _this[_y].clientY = clientY; _this[_y].layerY = clientY; _this[_y].offsetY = clientY; _this[_y].pageY = clientY; _this[_y].y = clientY; } if (ctrlKey !== undefined){ _this[_y].ctrlKey = ctrlKey } if (altKey !== undefined){ _this[_y].altKey = altKey } if (shiftKey !== undefined){ _this[_y].shiftKey = shiftKey } if (metaKey !== undefined){ _this[_y].metaKey = metaKey } if (button !== undefined){ _this[_y].button = button } if (relatedTarget !== undefined){ _this[_y].relatedTarget = relatedTarget } } } UIEvent._init = function(_this){ _this[_y].bubbles = false _this[_y].cancelBubble = false _this[_y].cancelable = false _this[_y].composed = false _this[_y].currentTarget = null _this[_y].defaultPrevented = false _this[_y].detail = 0 _this[_y].eventPhase = 0 _this[_y].isTrusted = false _this[_y].path = [] _this[_y].returnValue = true _this[_y].sourceCapabilities = null _this[_y].srcElement = null _this[_y].target = null if (!_this[_y].timeStamp){_odt(_this[_y], 'timeStamp', {value:(++window[_y]._timing_idx)*200 + ((_rd() * 30)^0)})} _this[_y].type = "" _this[_y].view = null _this[_y].which = 0 } MutationEvent._init = function(_this){ _this[_y].attrChange = 0 _this[_y].attrName = "" _this[_y].bubbles = false _this[_y].cancelBubble = false _this[_y].cancelable = false _this[_y].composed = false _this[_y].currentTarget = null _this[_y].defaultPrevented = false _this[_y].eventPhase = 0 _this[_y].isTrusted = false _this[_y].newValue = "" _this[_y].path = [] _this[_y].prevValue = "" _this[_y].relatedNode = null _this[_y].returnValue = true _this[_y].srcElement = null _this[_y].target = null if (!_this[_y].timeStamp){_odt(_this[_y], 'timeStamp', {value:(++window[_y]._timing_idx)*200 + ((_rd() * 30)^0)})} _this[_y].type = "" } KeyboardEvent._init = function(_this){ _this[_y].altKey = false _this[_y].bubbles = false _this[_y].cancelBubble = false _this[_y].cancelable = false _this[_y].charCode = 0 _this[_y].code = "" _this[_y].composed = false _this[_y].ctrlKey = false _this[_y].currentTarget = null _this[_y].defaultPrevented = false _this[_y].detail = 0 _this[_y].eventPhase = 0 _this[_y].isComposing = false _this[_y].isTrusted = false _this[_y].key = "" _this[_y].keyCode = 0 _this[_y].location = 0 _this[_y].metaKey = false _this[_y].path = [] _this[_y].repeat = false _this[_y].returnValue = true _this[_y].shiftKey = false _this[_y].sourceCapabilities = null _this[_y].srcElement = null _this[_y].target = null if (!_this[_y].timeStamp){_odt(_this[_y], 'timeStamp', {value:(++window[_y]._timing_idx)*200 + ((_rd() * 30)^0)})} _this[_y].type = "" _this[_y].view = null _this[_y].which = 0 } TextEvent._init = function(_this){ _this[_y].bubbles = false _this[_y].cancelBubble = false _this[_y].cancelable = false _this[_y].composed = false _this[_y].currentTarget = null _this[_y].data = "" _this[_y].defaultPrevented = false _this[_y].detail = 0 _this[_y].eventPhase = 0 _this[_y].isTrusted = false _this[_y].path = [] _this[_y].returnValue = true _this[_y].sourceCapabilities = null _this[_y].srcElement = null _this[_y].target = null if (!_this[_y].timeStamp){_odt(_this[_y], 'timeStamp', {value:(++window[_y]._timing_idx)*200 + ((_rd() * 30)^0)})} _this[_y].type = "" _this[_y].view = null _this[_y].which = 0 } CustomEvent._init = function(_this){ _this[_y].bubbles = false _this[_y].cancelBubble = false _this[_y].cancelable = false _this[_y].composed = false _this[_y].currentTarget = null _this[_y].defaultPrevented = false _this[_y].detail = null _this[_y].eventPhase = 0 _this[_y].isTrusted = false _this[_y].path = [] _this[_y].returnValue = true _this[_y].srcElement = null _this[_y].target = null _this[_y].initCustomEvent = function(){ _this[_y].type = arguments[0]; _this[_y].detail = arguments[3]; } if (!_this[_y].timeStamp){_odt(_this[_y], 'timeStamp', {value:(++window[_y]._timing_idx)*200 + ((_rd() * 30)^0)})} _this[_y].type = "" } MessageEvent._init = function(_this){ _this[_y].bubbles = false _this[_y].cancelBubble = false _this[_y].cancelable = false _this[_y].composed = false _this[_y].currentTarget = null _this[_y].data = null _this[_y].defaultPrevented = false _this[_y].eventPhase = 0 _this[_y].isTrusted = false _this[_y].lastEventId = "" _this[_y].origin = "" _this[_y].path = [] _this[_y].ports = [] _this[_y].returnValue = true _this[_y].source = null _this[_y].srcElement = null _this[_y].target = null if (!_this[_y].timeStamp){_odt(_this[_y], 'timeStamp', {value:(++window[_y]._timing_idx)*200 + ((_rd() * 30)^0)})} _this[_y].type = "" _this[_y].userActivation = null } document[_y].createEvent = function(t){ var r; if (t.toLowerCase() == "htmlevents"){ var r = Event._new() } if (t.toLowerCase() == "uievent"){ var r = UIEvent._new() } if (t.toLowerCase() == "uievents"){ var r = UIEvent._new() } if (t.toLowerCase() == "mouseevent"){ var r = MouseEvent._new() } if (t.toLowerCase() == "mouseevents"){ var r = MouseEvent._new() } if (t.toLowerCase() == "mutationevent"){ var r = MutationEvent._new() } if (t.toLowerCase() == "mutationevents"){ var r = MutationEvent._new() } if (t.toLowerCase() == "textevent"){ var r = TextEvent._new() } if (t.toLowerCase() == "keyboardevent"){ var r = KeyboardEvent._new() } if (t.toLowerCase() == "customevent"){ var r = CustomEvent._new() } if (t.toLowerCase() == "event"){ var r = Event._new() } if (t.toLowerCase() == "events"){ var r = Event._new() } if (t.toLowerCase() == "svgevents"){ var r = Event._new() } return r; } CanvasRenderingContext2D._init = function(_this){ _this[_y].toDataURL = function(){ // canvas2d 图像指纹 return "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAACWCAYAAABkW7XSAAAEYklEQVR4Xu3UAQkAAAwCwdm/9HI83BLIOdw5AgQIRAQWySkmAQIEzmB5AgIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlACBB1YxAJfjJb2jAAAAAElFTkSuQmCC" } } WebGLRenderingContext._init = function(_this){ _this[_y]._toggle = {} _this[_y].createBuffer = function(){ return WebGLBuffer._new() } _this[_y].createProgram = function(){ return WebGLProgram._new() } _this[_y].createShader = function(){ return WebGLShader._new() } _this[_y].getSupportedExtensions = function(){ return [ "ANGLE_instanced_arrays", "EXT_blend_minmax", "EXT_color_buffer_half_float", "EXT_disjoint_timer_query", "EXT_float_blend", "EXT_frag_depth", "EXT_shader_texture_lod", "EXT_texture_compression_bptc", "EXT_texture_compression_rgtc", "EXT_texture_filter_anisotropic", "WEBKIT_EXT_texture_filter_anisotropic", "EXT_sRGB", "KHR_parallel_shader_compile", "OES_element_index_uint", "OES_fbo_render_mipmap", "OES_standard_derivatives", "OES_texture_float", "OES_texture_float_linear", "OES_texture_half_float", "OES_texture_half_float_linear", "OES_vertex_array_object", "WEBGL_color_buffer_float", "WEBGL_compressed_texture_s3tc", "WEBKIT_WEBGL_compressed_texture_s3tc", "WEBGL_compressed_texture_s3tc_srgb", "WEBGL_debug_renderer_info", "WEBGL_debug_shaders", "WEBGL_depth_texture","WEBKIT_WEBGL_depth_texture","WEBGL_draw_buffers","WEBGL_lose_context","WEBKIT_WEBGL_lose_context","WEBGL_multi_draw", ] } _this[_y].getExtension = function(key){ class WebGLDebugRendererInfo{ get UNMASKED_VENDOR_WEBGL(){_bl(' >>> get UNMASKED_VENDOR_WEBGL 37445');_this[_y]._toggle[37445]=1;return 37445} get UNMASKED_RENDERER_WEBGL(){_bl(' >>> get UNMASKED_RENDERER_WEBGL 37446');_this[_y]._toggle[37446]=1;return 37446} } saf_class(WebGLDebugRendererInfo) class EXTTextureFilterAnisotropic{} class WebGLLoseContext{ loseContext(){_bl(' (*) loseContext ===> return undefined')} restoreContext(){_bl(' (*) restoreContext ===> return undefined')} } saf_class(WebGLLoseContext) // 这里补着有点累,就随便了 if (key == 'WEBGL_debug_renderer_info'){ var r = new WebGLDebugRendererInfo } else if (key == 'EXT_texture_filter_anisotropic'){ var r = new EXTTextureFilterAnisotropic } else if (key == 'WEBGL_lose_context'){ var r = new WebGLLoseContext }else{ var r = new WebGLDebugRendererInfo } return hook_obj(r) } _this[_y].getParameter = function(key){ if (_this[_y]._toggle[key]){ if (key == 37445){ return "Google Inc. (NVIDIA)" } if (key == 37446){ return "ANGLE (NVIDIA, NVIDIA GeForce GTX 1050 Ti Direct3D11 vs_5_0 ps_5_0, D3D11-27.21.14.5671)" } }else{ if (key == 33902){ return new Float32Array([1,1]) } if (key == 33901){ return new Float32Array([1,1024]) } if (key == 35661){ return 32 } if (key == 34047){ return 16 } if (key == 34076){ return 16384 } if (key == 36349){ return 1024 } if (key == 34024){ return 16384 } if (key == 34930){ return 16 } if (key == 3379){ return 16384 } if (key == 36348){ return 30 } if (key == 34921){ return 16 } if (key == 35660){ return 16 } if (key == 36347){ return 4095 } if (key == 3386){ return new Int32Array([32767, 32767]) } if (key == 3410){ return 8 } if (key == 7937){ return "WebKit WebGL" } if (key == 35724){ return "WebGL GLSL ES 1.0 (OpenGL ES GLSL ES 1.0 Chromium)" } if (key == 3415){ return 0 } if (key == 7936){ return "WebKit" } if (key == 7938){ return "WebGL 1.0 (OpenGL ES 2.0 Chromium)" } if (key == 3411){ return 8 } if (key == 3412){ return 8 } if (key == 3413){ return 8 } if (key == 3414){ return 24 } return null } } _this[_y].getContextAttributes = function(){ return { alpha: true, antialias: true, depth: true, desynchronized: false, failIfMajorPerformanceCaveat: false, powerPreference: "default", premultipliedAlpha: true, preserveDrawingBuffer: false, stencil: false, xrCompatible: false, } } _this[_y].getShaderPrecisionFormat = function(a,b){ var r1 = WebGLShaderPrecisionFormat._new() r1[_y].rangeMin = 127 r1[_y].rangeMax = 127 r1[_y].precision = 23 var r2 = WebGLShaderPrecisionFormat._new() r2[_y].rangeMin = 31 r2[_y].rangeMax = 30 r2[_y].precision = 0 if (a == 35633 && b == 36338){ return r1 } if (a == 35633 && b == 36337){ return r1 } if (a == 35633 && b == 36336){ return r1 } if (a == 35633 && b == 36341){ return r2 } if (a == 35633 && b == 36340){ return r2 } if (a == 35633 && b == 36339){ return r2 } if (a == 35632 && b == 36338){ return r1 } if (a == 35632 && b == 36337){ return r1 } if (a == 35632 && b == 36336){ return r1 } if (a == 35632 && b == 36341){ return r2 } if (a == 35632 && b == 36340){ return r2 } if (a == 35632 && b == 36339){ return r2 } throw Error('getShaderPrecisionFormat') } } HTMLCanvasElement._init = function(_this){ _this[_y].getContext = function(name){ if (name == '2d'){ return CanvasRenderingContext2D._new() } if (name == 'webgl'){ var r = WebGLRenderingContext._new() r[_y].canvas = _this r[_y].canvas[_y].toDataURL = function(){ // webgl图像指纹 return "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAACWCAYAAABkW7XSAAAEYklEQVR4Xu3UAQkAAAwCwdm/9HI83BLIOdw5AgQIRAQWySkmAQIEzmB5AgIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlACBB1YxAJfjJb2jAAAAAElFTkSuQmCC" } return r } } _this[_y].toDataURL = function(){ // 默认的空画板的图片 return "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAACWCAYAAABkW7XSAAAEYklEQVR4Xu3UAQkAAAwCwdm/9HI83BLIOdw5AgQIRAQWySkmAQIEzmB5AgIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlACBB1YxAJfjJb2jAAAAAElFTkSuQmCC" } } var _mk_AudioParam = function(a,b,c,d,e){ var r = AudioParam._new() r[_y].value = a r[_y].defaultValue = b r[_y].minValue = c r[_y].maxValue = d r[_y].automationRate = e return r } GainNode._init = function(_this){ _this[_y].gain = _mk_AudioParam(1, 1, -3.4028234663852886e+38, 3.4028234663852886e+38, "a-rate") } BaseAudioContext._init = function(_this){ _this[_y].createAnalyser = function(){ return AnalyserNode._new() } _this[_y].createGain = function(){ return GainNode._new() } _this[_y].createScriptProcessor = function(){ return ScriptProcessorNode._new() } _this[_y].createOscillator = function(){ var r = OscillatorNode._new() r[_y].type = 'sine' r[_y].frequency = _mk_AudioParam(0, 0, -153600, 153600, "a-rate") r[_y].detune = _mk_AudioParam(440, 440, -22050, 22050, "a-rate") return r } _this[_y].createDynamicsCompressor = function(){ var r = DynamicsCompressorNode._new() r[_y].threshold = _mk_AudioParam(-24, -24, -100, 0, "k-rate") r[_y].knee = _mk_AudioParam(30, 30, 0, 40, "k-rate") r[_y].ratio = _mk_AudioParam(12, 12, 1, 20, "k-rate") r[_y].attack = _mk_AudioParam(0.003000000026077032, 0.003000000026077032, 0, 1, "k-rate") r[_y].release = _mk_AudioParam(0.25, 0.25, 0, 1, "k-rate") return r } } // destination = AudioDestinationNode._new() // 声音指纹这里初始化时候 destination 是一个对象,后面需要考虑怎么兼容进去 // 虽然在脚手架前面设置了 location.href 无法被修改,但是内部 get 中的真实值 location[_y].href 这里可以随意设置,并且能达到相同的效果 function v_hook_href(obj){ return _odt(obj, 'href', { get: function(){ return this.protocol + "//" + this.host + (this.port ? ":" + this.port : "") + this.pathname + this.search + this.hash; }, set: function(href){ href = href.trim() if (href.startsWith("http://") || href.startsWith("https://")){/*ok*/} else if(href.startsWith("//")){ href = (this.protocol?this.protocol:'http:') + href} else{ href = this.protocol+"//"+this.host + (this.port?":"+this.port:"") + '/' + ((href[0]=='/')?href.slice(1):href) } var a = href.match(/([^:]+:)\\/\\/([^/:?#]+):?(\\d+)?([^?#]*)?(\\?[^#]*)?(#.*)?/); this.protocol = a[1] ? a[1] : ""; this.host = a[2] ? a[2] : ""; this.port = a[3] ? a[3] : ""; this.pathname = a[4] ? a[4] : ""; this.search = a[5] ? a[5] : ""; this.hash = a[6] ? a[6] : ""; this.hostname = this.host; this.origin = this.protocol + "//" + this.host + (this.port ? ":" + this.port : ""); } }); } v_hook_href(window[_y].location[_y]) HTMLAnchorElement._init = function(_this){ v_hook_href(_this[_y]) _this[_y].href = location[_y].href _this[_y].namespaceURI = "http://www.w3.org/1999/xhtml" } ;(function(){ 'use strict'; var cache = document[_y].cookie = ""; _odt(document[_y], 'cookie', { get: function() { return cache.slice(0,cache.length-2); }, set: function(c) { var ncookie = c.split(";")[0].split("="); if (!ncookie[1]){ return c } var key = ncookie[0].trim() var val = ncookie[1].trim() var newc = key+'='+val var flag = false; var temp = cache.split("; ").map(function(a) { if (a.split("=")[0] === key) { flag = true; return newc; } return a; }) cache = temp.join("; "); if (!flag) { cache += newc + "; "; } return cache; } }); window[_y].init_cookie = function(e){ e.split(';').map(function(e){ document[_y].cookie = e }) } })(); // 个人使用的变量,用于请求收集对象,通常请求会伴随着响应,需要对实例的 onreadystatechange 函数进行处理 // 你要拿到对象才能获取对应请求的处理函数 window[_y].XMLHttpRequestList = [] window[_y].XMLHttpRequestListSend = [] XMLHttpRequest._init = function(_this){ _this[_y].upload = XMLHttpRequestUpload._new() _this[_y].open = function(){ console.log('------------ XMLHttpRequest open ------------') window[_y].XMLHttpRequestListSend.push([].slice.call(arguments, 0)) } _this[_y].setRequestHeader = function(){ console.log('------------ XMLHttpRequest open ------------') window[_y].XMLHttpRequestListSend.push([].slice.call(arguments, 0)) } _this[_y].send = function(){ console.log('------------ XMLHttpRequest send ------------') window[_y].XMLHttpRequestListSend.push([].slice.call(arguments, 0)) } window[_y].XMLHttpRequestList.push(_this) } window[_y].fetchList = [] window[_y].fetch = function(){ window[_y].fetchList.push([].slice.call(arguments, 0)) } window[_y].v_getele = function(){} window[_y].v_geteles = function(){} window[_y].v_mouse = function(x, y, type){ type = type?type:'click' // 简便的的构造鼠标事件方法 // click,mousedown,mouseup,mouseover,mousemove,mouseout // 函数参数 // type, // canBubble, // cancelable, // view, // detail, // screenX, // screenY, // clientX, // clientY, // ctrlKey, // altKey, // shiftKey, // metaKey, // button, // 0左键,1中键,2右键 // relatedTarget var r = document[_y].createEvent('MouseEvent') r[_y].initMouseEvent(type, true, true, window, 0, 0, 0, x, y, false, false, false, false, 0, null); return r } // 挂钩这三个函数,屏蔽掉 Symbol.for('cilame') 这个参数 var _getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors Object.getOwnPropertyDescriptors = saf(function getOwnPropertyDescriptors(){ try{ var r = _getOwnPropertyDescriptors.apply(this, arguments) delete r[_y] if (v_t){_m('Object','[getOwnPropertyDescriptors]',util.inspect(arguments[0]).split('\\n')[0],'<==>',r)}; return r }catch(e){ if (v_t){_m('Object','[getOwnPropertyDescriptors]',util.inspect(arguments[0]).split('\\n')[0],'<==>','[ ERROR ]')}; throw Error() } }) var _getOwnPropertySymbols = Object.getOwnPropertySymbols Object.getOwnPropertySymbols = saf(function getOwnPropertySymbols(){ try{ var r = _getOwnPropertySymbols.apply(this, arguments) r = r.filter(function(e){ return e !== _y }) if (v_t){_m('Object','[getOwnPropertySymbols]',util.inspect(arguments[0]).split('\\n')[0],'<==>',r)}; return r }catch(e){ if (v_t){_m('Object','[getOwnPropertySymbols]',util.inspect(arguments[0]).split('\\n')[0],'<==>','[ ERROR ]')}; throw Error() } }) var _ownKeys = Reflect.ownKeys Reflect.ownKeys = saf(function ownKeys(){ try{ var r = _ownKeys.apply(this, arguments) r = r.filter(function(e){ return e !== _y }) if (v_t){_m('Reflect','[ownKeys]',util.inspect(arguments[0]),'<==>',r)}; return r }catch(e){ if (v_t){_m('Reflect','[ownKeys]',util.inspect(arguments[0]),'<==>','[ ERROR ]')}; throw Error() } }) document[_y].visibilityState = 'visible' document[_y].body[_y].clientTop = 0 document[_y].body[_y].clientLeft = 0 document[_y].body[_y].clientHeight = 2416 document[_y].body[_y].clientWidth = 1707 document[_y].body[_y].scrollTop = 0 document[_y].body[_y].scrollLeft = 0 document[_y].documentElement[_y].clientHeight = 1273 document[_y].documentElement[_y].clientWidth = 2543 // 通过一个函数挂钩所有以下的内置函数,通过修改 window[_y].v_getele 函数做对应代码的定制处理 // getElementById // querySelector window[_y].v_getlist = [] window[_y].v_getele = function(a,b,c,d,e){ a = a.toLowerCase() // 定制处理 for (var i = 0; i < window[_y].v_getlist.length; i++) { var t = window[_y].v_getlist[i] if (t[0] == a){ return t[1](a) } } // 常用 _bl(' (x) unhandle id:', a) } // 这里是对下面几个函数进行的挂钩处理 // getElementsByClassName // getElementsByName // getElementsByTagName // getElementsByTagNameNS // querySelectorAll window[_y].v_getlists = [] window[_y].v_geteles = function(a,b,c,d,e){ a = a.toLowerCase() for (var i = 0; i < window[_y].v_getlists.length; i++) { var t = window[_y].v_getlists[i] if (t[0] == a){ return t[1](a) } } // 通用 if (a == 'script'){ return document[_y].scripts } if (a == 'head'){ var r = document[_y].head return [r] } if (a == 'body'){ var r = document[_y].body return [r] } _bl(' (x) unhandle[s] id:', a) return [] } location.href = 'http://pls_init_href_first/test1/test2' window[_y].v_load = function(){ if (window[_y].listeners.DOMContentLoaded){ _bl('---------- DOMContentLoaded ----------') for (var i = 0; i < window[_y].listeners.DOMContentLoaded.length; i++) { window[_y].listeners.DOMContentLoaded[i]() } } if (window[_y].listeners.load){ _bl('---------- load ----------') for (var i = 0; i < window[_y].listeners.load.length; i++) { window[_y].listeners.load[i]() } } } window[_y].v_blocktime = function(t){ if (typeof t == 'undefined'){ throw Error('pls input a timestamp in first args.') } var ftime = t window.Date = function(_Date) { var bind = Function.bind; var unbind = bind.bind(bind); function instantiate(constructor, args) { return new (unbind(constructor, null).apply(null, args)); } var names = Object.getOwnPropertyNames(_Date); for (var i = 0; i < names.length; i++) { if (names[i]in Date) continue; var desc = Object.getOwnPropertyDescriptor(_Date, names[i]); _odt(Date, names[i], desc); } return saf(Date); function Date() { var date = instantiate(_Date, [ftime]); // 固定返回某一个时间点 return date; } }(Date); Date.now = saf(function now(){ return ftime }) _ti = ftime } window[_y].v_blockrandom = function(r){ if (typeof r == 'undefined'){ throw Error('pls input a number (0~1) in first args.') } Math.random = saf(function random(){ return r }) } return window ` var v_tail = ` var _y = Symbol.for('cilame') global.v_t = false var _bl = console.log window = cilame(this) // 注入全局,方便后面搞成库直接用 require 就能拿到内容。 window.v_getlist = window[_y].v_getlist window.v_getlists = window[_y].v_getlists window.v_requests = { 'xmllist': window[_y].XMLHttpRequestList, 'xmlsend': window[_y].XMLHttpRequestListSend, 'fetcher': window[_y].fetchList, } window.v_listeners = window[_y].listeners window.v_load = window[_y].v_load window.v_mouse = window[_y].v_mouse window.v_blocktime = window[_y].v_blocktime window.v_blockrandom = window[_y].v_blockrandom location.href = 'http://pls_init_href_first/test1/test2' // document[_y].referrer = 'http://newhref' // window[_y].init_cookie('key=value; key2=value2') v_t = true // 打开日志开关 debugger ` v_ret = v_str_saf + v_mk_head_WindowProperties() + '\n' + v_global_init(v_global_s) + '\n' + v_ret v_ret = ` function cilame(v_this){ ${v_ret.trim().split('\n').map(function(e){return ' '+e}).join('\n')} } ` v_ret = v_ret + v_tail // console.log(v_ret) copy(v_ret) }