Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

evil-dns

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

evil-dns - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

7

evil-dns.js

@@ -27,5 +27,6 @@ var dns = require('dns'),

for (i = 0; i < domains.length; i++) {
if (domain.match(domains[i].domain)) {
if (!family || family === domain[i].family) {
return callback(null, domains[i].ip, family);
var entry = domains[i];
if (domain.match(entry.domain)) {
if (!family || family === entry.family) {
return callback(null, entry.ip, entry.family);
}

@@ -32,0 +33,0 @@ }

{
"name": "evil-dns",
"version": "0.1.0",
"version": "0.2.0",
"description": "Override the IP address returned for one or more domains.",

@@ -5,0 +5,0 @@ "main": "evil-dns.js",

@@ -6,14 +6,27 @@ var dns = require('dns');

describe('The method hijacking dns.lookup', function () {
it('handles family-agnostic queries', function (done) {
var error = null;
try {
dns.lookup('nodejs.org', { family: undefined, hints: dns.ADDRCONFIG | dns.V4MAPPED }, function (err) {
expect(err).to.not.exist;
done();
});
} catch (err) {
expect(err).to.not.exist;
done();
}
it('returns the family when doing DNS queries', function (done) {
evilDNS.add('*.foo.com', '1.2.3.4');
dns.lookup('a.foo.com', {family: undefined, hints: dns.ADDRCONFIG | dns.V4MAPPED}, function (err, addr, family) {
expect(addr).to.equal('1.2.3.4');
expect(family).to.equal(4);
done();
});
});
it('handles family-agnostic queries', function (done) {
var error = null;
try {
dns.lookup('nodejs.org', {family: undefined, hints: dns.ADDRCONFIG | dns.V4MAPPED}, function (err) {
expect(err).to.not.exist;
done();
});
} catch (err) {
expect(err).to.not.exist;
done();
}
});
afterEach(function () {
evilDNS.clear();
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc