Skip to content

Odin SDK provides a way to search across various services related to cybersecurity, IP services, certificates, exposed files and more

Notifications You must be signed in to change notification settings

cybledev/odin-sdk-python

Repository files navigation

Odin SDK for Python

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.

Requirements

Python 2.7 and 3.4+

Installation & Usage

pip install

pip install odin-sdk

(you may need to run pip with root permission: sudo pip install odin-sdk)

Then import the package:

import odin

Getting Started

Please follow the installation procedure and then run the following:

from __future__ import print_function
import time
import odin
from odin.rest import ApiException
from pprint import pprint

# Configure API key authorization: ApiKeyAuth
configuration = odin.Configuration()
configuration.api_key['X-API-Key'] = '<API-Key>'

# search exposed buckets (using pagination)
api_instance = odin.ExposedBucketsApi(odin.ApiClient(configuration))
try:
    results, last = [], None
    for _ in range(3):
        resp = api_instance.v1_exposed_buckets_search_post(
            {
                "query": 'name:"lit-link-prd.appspot.com"',
                "limit": 1,
                "start": last,
            }
        )
        results.extend(resp)

        last = resp.get("pagination", {}).get("last")
except ApiException as e:
   ...

# search files in a exposed bucket
api_instance = odin.ExposedFilesApi(odin.ApiClient(configuration))
try:
    resp = api_instance.v1_exposed_files_search_post(
        {
            "query": 'provider: aws',
            "limit": 1,
            "sortDir": "desc",
            "sortBy": "files"
        }
    )
    resp
except ApiException as e:
   ...

# search hosts
api_instance = odin.HostsApi(odin.ApiClient(configuration))
try:
    resp = api_instance.v1_hosts_search_post(
        {
            "query": "(last_updated_at:[\"2024-07-08T02:41:15.528Z\" TO *] AND services.port:80) OR asn.number:AS63949",
            "limit": 1
        }
    )
    resp
except ApiException as e:
    ...

# certificates search
api_instance = odin.CertificateApi(odin.ApiClient(configuration))
try:
    resp = api_instance.v1_certificates_search_post(
        {
            "query": "certificate.subject_alt_name.dns_names:'cloudflare.com' AND certificate.validity.not_after:\"2024-09-20T18:19:24\"",
            "limit": 1
        }
    )
    resp
except ApiException as e:
    ...

# hosts cve ip
api_instance = odin.HostsApi(odin.ApiClient(configuration))
try:
    resp = api_instance.v1_hosts_cve_ip_get("<ip>")
    resp.to_dict()
except ApiException as e:
    ...

# create an instance of the API class
api_instance = odin.CertificateApi(odin.ApiClient(configuration))
body = odin.CertificateCertCountRequest() # CertificateCertCountRequest | Count Query

try:
    # Get records count
    api_response = api_instance.v1_certificates_count_post(body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CertificateApi->v1_certificates_count_post: %s\n" % e)

# create an instance of the API class
api_instance = odin.CertificateApi(odin.ApiClient(configuration))
hash = 'hash_example' # str | get the complete cert by hash

try:
    # Get the complete certificate
    api_response = api_instance.v1_certificates_hash_get(hash)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CertificateApi->v1_certificates_hash_get: %s\n" % e)

# Configure API key authorization: ApiKeyAuth
configuration = odin.Configuration()
configuration.api_key['X-API-Key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-API-Key'] = 'Bearer'

# create an instance of the API class
api_instance = odin.CertificateApi(odin.ApiClient(configuration))
body = odin.CertificateNextBatchRequest() # CertificateNextBatchRequest | Search Query

try:
    # Get the next batch of record
    api_response = api_instance.v1_certificates_scroll_next_post(body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CertificateApi->v1_certificates_scroll_next_post: %s\n" % e)

# Configure API key authorization: ApiKeyAuth
configuration = odin.Configuration()
configuration.api_key['X-API-Key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-API-Key'] = 'Bearer'

# create an instance of the API class
api_instance = odin.CertificateApi(odin.ApiClient(configuration))
body = odin.CertificateCertScrollRequest() # CertificateCertScrollRequest | Search Query

try:
    # Get the record based on query
    api_response = api_instance.v1_certificates_scroll_post(body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CertificateApi->v1_certificates_scroll_post: %s\n" % e)

# create an instance of the API class
api_instance = odin.CertificateApi(odin.ApiClient(configuration))
body = odin.CertificateCertSearchRequest() # CertificateCertSearchRequest | Search Query

try:
    # Search records
    api_response = api_instance.v1_certificates_search_post(body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CertificateApi->v1_certificates_search_post: %s\n" % e)

# create an instance of the API class
api_instance = odin.CertificateApi(odin.ApiClient(configuration))
body = odin.CertificateCertSummaryRequest() # CertificateCertSummaryRequest | Summary

try:
    # Get summary
    api_response = api_instance.v1_certificates_summary_post(body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CertificateApi->v1_certificates_summary_post: %s\n" % e)

Documentation for API Endpoints

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

Class Method HTTP request Description
CertificateApi v1_certificates_count_post POST /v1/certificates/count Get records count
CertificateApi v1_certificates_hash_get GET /v1/certificates/{hash} Get the complete certificate
CertificateApi v1_certificates_scroll_next_post POST /v1/certificates/scroll/next Get the next batch of record
CertificateApi v1_certificates_scroll_post POST /v1/certificates/scroll Get the record based on query
CertificateApi v1_certificates_search_post POST /v1/certificates/search Search records
CertificateApi v1_certificates_summary_post POST /v1/certificates/summary Get summary
ExposedBucketsApi v1_exposed_buckets_count_post POST /v1/exposed/buckets/count Get exposed bucket count
ExposedBucketsApi v1_exposed_buckets_search_post POST /v1/exposed/buckets/search Search exposed buckets
ExposedBucketsApi v1_exposed_buckets_summary_post POST /v1/exposed/buckets/summary Get Exposed buckets summary
ExposedFilesApi v1_exposed_files_count_post POST /v1/exposed/files/count Get file count
ExposedFilesApi v1_exposed_files_search_post POST /v1/exposed/files/search Search exposed files
ExposedFilesApi v1_exposed_files_summary_post POST /v1/exposed/files/summary Get file summary
FieldsApi v1_fields_certificates_category_get GET /v1/fields/certificates/{category}/ Get the fields for certificates
FieldsApi v1_fields_exposed_buckets_get GET /v1/fields/exposed/buckets/ Get the fields for exposed
FieldsApi v1_fields_exposed_files_get GET /v1/fields/exposed/files/ Get the fields data
FieldsApi v1_fields_hosts_category_get GET /v1/fields/hosts/{category}/ Get the fields for hosts
HealthApi v1_ping_get GET /v1/ping Health Check
HostsApi v1_cves_all_ip_page_get GET /v1/cves/all/{ip}/{page} Get cve details
HostsApi v1_hosts_count_post POST /v1/hosts/count Get the record count
HostsApi v1_hosts_cve_ip_get GET /v1/hosts/cve/{ip}/ Get ip cve details
HostsApi v1_hosts_cves_ip_cve_get GET /v1/hosts/cves/{ip}/{cve} Get cve
HostsApi v1_hosts_exploits_ip_cve_get GET /v1/hosts/exploits/{ip}/{cve} Get exploits for ip and cve
HostsApi v1_hosts_exploits_ip_get GET /v1/hosts/exploits/{ip}/ Get exploits for ip
HostsApi v1_hosts_ip_get GET /v1/hosts/{ip}/ Get the latest ip details
HostsApi v1_hosts_search_post POST /v1/hosts/search Search hosts
HostsApi v1_hosts_summary_post POST /v1/hosts/summary Get summary
HostsApi v2_hosts_count_post POST /v2/hosts/count Fetch the record count
HostsApi v2_hosts_ip_post POST /v2/hosts/{ip} Fetch the latest ip details
HostsApi v2_hosts_search_post POST /v2/hosts/search Fetch the record based on query
HostsApi v2_hosts_summary_post POST /v2/hosts/summary Create the summary of the field based on query
DomainApi v1_domain_count_post POST /v1/domain/count Get domains count
DomainApi v1_domain_search_post POST /v1/domain/search Search domains
DomainApi v1_domain_subdomain_count_post POST /v1/domain/subdomain/count Fetch the total no. of subdomain records
DomainApi v1_domain_subdomain_search_post POST /v1/domain/subdomain/search Fetch the subdomain record
DomainApi v1_domain_whois_domain_name_get GET /v1/domain/whois/{domain-name} Fetch the domain whois record details
DomainApi v1_domain_whois_domain_name_historical_get GET /v1/domain/whois/{domain-name}/historical Fetch all the domain whois historical records
DomainApi v1_domain_whois_domain_name_is_expired_get GET /v1/domain/whois/{domain-name}/is-expired Get the expiry for a particular domain
DomainApi v1_domain_whois_domain_name_is_registered_get GET /v1/domain/whois/{domain-name}/is-registered Fetch all the domain whois historical records

Documentation For Models

Documentation For Authorization

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 Python. 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.

This Python package is automatically generated by the Swagger Codegen project:

  • API version: 1.0
  • Package version: 2.0.0
  • Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen

About

Odin SDK provides a way to search across various services related to cybersecurity, IP services, certificates, exposed files and more

Resources

Stars

Watchers

Forks

Packages

No packages published