Code Monkey home page Code Monkey logo

axios-ddos-guard-bypass's Introduction

axios-ddos-guard-bypass

Library to bypass DDoS Guard protection (https://ddos-guard.net/en) using Node and Axios.

  • Wrapper for AxiosInstance, uses Axios interceptors
  • Automatically detect if we encounter DDoS Guard protection, bypass it and repeat the request
  • Automatically handle cookies (needed to bypass the protection) using CookieJar
  • Supports proxy

Installation

npm install axios-ddos-guard-bypass

Usage

Example with custom CookieJar:

import axios from 'axios';
import { ddosGuardBypass } from 'axios-ddos-guard-bypass';
import { CookieJar } from 'tough-cookie';

let serviceUrl = 'https://ddos-guard.net';
let headers = {
  Referer: serviceUrl
};

let cookieJar = new CookieJar();
let agent = axios.create({
  jar: cookieJar
});

ddosGuardBypass(agent);

let response = await agent({
  url: serviceUrl,
  headers: headers
});

// We can access cookies directly from our cookieJar
const cookies = cookieJar.getCookiesSync(serviceUrl);

Example without CookieJar:

import axios from 'axios';
import { ddosGuardBypass } from 'axios-ddos-guard-bypass';

let serviceUrl = 'https://ddos-guard.net';
let headers = {
  Referer: serviceUrl
};

let agent = axios.create();

ddosGuardBypass(agent);

let response = await agent({
  url: serviceUrl,
  headers: headers
});

// CookieJar is accessible in response.config
const cookies = response.config.jar.getCookiesSync(serviceUrl);

Example with proxy:

import axios from 'axios';
import { ddosGuardBypass } from 'axios-ddos-guard-bypass';

let serviceUrl = 'https://ddos-guard.net';
let headers = {
  Referer: serviceUrl
};

let agent = axios.create();

ddosGuardBypass(agent);

let response = await agent({
  url: serviceUrl,
  headers: headers,
  proxy: {
    protocol: 'http',
    host: '127.0.0.1',
    port: 8888
  }
});

Limitations

Retrying the request is not possible if we are sending a stream-like data (FormData, ReadableStream, etc.), as the stream is already drained, in such a case it will throw an Error.

We can pass a Buffer if we want our request to be repeated:

import axios from 'axios';
import FormData from `form-data`;
import { ddosGuardBypass } from 'axios-ddos-guard-bypass';

let agent = axios.create();

ddosGuardBypass(agent);

let headers = {
    'User-Agent':
        'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36'
};

let form = new FormData();
form.append('file', imageBinaryData, {
    'someFilename.png'
});

// We call form.getBuffer() to read the data info a Buffer instance
// form.getHeaders() will provide headers, like Content-Type: multipart/form-data; boundary=...
let response = await agent.post(uploadUrl, form.getBuffer(), {
    headers: {
        ...headers,
        ...form.getHeaders()
    }
});

axios-ddos-guard-bypass's People

Contributors

4miners avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

egida bitecore

axios-ddos-guard-bypass's Issues

Test on real site doesn't work

I tested on voe (DOT) sx and doesn't work.
The site load a javascript from check (DOT) ddos-guard (DOT) net/check.js which is not loaded in your module.

I attached a log log.gz
Here the test script used main.js.gz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.