dnc

CLI tool to check domain names configuration and statistics
Log | Files | Refs | README | LICENSE

commit 0ecbbedd82187263277944f185626eaf3dd39818
parent 427570309e30cf3e2143ef223f2bf2439bbf2b32
Author: Frederic Cambus <fred@statdns.com>
Date:   Tue, 19 Jan 2021 16:38:51 +0100

Remove the Node.js version, dnc is now written in Python.

Diffstat:
Dbin/dnc | 40----------------------------------------
Dconfig.json | 6------
Dindex.js | 1-
Dlib/dnc.js | 124-------------------------------------------------------------------------------
Dpackage.json | 42------------------------------------------
5 files changed, 0 insertions(+), 213 deletions(-)

diff --git a/bin/dnc b/bin/dnc @@ -1,40 +0,0 @@ -#!/usr/bin/env node - -/*****************************************************************************/ -/* */ -/* dnc 0.1.2 */ -/* Copyright (c) 2014-2017, Frederic Cambus */ -/* https://github.com/fcambus/dnc */ -/* */ -/* Created: 2014-02-11 */ -/* Last Updated: 2017-02-03 */ -/* */ -/* dnc is released under the BSD 2-Clause license. */ -/* See LICENSE file for details. */ -/* */ -/*****************************************************************************/ - -var fs = require('fs'); -var log = require('npmlog'); -var dnc = require('../lib/dnc'); - -var config = require("../config.json"); - -log.info("", "dnc is running. Press Ctrl+C to stop"); - - -if (process.argv.length != 2) { - config.domains = process.argv.splice(2, process.argv.length); - - dnc(config); -} else { - fs.readFile(process.env.HOME + '/.dnc', function(error, data) { - if (!error) { - config = JSON.parse(data); - } else { - log.warn("", "Can't read ~/.dnc file, using default configuration"); - } - - dnc(config); - }); -} diff --git a/config.json b/config.json @@ -1,6 +0,0 @@ -{ - "domains": [ - "cambus.net", - "echojs.com" - ] -} diff --git a/index.js b/index.js @@ -1 +0,0 @@ -module.exports = require('./lib/dnc'); diff --git a/lib/dnc.js b/lib/dnc.js @@ -1,124 +0,0 @@ -/*****************************************************************************/ -/* */ -/* dnc 0.1.2 */ -/* Copyright (c) 2014-2017, Frederic Cambus */ -/* https://github.com/fcambus/dnc */ -/* */ -/* Created: 2014-02-11 */ -/* Last Updated: 2017-02-03 */ -/* */ -/* dnc is released under the BSD 2-Clause license. */ -/* See LICENSE file for details. */ -/* */ -/*****************************************************************************/ - -var dns = require('dns'); - - - -/**[ NPM Modules ]************************************************************/ - -var async = require('async'); -var alexa = require('alexarank'); - -var Intl = require('intl'); -var Table = require('cli-table'); - - - -/**[ dnc ]********************************************************************/ - -module.exports = function(config) { - - var table = new Table({ - head: ['Domain', 'NS', 'IPv4', 'IPv6', 'Alexa'] - }); - - async.forEach(config.domains, function(domain, callback) { - - var site = { - ns: '', - ipv4: '', - ipv6: '', - alexa: '' - }; - - async.series([ - - /**[ Get Alexa Traffic Rank ]*************************************/ - - function(callback) { - alexa(domain, function(error, result) { - if (!error && result.rank) { - site.alexa = new Intl.NumberFormat().format(result.rank); - } - - callback(); - }); - }, - - /**[ Get Name Servers ]*******************************************/ - - function(callback) { - dns.resolveNs(domain, function(error, addresses) { - if (!error) { - for (var item in addresses) { - site.ns += addresses[item] + "\n"; - } - } - - callback(); - }); - }, - - /**[ Get A records ]**********************************************/ - - function(callback) { - dns.resolve4(domain, function(error, addresses) { - if (!error) { - for (var item in addresses) { - site.ipv4 += addresses[item] + "\n"; - } - } - - callback(); - }); - }, - - /**[ Get AAAA records ]*******************************************/ - - function(callback) { - dns.resolve6(domain, function(error, addresses) { - if (!error) { - for (var item in addresses) { - site.ipv6 += addresses[item] + "\n"; - } - } - - callback(); - }); - } - ], function(error) { - - /**[ Populate table ]*********************************************/ - - table.push( - [domain, site.ns.trim(), site.ipv4.trim(), site.ipv6.trim(), site.alexa] - ); - - callback(); - }); - - }, function(error) { - - /**[ Sort and display table ]*****************************************/ - - table.sort(function(a, b) { - if (a[0] < b[0]) return -1; - if (a[0] > b[0]) return 1; - return 0; - }); - - console.log(table.toString()); - }); -}; diff --git a/package.json b/package.json @@ -1,42 +0,0 @@ -{ - "name": "dnc", - "version": "0.1.2", - "description": "A CLI tool to check domain names configuration and statistics", - "main": "index.js", - "preferGlobal": "true", - "bin": { - "dnc": "./bin/dnc" - }, - "repository": { - "type": "git", - "url": "https://github.com/fcambus/dnc" - }, - "keywords": [ - "alexa", - "dns", - "domain", - "name", - "check", - "monitor" - ], - "author": { - "name": "Frederic Cambus", - "url": "https://www.cambus.net" - }, - "licenses": [ - { - "type": "BSD", - "url": "https://github.com/fcambus/dnc/blob/master/LICENSE" - } - ], - "bugs": { - "url": "https://github.com/fcambus/dnc/issues" - }, - "dependencies": { - "alexarank": "^0.2.0", - "async": "^2.1.4", - "cli-table": "^0.3.1", - "intl": "^1.2.5", - "npmlog": "^4.0.2" - } -}