From e5927815f307fed350311b55b4b72f1993e2181f Mon Sep 17 00:00:00 2001 From: Sven Flender Date: Wed, 11 Mar 2020 11:59:34 +0100 Subject: [PATCH] added ip in output --- bin/cli.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/cli.js b/bin/cli.js index d71a9c2..3893bda 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -3,6 +3,8 @@ var Trace = require('..') var chalk = require('chalk') +const url = require('url'); +const dns = require('dns-sync'); var trace = new Trace(process.argv[2]) .once('error', function (error) { @@ -14,11 +16,14 @@ var trace = new Trace(process.argv[2]) console.log('Trace finished in %s using %s', chalk.cyan(trace.time + ' ms'), chalk.cyan(trace.hops + ' hop' + (trace.hops > 1 ? 's' : ''))) }) .on('data', function (step) { + const u = url.parse(step.url) + const ip = dns.resolve(u.hostname) console.log( chalk.green('[' + step.statusCode + ']'), chalk.yellow(step.protocol + '/' + step.protocolVersionMajor + '.' + step.protocolVersionMinor), chalk.gray(step.method), step.url, + chalk.red(ip), chalk.gray(step.newCookies ? '(cookies: ' + step.newCookies + ') ' : '') + chalk.cyan('(' + step.time + ' ms)') )