Skip to content

Fast and Extensive Search CLI for IP Services, CVEs, Certificates, Exposed Files/Buckets, Domains and more

Notifications You must be signed in to change notification settings

cybledev/odin-sdk-js

Repository files navigation

Odin SDK for Javascript

ODIN's primary focus is to equip infosec teams with a precise depiction of the internet, enabling them to strengthen their security defences and proactively detect threats within their attack surface.

The Odin SDK for Go provides a simple way to interact with the Odin API and access various services related to cybersecurity, ip services, certificates, exposed files, domains and more.

Installation

npm

Then install it via:

npm install odin-sdk --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false,
      },
    },
  ];
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var Odin = require("odin-sdk");

var defaultClient = Odin.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
var ApiKeyAuth = defaultClient.authentications["ApiKeyAuth"];
ApiKeyAuth.apiKey = "YOUR API KEY";
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix['X-API-Key'] = "Token"

// search exposed buckets (using pagination)
var api = new OdinApis.ExposedBucketsApi();
var buckets = [];

for (var i = 0; i < 10; i++) {
  var query = new OdinApis.ExposedCountRequest();
  query.query = "name:'lit-link-prd.appspot.com'";
  var callback = function (error, data, response) {
    if (error) {
      console.error(error);
    } else {
      buckets.push(data);
    }
  };
  api.exposedBucketsCountPost(query, callback);
  console.log(JSON.stringify(buckets));
}

// search files in a exposed bucket
var api = new OdinApis.ExposedFilesApi();
var query = {
  query: "provider: aws",
  limit: 1,
  sortDir: "desc",
  sortBy: "files",
};
var callback = function (error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log(JSON.stringify(data));
  }
};
api.exposedFilesSearchPost(query, callback);

// search hosts
var api = new OdinApis.ExposedHostsApi();
var query = {
  query:
    '(last_updated_at:["2024-07-08T02:41:15.528Z" TO *] AND services.port:80) OR asn.number:AS63949',
  limit: 1,
};
var callback = function (error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log(JSON.stringify(data));
  }
};
api.exposedHostsSearchPost(query, callback);

// certificates search
var api = new OdinApis.CertificateApi();
var query = {
  query:
    "certificate.subject_alt_name.dns_names:'cloudflare.com' AND certificate.validity.not_after:\"2024-09-20T18:19:24\"",
  limit: 1,
};
var callback = function (error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log(JSON.stringify(data));
  }
};
api.certificatesSearchPost(query, callback);

// certificates count
var api = new OdinApis.CertificateApi();
var query = new OdinApis.CertificateCertCountRequest();
var callback = function (error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log(JSON.stringify(data));
  }
};
api.certificatesCountPost(query, callback);

Documentation for API Endpoints

All URIs are relative to https://api.odin.io

Class Method HTTP request Description
Odin.CertificateApi v1CertificatesCountPost POST /v1/certificates/count Get records count
Odin.CertificateApi v1CertificatesHashGet GET /v1/certificates/{hash} Get the complete certificate
Odin.CertificateApi v1CertificatesScrollNextPost POST /v1/certificates/scroll/next Get the next batch of record
Odin.CertificateApi v1CertificatesScrollPost POST /v1/certificates/scroll Get the record based on query
Odin.CertificateApi v1CertificatesSearchPost POST /v1/certificates/search Search records
Odin.CertificateApi v1CertificatesSummaryPost POST /v1/certificates/summary Get summary
Odin.DomainApi v1DomainCountPost POST /v1/domain/count Get domains count
Odin.DomainApi v1DomainSearchPost POST /v1/domain/search Search domains
Odin.DomainApi v1DomainSubdomainCountPost POST /v1/domain/subdomain/count Fetch the total no. of subdomain records
Odin.DomainApi v1DomainSubdomainSearchPost POST /v1/domain/subdomain/search Fetch the subdomain record
Odin.DomainApi v1DomainWhoisDomainNameGet GET /v1/domain/whois/{domain-name} Fetch the domain whois record details
Odin.DomainApi v1DomainWhoisDomainNameHistoricalGet GET /v1/domain/whois/{domain-name}/historical Fetch all the domain whois historical records
Odin.DomainApi v1DomainWhoisDomainNameIsExpiredGet GET /v1/domain/whois/{domain-name}/is-expired Get the expiry for a particular domain
Odin.DomainApi v1DomainWhoisDomainNameIsRegisteredGet GET /v1/domain/whois/{domain-name}/is-registered Fetch all the domain whois historical records
Odin.ExposedBucketsApi v1ExposedBucketsCountPost POST /v1/exposed/buckets/count Get exposed bucket count
Odin.ExposedBucketsApi v1ExposedBucketsSearchPost POST /v1/exposed/buckets/search Search exposed buckets
Odin.ExposedBucketsApi v1ExposedBucketsSummaryPost POST /v1/exposed/buckets/summary Get Exposed buckets summary
Odin.ExposedFilesApi v1ExposedFilesCountPost POST /v1/exposed/files/count Get file count
Odin.ExposedFilesApi v1ExposedFilesSearchPost POST /v1/exposed/files/search Search exposed files
Odin.ExposedFilesApi v1ExposedFilesSummaryPost POST /v1/exposed/files/summary Get file summary
Odin.FieldsApi v1FieldsCertificatesCategoryGet GET /v1/fields/certificates/{category}/ Get the fields for certificates
Odin.FieldsApi v1FieldsExposedBucketsGet GET /v1/fields/exposed/buckets/ Get the fields for exposed
Odin.FieldsApi v1FieldsExposedFilesGet GET /v1/fields/exposed/files/ Get the fields data
Odin.FieldsApi v1FieldsHostsCategoryGet GET /v1/fields/hosts/{category}/ Get the fields for hosts
Odin.HealthApi v1PingGet GET /v1/ping Health Check
Odin.HostsApi v1CvesAllIpPageGet GET /v1/cves/all/{ip}/{page} Get cve details
Odin.HostsApi v1HostsCountPost POST /v1/hosts/count Get the record count
Odin.HostsApi v1HostsCveIpGet GET /v1/hosts/cve/{ip}/ Get ip cve details
Odin.HostsApi v1HostsCvesIpCveGet GET /v1/hosts/cves/{ip}/{cve} Get cve
Odin.HostsApi v1HostsExploitsIpCveGet GET /v1/hosts/exploits/{ip}/{cve} Get exploits for ip and cve
Odin.HostsApi v1HostsExploitsIpGet GET /v1/hosts/exploits/{ip}/ Get exploits for ip
Odin.HostsApi v1HostsIpGet GET /v1/hosts/{ip}/ Get the latest ip details
Odin.HostsApi v1HostsSearchPost POST /v1/hosts/search Search hosts
Odin.HostsApi v1HostsSummaryPost POST /v1/hosts/summary Get summary
Odin.HostsApi v2HostsCountPost POST /v2/hosts/count Fetch the record count
Odin.HostsApi v2HostsIpPost POST /v2/hosts/{ip} Fetch the latest ip details
Odin.HostsApi v2HostsSearchPost POST /v2/hosts/search Fetch the record based on query
Odin.HostsApi v2HostsSummaryPost POST /v2/hosts/summary Create the summary of the field based on query

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

ApiKeyAuth

  • Type: API key
  • API key parameter name: X-API-Key
  • Location: HTTP header

Generate your Odin API key from the odin dashboard.

Thank you for using the Odin SDK for Javascript. If you encounter any issues, find a bug, or want to contribute, feel free to open an issue or submit a pull request. Your feedback and contributions are highly appreciated!

For more information about our other projects and services, visit our website at https://odin.io.

About

Fast and Extensive Search CLI for IP Services, CVEs, Certificates, Exposed Files/Buckets, Domains and more

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published