Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/aimogen-pro/res/puppeteer/torcheck.js
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
"use strict";
2
+
const puppeteer = require('puppeteer');
3
+
(async () => {
4
+
var args = process.argv.slice(2);
5
+
process.on('unhandledRejection', up => { throw up })
6
+
var argarr = ['--no-sandbox', '--disable-setuid-sandbox'];
7
+
if(args[2] != 'default')
8
+
{
9
+
argarr.push("--user-agent=" + args[2]);
10
+
}
11
+
argarr.push("--proxy-server=socks5://127.0.0.1:9050");
12
+
const browser = await puppeteer.launch({ignoreHTTPSErrors:true, args: argarr});
13
+
14
+
if(args[5] != '1')
15
+
{
16
+
//check if tor ok
17
+
const page2 = (await browser.pages())[0];
18
+
if(args[5] != 'default')
19
+
{
20
+
await page2.setDefaultNavigationTimeout(args[5]);
21
+
}
22
+
await page2.goto('https://check.torproject.org/');
23
+
const isUsingTor = await page2.$eval('body', el =>
24
+
el.innerHTML.includes('Congratulations. This browser is configured to use Tor')
25
+
);
26
+
if (!isUsingTor) {
27
+
console.log('CRAWLOMATIC NOT USING TOR!');
28
+
await browser.close()
29
+
return;
30
+
}
31
+
}
32
+
console.log('TOR OK!');
33
+
await browser.close();
34
+
})();