Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

securitytrails-js

1.0.3 • Public • Published

SecurityTrails API Wrapper

Installation

npm install securitytrails-js

How to use

In Node.js to create a new API Client:

const STAPI = require("securitytrails-js")

const stapi = new STAPI(API_KEY)

You can then run the API functions which will pass parsed JSON response, status, header and errors to a callback: callback(data, status, header, err)

Available API functions (API Documentation)

Other


ping

SecurityTrails API Doc

Example:

stapi.ping(
    function(data, status, header, err) { 
        console.log("Data:", data);
        console.log("Status:", status);
        console.log("Header:", header);
        console.log("Error:", err);
    });

usage

SecurityTrails API Doc

Example:

stapi.usage(
    function(data, status, header, err) { 
        console.log("Data:", data);
        console.log("Status:", status);
        console.log("Header:", header);
        console.log("Error:", err);
    });

get_domain

SecurityTrails API Doc

Example:

stapi.get_domain(
    "securitytrails.com", // hostname
    function(data, status, header, err) { 
        console.log("Data:", data);
        console.log("Status:", status);
        console.log("Header:", header);
        console.log("Error:", err);
    });

list_domain

SecurityTrails API Doc

Example:

stapi.list_domain(
    "securitytrails.com", // domain
    function(data, status, header, err) { 
        console.log("Data:", data);
        console.log("Status:", status);
        console.log("Header:", header);
        console.log("Error:", err);
    });

list_tags

SecurityTrails API Doc

Example:

stapi.list_tags(
    "twitter.com", // domain
    function(data, status, header, err) { 
        console.log("Data:", data);
        console.log("Status:", status);
        console.log("Header:", header);
        console.log("Error:", err);
    });

get_WHOIS

SecurityTrails API Doc

Example:

stapi.get_WHOIS(
    "netflix.com", // domain
    function(data, status, header, err) { 
        console.log("Data:", data);
        console.log("Status:", status);
        console.log("Header:", header);
        console.log("Error:", err);
    });

list_by_record_type

SecurityTrails API Doc

Example:

stapi.list_by_record_type(
    {
        hostname    : "securitytrails.com",
        type        : "a",
        page        : 1     // Optional
    },
    function(data, status, header, err) { 
        console.log("Data:", data);
        console.log("Status:", status);
        console.log("Header:", header);
        console.log("Error:", err);
    });

list_by_domain

SecurityTrails API Doc

Example:

stapi.list_by_domain(
    {
        hostname    : "securitytrails.com",
        page        : 1     // Optional
    },
    function(data, status, header, err) { 
        console.log("Data:", data);
        console.log("Status:", status);
        console.log("Header:", header);
        console.log("Error:", err);
    });

explore_ips

SecurityTrails API Doc

Example:

stapi.explore_ips(
    {
        ip      : "1.1.1.1",    // Optional
        mask    : 28            // Optional
    },
    function(data, status, header, err) { 
        console.log("Data:", data);
        console.log("Status:", status);
        console.log("Header:", header);
        console.log("Error:", err);
    });

search

SecurityTrails API Doc

Example:

stapi.search(
    {
        page   : 1,   // Optional
        filter : {
            mx      : "alt4.aspmx.l.google.com",
            keyword : "stackover"
        }
    },
    function(data, status, header, err) { 
        console.log("Data:", data);
        console.log("Status:", status);
        console.log("Header:", header);
        console.log("Error:", err);
    });

search_stats

SecurityTrails API Doc

Example:

stapi.search_stats(
    {
        page   : 1,   // Optional
        filter : {
            mx      : "alt4.aspmx.l.google.com",
            keyword : "stackover"
        }
    },
    function(data, status, header, err) { 
        console.log("Data:", data);
        console.log("Status:", status);
        console.log("Header:", header);
        console.log("Error:", err);
    });

get

This serves as a base function for GET requests if you want specify the API path yourself:

Example:

stapi.get("/v1/domain/securitytrails.com",
    function (data, status, header, err) {
        console.log("Data:", data);
        console.log("Status:", status);
        console.log("Header:", header);
        console.log("Error:", err);
    });

post

This serves as a base function for POST requests if you want specify the API path yourself:

Example:

stapi.post("/v1/search/list?page=1",
    {
        filter: {
            mx: "alt4.aspmx.l.google.com",
            keyword: "stackover"
        }
    },
    function (data, status, header, err) {
        console.log("Data:", data);
        console.log("Status:", status);
        console.log("Header:", header);
        console.log("Error:", err);
    });

install

npm i securitytrails-js

Downloadsweekly downloads

0

version

1.0.3

license

ISC

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar