anderfjord / node-shodan-client

A Node.js library for accessing the new SHODAN API, https://developer.shodan.io/api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

node-shodan-client

A Node (node.js™ / io.js) library for accessing the new SHODAN API**. It includes all officially supported methods (REST, Streaming and Exploits APIs). Moreover two more were added, which allow to obtain the most popular search queries.

Demo

Use

All methods of the API need a valid key, you can get one here. But popular ones can be reached through RSS so no key is needed.

var ShodanClient = require('shodan-client'),
    options = {
        key: 'YOURKEYHERE',
    },
    shodanClient = new ShodanClient(options),
    searchOptions = {
        query: 'asterisk',
        limit: 5,
        facets: 'port:100',
        minify: false
    };

shodanClient.search(searchOptions,  function (data, err) {
    console.log('\n------------------- search -------------------');
    if (err) {
        console.log('ERROR: shodanClient.search: ' + err);
    } else {
        console.log(data);
    }
});

shodanClient.streamBanners(function (data, err) {
    console.log('\n------------------- streamBanners -------------------');
    if (err) {
        console.log('ERROR: shodanClient.streamBanners: ' + err);
    } else {
        console.log(data);
    }
});

var searchOptionsExploits = {
    query: 'asterisk',
    facets: 'port:100',
    page: 1
};

shodanClient.exploitSearch(searchOptionsExploits,  function (data, err) {
    console.log('\n------------------- exploitSearch -------------------');
    if (err) {
        console.log('ERROR: shodanClient.exploitSearch: ' + err);
    } else {
        console.log(data);
    }
});

shodanClient.profile(function (err,data) {
    if (err) {
        console.log ("ERROR: shodanClient.profile: " + err);
    } else {
        console.log ("Profile query success. You have " + data.credits + " query credits remaining.");
    }
});

Full examples

Developer guide

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

About

A Node.js library for accessing the new SHODAN API, https://developer.shodan.io/api

License:GNU General Public License v3.0


Languages

Language:JavaScript 100.0%