forked from duckzhao/myspider
-
Notifications
You must be signed in to change notification settings - Fork 0
/
浏览器环境_node用.js
129 lines (110 loc) · 3.18 KB
/
浏览器环境_node用.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
function randomString(len) {
len = len || 32;
var $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';
/****默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1****/
var maxPos = $chars.length;
var pwd = '';
for (i = 0; i < len; i++) {
pwd += $chars.charAt(Math.floor(Math.random() * maxPos));
}
return pwd;
}
window.parseFloat = parseFloat;
window.parseInt = parseInt;
window.isNaN = isNaN;
window.decodeURI = decodeURI;
window.decodeURIComponent = decodeURIComponent;
window.encodeURI = encodeURI;
window.encodeURIComponent = encodeURIComponent;
window.escape = escape;
window.unescape = unescape;
window.eval = eval;
window.Date = Date;
document = new Object();
document.createElement = function(name) {
return "<" + name + ">" + "</" + name + ">"
};
document.createElement.toString = function() {
return "function createElement() { [native code] }"
};
window.document = document;
var navigator = new Object();
navigator.appCodeName = "Mozilla";
navigator.appName = "Netscape";
navigator.appVersion = "5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36";
navigator.cookieEnabled = true;
navigator.connection = {
'connection': null,
'effectiveType': "4g",
'rtt': 50,
'downlink': 10,
'saveData': false
};
navigator.deviceMemory = 8;
navigator.hardwareConcurrency;
navigator.doNotTrack = null;
navigator.language = "zh-CN";
navigator.languages = ["zh-CN", "zh"];
navigator.onLine = true;
navigator.platform = 'Win32';
navigator.product = 'Gecko';
navigator.productSub = '20030107';
navigator.userAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36";
navigator.vendor = "Google Inc.";
navigator.vendorSub = "";
plugins = [{
'description': "APlayer III ActiveX hosting plugin for Firefox",
'filename': "npaplayer.dll",
'length': 1,
'name': "APlayer ActiveX hosting plugin"
}, {
'description': "ASUS Update",
'filename': "npAsusUpdate3.dll",
'length': 1,
'name': "ASUS Update"
}];
any_plugins = true;
if (any_plugins) {
for (var i = 0; i < 10; i++) {
var p = {
'description': randomString(parseInt(Math.random() * 20)),
'filename': randomString(parseInt(Math.random() * 20)) + ".dll",
'length': 1,
'name': randomString(parseInt(Math.random() * 10))
};
plugins.push(p)
}
}
navigator.plugins = plugins;
window.navigator = navigator;
location = new Object();
location.port = "";
location.protocol = "http:";
window.location = location;
history = new Object();
history.length = 5;
history.scrollRestoration = "auto";
history.state = null;
window.history = history;
screen = new Object();
screen.availHeight = 1040;
screen.availLeft = 2560;
screen.availTop = 0;
screen.availWidth = 1920;
screen.colorDepth = 24;
screen.height = 1080;
screen.pixelDepth = 24;
screen.width = 1920;
screen.orientation = {
angle: 0,
onchange: null,
type: "landscape-primary"
};
window.getComputedStyle = function() {
debugger
};
window.screen = screen;
window.parent = window;
window.top = window;
window.self = window;
window.window = window;