shodan-client.js v3.1.3 releases: A Node.js library for accessing the new SHODAN API

Shodan client for JavaScript

API

ūüĎĬ†The content of the result is the same provided by the HTTP API. You can check them in the¬†API documentation.

version

Library version.

async host(ip, key, opts)

Returns all services that have been found on the given host IP. Supported options:

  • ip¬†(string) – Host IP address.
  • key¬†(string) – SHODAN API key.
  • opts, an object with:
    • history¬†(boolean, optional) – True if all historical banners should be returned (default: false)
    • minify¬†(boolean, optional) – True to only return the list of ports and the general host information, no banners. (default: false)
    • timeout¬†(number) – Connection timeout in ms. (default: 5000)

async search(query, key, opts)

Search Shodan using the same query syntax as the website and use facets to get summary information for different properties. This method may use API query credits depending on usage, please check the API documentation.

  • query¬†(string) – The provided string is used to search the database of banners in Shodan, with the additional option to provide filters inside the search query using a “filter:value” format. For example, the following search query would find Apache webservers located in Germany: “apache country:DE”. To see which filters are supported please check the API documentation.
  • key¬†(string) – SHODAN API key.
  • opts, an object with:
    • facets¬†(string, optional) – A comma-separated list of properties to get summary information on. Property names can also be in the format of “property:count”, where “count” is the number of facets that will be returned for a property (i.e. “country:100” to get the top 100 countries for a search query). To see which filters are supported please check the API documentation. (default: null)
    • page¬†(number, optional) – The page number to page through results 100 at a time (default: 1)
    • minify¬†(boolean, optional) – Whether or not to truncate some of the larger fields (default: true)
    • timeout¬†(number) – Connection timeout in ms. (default: 5000)
  • More

Changelog v3.1.3

ūüźõ¬†Fixed

  • Problem with¬†minify¬†option.

Download

git clone https://github.com/jesusprubio/shodan-client.js.git
npm install

Use

All methods of the API need a valid key, you can get one here.

const client = require('shodan-client');

const searchOpts = {
  facets: 'port:100,country:100',
  // minify: false,
};
client
  .search('asterisk port:5061', 'YOURKEYHERE', searchOpts)
  .then(res => {
    console.log('Result:');
    console.log(util.inspect(res, { depth: 6 }));
  })
  .catch(err => {
    console.log('Error:');
    console.log(err);
  });

 

 

 

Copyright Jes√ļs P√©rez <jesusprubio@member.fsf.org>

Source: https://github.com/jesusprubio/

Share