How to use whois - 1 common examples

To help you get started, we’ve selected a few whois examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github adobe / Marinus / web_server / routes / utilities.js View on Github external
let domain = req.query.domain;
      if (!domain) {
          res.status(400).send("{'Error': 'Please send a domain!'}");
          return;
      }

      const whois = require('whois');
      let whoisObject = {
        'server': '', // this can be a string ('host:port') or an object with host and port as its keys; leaving it empty makes lookup rely on servers.json
        'follow': 2, // number of times to follow redirects
        'timeout': 0, // socket timeout, excluding this doesn't override any default timeout value
        'verbose': false, // setting this to true returns an array of responses from all servers
      };

      whois.lookup(domain, whoisObject, function(err, data) {
          if (!err) {
            let myEscapedJSONString = data.replace(/[\\]/g, '\\\\')
                                          .replace(/[\"]/g, '\\\"')
                                          .replace(/[\/]/g, '\\/')
                                          .replace(/[\b]/g, '\\b')
                                          .replace(/[\f]/g, '\\f')
                                          .replace(/[\n]/g, '\\n')
                                          .replace(/[\r]/g, '\\r')
                                          .replace(/[\t]/g, '\\t');
            res.status(200).json({'result': myEscapedJSONString});
          } else {
            res.status(500).send(err);
          }
      });
  });

whois

A WHOIS client for NodeJS

FreeBSD
Latest version published 2 years ago

Package Health Score

64 / 100
Full package analysis

Popular whois functions