npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

axios-ddos-guard-bypass

v1.0.3

Published

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

Downloads

152

Readme

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()
    }
});