Skip to content

Commit

Permalink
Updated DataDome bypass
Browse files Browse the repository at this point in the history
  • Loading branch information
billgates007 committed Feb 16, 2022
1 parent 2f907f9 commit 36fd8e1
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 175 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ __Requirements:__

__List of solutions:__
- [Bypass](https://github.com/MoterHaker/bypass-captcha-examples/blob/main/cloudflare.js) CloudFlare with hCaptcha using Anti-Captcha browser plugin.
- [Bypass](https://github.com/MoterHaker/bypass-captcha-examples/blob/main/geo.captcha.delivery.com.js) geo.captcha-delivery.com protection by Data Dome using Anti-Captcha browser plugin.
- [Bypass](https://github.com/MoterHaker/bypass-captcha-examples/blob/main/geo.captcha.delivery.com.js) geo.captcha-delivery.com protection by Data Dome using [AntiGate template](https://anti-captcha.com/apidoc/task-types/AntiGateTask) "Anti-bot screen bypass".
- [Bypass](https://github.com/MoterHaker/bypass-captcha-examples/blob/main/store.steam-powered.com.js) store.steam-powered.com/join Recaptcha Enterprise V2.
- [Bypass](https://github.com/MoterHaker/bypass-captcha-examples/blob/main/netflix.js) netflix.com Enterprise Recaptcha V3 at [sign-in](https://www.netflix.com/login) page.
- [Bypass](https://github.com/MoterHaker/bypass-captcha-examples/blob/main/adobe.js) adobe.com Enterprise Recaptcha V3 at [sign-in](https://auth.services.adobe.com/en_US/index.html) page.
- [Bypass](https://github.com/MoterHaker/bypass-captcha-examples/blob/main/roblox.js) roblox.com Arcoselabs Funcaptcha at [sign-in](https://www.roblox.com/newlogin) page.
- [Bypass](https://github.com/MoterHaker/bypass-captcha-examples/blob/main/olx.ua.js) ulx.ua Recaptcha V3 at [registration](https://www.olx.ua/account/#register) page.
- [Bypass](https://github.com/MoterHaker/bypass-captcha-examples/blob/main/perimeterx.js) Wallmart's PerimeterX screen using an AntiGate template.
- [Register](https://github.com/MoterHaker/bypass-captcha-examples/blob/main/discord.js) an account at Discord.com.
- [Register](https://github.com/MoterHaker/bypass-captcha-examples/blob/main/discord.js) an account at Discord.com using [AntiGate template](https://anti-captcha.com/apidoc/task-types/AntiGateTask) "discord registration".


__Requests__
Expand Down
211 changes: 38 additions & 173 deletions geo.captcha-delivery.com.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,19 @@
/*
Datadome bypass with Anti-Captcha plugin.
Datadome bypass with AntiGate template.
Install dependencies:
npm install adm-zip puppeteer-extra puppeteer-extra-plugin-stealth puppeteer
npm install @antiadmin/anticaptchaofficial axios
Run in head-on mode:
node geo.captcha-delivery.js
Run in headless mode:
xvfb-run node geo.captcha-delivery.js
To install xvfb run:
apt update
apt install -y xvfb
* */

const https = require('https');
const fs = require('fs');
const AdmZip = require("adm-zip");
const pup = require('puppeteer-extra')
const StealthPlugin = require('puppeteer-extra-plugin-stealth')
pup.use(StealthPlugin())
const axios = require("axios");

//address with datadome protection
const url = 'https://geo.captcha-delivery.com/captcha/?initialCid=AHrlqAAAAAMAyjC27s4nCV0AlQMdRA%3D%3D&hash=2211F522B61E269B869FA6EAFFB5E1&cid=P2gtFfd.snGFcRsDO5ZpQTId4q1Bh0HJTQ0npTA_6Eq-SDNCUf7i7d-hx2O-8tsMooDrDyQ8Pp-Cyx-kIkY%7EH7PGsoHZwzi9xtc6-BRNO.&t=fe&referer=https%3A%2F%2Fwww.hermes.com%2Ffr%2Ffr%2Fproduct%2Fvanille-galante-eau-de-toilette-and-vanille-galante-fourreau-cuir-V2HERMESSENCEVANILLEGALANTEpV24465pV24464%2F&s=13461';
const anticaptcha = require("@antiadmin/anticaptchaofficial");

//control address behind datadome
const checkUrl = 'https://www.hermes.com/fr/fr/product/vanille-galante-eau-de-toilette-and-vanille-galante-fourreau-cuir';
//address behind datadome
const checkUrl = 'https://www.hermes.com/fr/fr/product/sculpture-casse-tete-samarcande-H311115Mv01/';

//Anti-captcha.com API key
const apiKey = 'API_KEY_HERE';
Expand All @@ -40,173 +25,53 @@ let page = null;

(async () => {

if (apiKey.length !== 32) {
console.error('Invalid API key');
return;
}

try {
await testPlugin();
} catch (e) {
failCallback('Could not download plugin: '+e.toString());
anticaptcha.setAPIKey(apiKey);
const balance = await anticaptcha.getBalance();
if (balance <= 0) {
console.log('Topup your anti-captcha.com balance!');
return;
}

//configuring API key
if (fs.existsSync('./plugin/js/config_ac_api_key.js')) {
let confData = fs.readFileSync('./plugin/js/config_ac_api_key.js', 'utf8');
confData = confData.replace(/antiCapthaPredefinedApiKey = ''/g, `antiCapthaPredefinedApiKey = '${apiKey}'`);
fs.writeFileSync('./plugin/js/config_ac_api_key.js', confData, 'utf8');
} else {
failCallback('plugin configuration file not found');
return;
console.log('API key balance is '+balance+', continuing');
// anticaptcha.shutUp(); //uncomment for silent captcha recognition
}

try {
console.log('opening browser ..');


let options = {
headless: false,
ignoreDefaultArgs: ["--disable-extensions","--enable-automation"],
args: [
'--disable-web-security',
'--disable-features=IsolateOrigins,site-per-process',
'--allow-running-insecure-content',
'--disable-blink-features=AutomationControlled',
'--disable-extensions-except=./plugin',
'--load-extension=./plugin',
'--no-sandbox'
]
};
browser = await pup.launch(options);


console.log('creating new page ..');
page = await browser.newPage();
} catch (e) {
failCallback("could not open browser: "+e);
return false;
}

//screen size
await page.setViewport({width: 1360, height: 1000});

console.log('navigating to datadome');
try {
await page.goto(url, {
waitUntil: "networkidle0"
});
antigateResult = await anticaptcha.solveAntiGateTask(
checkUrl,
'Anti-bot screen bypass',
{
"css_selector": ".captcha__human__container"
});
} catch (e) {
console.log('err while loading the page: '+e);
console.error("could not solve captcha: "+e.toString());
return;
}

let currentUrl = await page.evaluate(async() => {
return new Promise((resolve => {
resolve(document.location.href);
}))
});
if (currentUrl.indexOf(checkUrl) === 0) {
successCallback('We are already on the target page '+checkUrl)
if (typeof antigateResult.cookies.datadome == "undefined") {
console.error('Something went wrong, got no datadome cookies. The page is not behind Datadome?');
return;
}

console.log('waiting for solution result..');
await page.setDefaultNavigationTimeout(0);
await page.waitForNavigation();
console.log('redirected to next page');

currentUrl = await page.evaluate(async() => {
return new Promise((resolve => {
resolve(document.location.href);
}))
console.log("\n\nAnti-bot screen bypassed.\n");
console.log("Use these cookies for navigation to the website:\n");
console.log(antigateResult.cookies);

const fingerPrint = antigateResult.fingerprint;

axios.get(checkUrl,
{ headers: {
'User-Agent': fingerPrint['self.navigator.userAgent'],
'Cookies': 'datadome='+antigateResult.cookies.datadome
} } )
.then(response => {
console.log(response);
})
.catch(function(e) {
console.log(e);
});
console.log('current address is '+currentUrl);

if (currentUrl === url) {
failCallback('Could not pass datadome :(');
return;
}
if (currentUrl.indexOf(checkUrl) === 0) {
successCallback('Datadome passed');
} else {
failCallback('Navigated to unexpected address. Check if it is the one!');
}


})();


function delay(time) {
return new Promise(function(resolve) {
setTimeout(resolve, time)
});
}

async function testPlugin() {
return new Promise(((resolve, reject) => {
if (!fs.existsSync('./plugin')) {
console.log('downloading plugin..');
download("https://antcpt.com/anticaptcha-plugin.zip","./plugin.zip")
.then(() => {
console.log('unzipping plugin..');
const zip = new AdmZip("./plugin.zip");
zip.extractAllTo("./plugin/", true);
resolve();
})
.catch(e => {
console.error('something went wrong while downloading plugin: '+e.toString());
reject(e)
});
} else {
console.log('plugin already exists');
resolve();
}
}))

}

function download(url, dest) {
return new Promise((resolve, reject) => {
// Check file does not exist yet before hitting network
fs.access(dest, fs.constants.F_OK, (err) => {

if (err === null) reject('File already exists');

const request = https.get(url, response => {
if (response.statusCode === 200) {

const file = fs.createWriteStream(dest, { flags: 'wx' });
file.on('finish', () => resolve());
file.on('error', err => {
file.close();
if (err.code === 'EEXIST') reject('File already exists');
else fs.unlink(dest, () => reject(err.message)); // Delete temp file
});
response.pipe(file);
} else if (response.statusCode === 302 || response.statusCode === 301) {
//Recursively follow redirects, only a 200 will resolve.
download(response.headers.location, dest).then(() => resolve());
} else {
reject(`Server responded with ${response.statusCode}: ${response.statusMessage}`);
}
});

request.on('error', err => {
reject(err.message);
});
});
});
}

function successCallback(result) {
console.log('Successfully passed: '+result);
console.log('closing browser .. ');
if (browser) browser.close();
}

function failCallback(code) {
console.log('Failed to pass: '+code);
console.log('closing browser .. ');
if (browser) browser.close();
}

0 comments on commit 36fd8e1

Please sign in to comment.