npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

securitytrails

v2.0.0

Published

Node.js wrapper for the SecurityTrails API

Downloads

2

Readme

SecurityTrails API Wrapper

Installation

npm install securitytrails-js

How to use

In Node.js to create a new API Client:

const securitytrails = require("securitytrails-js");

const STAPI = new securitytrails(API_KEY);

You can then run the API functions which will return a node-fetch Promise, and handle the responses as needed.

See (SecurityTrails API Reference)

Example

const securitytrails = require("securitytrails-js");
const STAPI = new securitytrails(process.env.API_KEY);

const domain = "example.com";
const associatedDomains = await STAPI.domains_associated_domains(domain)
  .then(STAPI.handleErrors)
  .then((response) => {
    return response.json();
  })
  .catch((err) => console.error("error:" + err));

console.log(associatedDomains);

Available Methods

General

Ping

You can use this simple endpoint to test your authentication and access to the SecurityTrails API.

STAPI.ping();

Usage

Usage statistics of the API for the current month

STAPI.usage();

Scroll

A fast and easy way to fetch many results. Currently only available for the DSL API endpoints.

STAPI.scroll(scrollId);

Company

Details

Returns details for a company domain.

STAPI.company_details(domain);

Associated IPs

Returns associated IPs for a company domain. The result is not paginated nor limited. The data is based on whois data with the names matched to the domains.

STAPI.company_associated_ips(domain);

Domains

Details

Returns the current data about the given hostname. In addition to the current data, you also get the current statistics associated with a particular record. For example, for a records you'll get how many other hostnames have the same IP

STAPI.domains_details(hostname);

Subdomains

Returns child and sibling subdomains for a given hostname. Limited to 2000 results for the Free plan and to 10000 for all paid subscriptions.

STAPI.domains_subdomains(
  hostname,
  (childrenOnly = false),
  (includeInactive = true)
);

Tags

Returns tags for a given hostname

STAPI.domains_tags(hostname);

WHOIS

Returns the current WHOIS data about a given hostname with the stats merged together

STAPI.domains_whois(hostname);

Search

Filter and search specific records using this endpoint. With pagination a maximum of 10000 results can be retrieved. To access more results you can use scrolling.

STAPI.domains_search(
  (includeIps = false),
  (page = 1),
  (scroll = false),
  (body = {})
);

Statistics

Domain statistics

STAPI.domains_statistics((body = {}));

Associated domains

Find all domains that are related to a hostname you input. Limited to 10000 results.

STAPI.domains_associated_domains(hostname, (page = 1));

SSL Certificates (Pages)

Fetch current and historical certificate information for any hostname. Limited to 10000 results

STAPI.domains_ssl(
  hostname,
  (includeSubdomains = false),
  (status = "valid"),
  (page = 1)
);

SSL Certificates (Stream)

Fetch current and historical certificate information for any hostname. Returns all results.

STAPI.domains_ssl_stream(
  hostname,
  (includeSubdomains = false),
  (status = "valid")
);

History

DNS

Lists out specific historical information about the given hostname parameter. In addition of fetching the historical data for a particular type, the count statistic is returned as well, which represents the number of that particular resource against current data. (a records will have an ip_count field which will represent the number of records that has the same IP as that particular record) The results are sorted first_seen descending. The number of results is not limited.

STAPI.history_dns(hostname, (type = "a"), (page = 1));

WHOIS

Returns historical WHOIS information about the given domain. The number of results is not limited.

STAPI.history_whois(hostname, (page = 1));

IPs

Neighbors

Returns the neighbors in any given IP level range and essentially allows you to explore closeby IP addresses. It will divide the range into 16 groups. Example: a /28 would be divided into 16 /32 blocks or a /24 would be divided into 16 /28 blocks

STAPI.ips_neighbors(ipAddress);

Search with DSL

Search for IP addresses. A maximum of 10000 results can be retrieved.

STAPI.ips_dsl((page = 1), (body = {}));

Statistics

Statistics like Reverse DNS pattern identification (RDNS entries are grouped and displayed as x), ports (number of open ports found) or total results are returned

STAPI.ips_statistics((body = {}));

Whois

Fetch current IP information for a single IPv4 address.

STAPI.ips_whois(ipAddress);

Useragents

Fetch user agents seen during the last 30 days for a specific IPv4 address. It shows devices with egressing traffic based on large scale web server logs. The number of results is not limited.

STAPI.ips_useragents(ipAddress, (page = 1));

Feeds

Domains

Fetch zone files including authoritative nameservers with ease. The method returns a .csv.gz file if successful. If ns is true the columns are apex_domain,nameservers (namerservers delimiter: |) and just apex_domain if ns is false.

STAPI.feeds_domains(
  (type = "all"),
  (filter = ""),
  (tld = ""),
  (ns = ""),
  (date = "")
);

DMARC

Download a list of DMARC records. The column is apex_domain.

STAPI.feeds_dmarc((type = "all"), (date = ""));

Subdomains

Download a list of subdomains, with the possibility of filtering by TLD. The response itself is streamed to a file, which means the data is received in chunks. When using filter you must specify the tld parameter and vise versa. The method returns a .csv.gz file if successful. The columns are apex_domain,hostname.

STAPI.feeds_subdomains((type = "all"), (filter = ""), (tld = ""), (date = ""));

Firehose

Certificate Transparency

Stream Certificate Transparency entries

STAPI.firehose_ct((start = ""), (end = ""));

Miscellaneous

Submit Hostnames

Submit discovered hostnames. With the request header 'Content-Encoding: gzip' it is also possible to submit gzip'd data

STAPI.misc_submit(filePath);