Giter Club home page Giter Club logo

node-evil-dns's Introduction

Evil DNS

Override the IP address returned for one or more domains.

Note: This module modifies the core DNS library's lookup function.

Installation

npm install evil-dns

Usage

var evilDns = require('evil-dns');

// String match
evilDns.add('foo.com', '1.2.3.4');
// String with wild cards
evilDns.add('*foo.*', '1.2.3.4');
// RegExp match
evilDns.add(/^foo\.bar\..*$/i, '1.2.3.4');

// Remove domain entry
evilDns.remove('*foo.*','1.2.3.4');

// Remove domain by matching the RegExp source attributes
// When no ip is passed any entry matching the domain will be removed
evilDns.remove(/^foo\.bar\..*$/i);

// Remove all domain entries
evilDns.clear();

node-evil-dns's People

Contributors

jameshight avatar jpage-godaddy avatar martinheidegger avatar

Stargazers

 avatar ForeverGlory avatar Arthur A. Bergamaschi avatar Evelyn Hathaway avatar BlackzodiaK avatar Piotr Gąsiorowski avatar Dario Locci avatar Walter Dal Mut avatar  avatar maple avatar Erik Sanchez Pérez avatar Hemã Vidal avatar Dumitru Uzun avatar Sokcuri avatar BlackzodiaK avatar kirintw avatar  avatar Keith Smith avatar Yoshiya Hinosawa avatar  avatar NUMAflex avatar JM Versteeg avatar James Marlowe avatar  avatar

Watchers

Joey Jan avatar James Cloos avatar  avatar

node-evil-dns's Issues

Is the repo alive?

For 5 years there were no updates
I'd like to contribute an improved code base. If not will create another repo, but I prefer not to do so.

Node v20 support

Sadly this module no longer works in Node v20+. Going to take a look but seems core dns lookup must have been reworked.

async example

node-evil-dns patched node:dns and not node:dns/promises
If you need await:

import dns from 'node:dns'
import edns from 'evil-dns';
// import { lookup } from 'node:dns/promises'

// eDns has patched node:dns and not node:dns/promises
async function lookupAsync(domain) {
  return new Promise((resolve, reject) => {
    dns.lookup(domain, (err, address, family) => {
      if (err) reject(err)
      resolve({address, family})
    })
  })
}

;(async () => {

  var domain = 'my-domain.com'
  var {address, family} = await lookupAsync(domain)
  console.log(address, family)

  edns.add(domain, '1.2.3.4');
  var {address, family} = await lookupAsync(domain)
  console.log(address, family)

})()

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.