antibotbrowser 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +48 -20
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -2,6 +2,7 @@ const chromium = require('chromium');
|
|
|
2
2
|
const {execFile} = require('child_process');
|
|
3
3
|
var request = require('sync-request');
|
|
4
4
|
const fs = require('fs');
|
|
5
|
+
const { start } = require('repl');
|
|
5
6
|
|
|
6
7
|
// github.com/reloxe
|
|
7
8
|
// nokersoft.com
|
|
@@ -17,35 +18,62 @@ async function versioncehck() {
|
|
|
17
18
|
|
|
18
19
|
const delay = ms => new Promise(resolve => setTimeout(resolve, ms))
|
|
19
20
|
|
|
20
|
-
async function
|
|
21
|
-
|
|
21
|
+
async function startbrowser_hide(port) {
|
|
22
|
+
return new Promise(async(resolve, reject) => {
|
|
23
|
+
|
|
24
|
+
try {
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (typeof port !== "number") {
|
|
28
|
-
port = 9222;
|
|
29
|
-
}
|
|
26
|
+
console.log(port);
|
|
27
|
+
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
execFile(chromium.path, ['--remote-debugging-port=' + port, '--headless', '--no-sandbox'], (err) => {
|
|
30
|
+
if (err) { }
|
|
33
31
|
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
await delay(4000);
|
|
33
|
+
var res = await request('GET', `http://127.0.0.1:${port}/json/version`);
|
|
34
|
+
veri = await JSON.parse(res.getBody())
|
|
35
|
+
useragent = await veri["User-Agent"];
|
|
36
|
+
websokcet = await veri["webSocketDebuggerUrl"];
|
|
37
|
+
console.log(websokcet);
|
|
38
|
+
|
|
39
|
+
resolve( { useragent, websokcet } )
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
} catch (error) {
|
|
42
|
+
startbrowser_hide(port);
|
|
43
|
+
}
|
|
41
44
|
|
|
42
|
-
}
|
|
43
|
-
return error;
|
|
45
|
+
})
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
|
|
47
|
-
|
|
49
|
+
async function startbrowser(port) {
|
|
50
|
+
return new Promise(async(resolve, reject) => {
|
|
51
|
+
|
|
52
|
+
try {
|
|
53
|
+
|
|
54
|
+
console.log(port);
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
execFile(chromium.path, ['--remote-debugging-port=' + port], (err) => {
|
|
58
|
+
if (err) { }
|
|
59
|
+
});
|
|
60
|
+
await delay(4000);
|
|
61
|
+
var res = await request('GET', `http://127.0.0.1:${port}/json/version`);
|
|
62
|
+
veri = await JSON.parse(res.getBody())
|
|
63
|
+
useragent = await veri["User-Agent"];
|
|
64
|
+
websokcet = await veri["webSocketDebuggerUrl"];
|
|
65
|
+
console.log(websokcet);
|
|
66
|
+
|
|
67
|
+
resolve( { useragent, websokcet } )
|
|
68
|
+
|
|
69
|
+
} catch (error) {
|
|
70
|
+
startbrowser(port);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
})
|
|
74
|
+
}
|
|
48
75
|
|
|
49
76
|
module.exports = {
|
|
77
|
+
startbrowser_hide,
|
|
50
78
|
startbrowser
|
|
51
79
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "antibotbrowser",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"readme": "README.md",
|
|
5
5
|
"description": "Opening Chromium opens a real browser without bot validations in automated systems like Puppetter. To avoid problems in places like Cloudflare",
|
|
6
6
|
"main": "index.js",
|