Created
June 26, 2020 22:39
-
-
Save prescience-data/b43a6789d68fa3de2006f441f79977b8 to your computer and use it in GitHub Desktop.
Revisions
-
prescience-data created this gist
Jun 26, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,267 @@ /** namespace App\Actors **/ const Actor = require('./Actor'); class BotcheckActor extends Actor { platform = 'botcheck'; constructor(env) { const config = require('../../config/actors/botcheck'); super(config, env); } // ================ Actions ================ async start() { return new Promise(async (resolve, reject) => { try { if (!this.ready) { await this.init(); } const source = 'BotCheck'; this.plugins.logger.start(source); const profileId = this.identity.guid; if (this.env === 'production') { this.log('Using Multilogin (' + profileId + ')'); } else { this.log('Using Chrome'); } await this.botcheck(); await this.delay(2000); await this.recaptcha(); await this.delay(2000); await this.hellobot(); await this.delay(2000); await this.areyouheadless(); await this.delay(2000); await this.fingerprintjs(); await this.delay(2000); await this.datadome(); await this.delay(2000); await this.distill(); this.plugins.logger.end(source); resolve(); } catch (err) { reject(err); } }); } async botcheck() { return new Promise(async (resolve, reject) => { try { const source = 'BotCheck'; const url = ''; this.log('Loading page: ' + url); await this.goto(url); await this.delay(1000, 1500); await this.page.evaluate(() => { }); await this.delay(2000, 3000); const element = await this.page.$('#result'); let output = await (await element.getProperty('textContent')).jsonValue(); this.log(output, source); resolve(output); } catch (err) { reject(err); } }); } async recaptcha() { return new Promise(async (resolve, reject) => { try { const source = 'Recaptcha3'; const url = 'https://antcpt.com/eng/information/demo-form/recaptcha-3-test-score.html'; this.log('Loading page: ' + url); await this.goto(url); await this.delay(20000, 22000); const element = await this.page.$('#score'); let output = await this.page.evaluate(element => element.textContent, element); //let output = await (await element.getProperty('textContent')).jsonValue(); this.log(output, source); resolve(output); } catch (err) { reject(err); } }); } async distill() { return new Promise(async (resolve, reject) => { try { const source = 'Distill'; const url = 'http://promos.rtm.com'; this.log('Loading page: ' + url); await this.goto(url); await this.delay(2000, 3000); let element; try { element = await this.page.$('h1'); } catch (err) { this.page = await this.browser.newPage(); element = null; } let output = element ? 'Failed' : 'Passed'; this.log(output, source); resolve(output); } catch (err) { reject(err); } }); } async datadome() { return new Promise(async (resolve, reject) => { try { const source = 'Datadome'; const url = 'https://datadome.co'; this.log('Loading page: ' + url); await this.goto(url); await this.delay(2000, 3000); await this.panMouse(); await this.delay(500, 900); const button = await this.page.$('#menu-item-18474'); if (button) { await this.panToElement(button); await button.click({ delay: 8 }); await this.page.waitForNavigation({ waitUntil: 'networkidle2' }); await this.delay(200, 500); } else { this.log('Could not find the button!'); } let captcha = await this.page.$('iframe[src^="https://geo.captcha-delivery.com/captcha/"]'); let output = captcha ? 'Failed' : 'Passed'; this.log(output, source); resolve(output); } catch (err) { reject(err); } }); } async hellobot() { return new Promise(async (resolve, reject) => { try { const source = 'HelloBot'; const url = 'http://anonymity.space/hellobot.php'; this.log('Loading page: ' + url); await this.goto(url); await this.delay(2000, 3000); await this.page.waitForSelector('#result'); const element = await this.page.$('#result'); let output = await (await element.getProperty('textContent')).jsonValue(); this.log(output, source); resolve(output); } catch (err) { reject(err); } }); } async areyouheadless() { return new Promise(async (resolve, reject) => { try { const source = 'AreYouHeadless'; const url = 'https://arh.antoinevastel.com/bots/areyouheadless'; this.log('Loading page: ' + url); await this.goto(url); await this.delay(1000, 2000); await this.page.waitForSelector('#res'); const element = await this.page.$('#res'); let output = await (await element.getProperty('textContent')).jsonValue(); this.log(output, source); resolve(output); } catch (err) { reject(err); } }); } async fingerprintjs() { return new Promise(async (resolve, reject) => { try { const source = 'FingerprintJs'; const url = 'https://fingerprintjs.com/demo'; this.log('Loading page: ' + url); await this.goto(url); await this.delay(5000, 7000); await this.page.waitForSelector('table.table-compact'); const element = await this.page.$('table.table-compact > tbody > tr:nth-child(4) > td.miriam'); let text = await (await element.getProperty('textContent')).jsonValue(); let output = (text === 'NO') ? 'Passed' : 'Failed'; this.log(output, source); resolve(output); } catch (err) { reject(err); } }); } async blank() { return new Promise(async (resolve, reject) => { try { } catch (err) { reject(err); } }); } } module.exports = BotcheckActor;