Skip to main content

otxcli

otxcli

Python library and CLI covering every endpoint of the AlienVault OTX v1 API

PyPI Version Python Versions License

GitHub Stars GitHub Issues Buy Me a Coffee


Overview

otxcli is a Python toolkit to query and manage threat intelligence on AlienVault OTX. Every endpoint documented in the OTX v1 API is implemented: indicator lookups, file/URL submissions, pulse management, search, and user actions — usable both as a command-line tool and as a typed Python library.

Key Features

Feature Description
Complete API coverage All 40 documented OTX v1 operations
CLI + Library Use as command-line tool or Python package
Indicator lookups IPv4, IPv6, domain, hostname, file hash, URL, CVE, NIDS, correlation rule — with every section
Submissions Submit files and URLs for analysis, list them, manage their TLP
Pulse management Create, edit, delete, subscribe, related pulses, feeds, events
IDN aware Internationalized domains resolve via UTS46 punycode, the same rules a browser applies
Clean errors OTXError with status and detail; CLI always exits 1 with a message, never a traceback
Cross-platform Windows, Linux and macOS, x64 and ARM
Battle-tested Integration suite runs against the live API with 100% coverage and no mocks

Supported Outputs

CLI          Pretty-printed JSON on stdout, errors on stderr
Library      Decoded JSON (dict/list) per call, OTXError on failure

Installation

From PyPI (Recommended)

pip install otxcli

From Source

git clone https://github.com/seifreed/otxcli.git
cd otxcli
python3 -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -e .

Quick Start

Get an API key from your OTX account settings and export it:

export OTX_API_KEY=your-key-here

# Validate your API key
otx me

# Look up an indicator
otx ipv4 8.8.8.8

# Search pulses
otx search-pulses zeus --limit 5

Usage

Command Line Interface

# Indicator sections
otx ipv4 8.8.8.8 --section reputation
otx domain rghost.net --section malware
otx file 6c5360d41bd2b14b1565f5b18e5c203cf512e493 --section analysis
otx url http://example.com/ --section url_list
otx cve CVE-2014-0160

# Submissions
otx submit-url http://example.com/ --tlp white
otx submit-file suspicious.bin
otx submitted-files --limit 10 --sort add_date

# Pulses
otx pulse 57204e9b3c4c3e015d93cb12
otx create-pulse '{"name": "My pulse", "public": true, "TLP": "white"}'
otx edit-pulse 57204e9b3c4c3e015d93cb12 '{"description": "New description"}'
otx subscribed-pulses --limit 10 --modified-since 2026-01-01T00:00:00+00:00

# Users
otx subscribe-to-user AlienVault

Available Commands

Command group Commands
Indicators ipv4, ipv6, domain, hostname, file, url, cve, nids, correlation-rule
Submissions submit-file, submit-url, submit-urls, submitted-files, submitted-urls, update-submitted-files-tlp, update-submitted-urls-tlp
Pulses pulse, create-pulse, edit-pulse, delete-pulse, pulse-indicators, pulse-related, related-pulses, subscribe-to-pulse, unsubscribe-from-pulse, subscribed-pulses, subscribed-pulse-ids, activity, events, my-pulses, user-pulses, indicator-types, validate-indicator
Search search-pulses, search-users
Users me, subscribe-to-user, unsubscribe-from-user, follow-user, unfollow-user

Run otx --help for the full list and otx <command> --help for the options of a specific command.

Global Options

Option Description
--api-key <key> OTX API key (defaults to the OTX_API_KEY environment variable)
--server <host> API server host (defaults to otx.alienvault.com)
--timeout <seconds> Request timeout in seconds (defaults to 120)

Python Library

Basic Usage

from otxcli import OTXClient

client = OTXClient("your-key-here")

client.me()
client.ipv4("8.8.8.8", section="reputation")
client.domain("rghost.net", section="malware")
client.search_pulses("zeus", limit=5)

pulse = client.create_pulse({"name": "My pulse", "public": True, "TLP": "white"})
client.edit_pulse(pulse["id"], {"description": "New description"})
client.delete_pulse(pulse["id"])

Every method returns the decoded JSON response, or None when the endpoint answers with an empty body. HTTP errors and unparseable responses raise otxcli.OTXError, which carries status and detail attributes.

Internationalized Domains

domain and hostname accept internationalized names: OTX only resolves ASCII hosts, so the name is converted to punycode with UTS46 mapping, the same rules a browser applies. client.domain("bücher.de") looks up xn--bcher-kva.de, and a homograph such as ᴳoogle.com reaches google.com rather than a lookalike nobody serves. ASCII hostnames are sent exactly as given.


Requirements


Development

All dependencies (runtime and development) live in pyproject.toml:

pip install -e '.[dev]'

Quality and security gates, all of which must pass clean:

black --check .
ruff check .
mypy .
bandit -r .
pip-audit

Tests run against the live OTX API (no mocks) and require OTX_API_KEY:

export OTX_API_KEY=your-key-here
pytest

Coverage below 100% fails the build.


Contributing

Contributions are welcome.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Support the Project

If this project is useful in your workflows, you can support development:

Buy Me A Coffee

License

This project is licensed under the MIT license. See LICENSE.

Attribution


Built for practical threat intelligence workflows and security automation

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

otxcli-0.1.2.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

otxcli-0.1.2-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file otxcli-0.1.2.tar.gz.

File metadata

  • Download URL: otxcli-0.1.2.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for otxcli-0.1.2.tar.gz
Algorithm Hash digest
SHA256 b69fe1f21012d0aada7c0c7a6ff8d2912ff13029a0f97cc4caacf4806384eda4
MD5 19d47a6f0c03641fb781c5f75c4aa165
BLAKE2b-256 be2c97a14bd211638e2877503374051e9da6581691383f0a05e066c5e4fa13f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for otxcli-0.1.2.tar.gz:

Publisher: publish.yml on seifreed/otxcli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file otxcli-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: otxcli-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for otxcli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 35f828c6e1b1af6dafa588edce20e35471c9b40f51bbff02a6b2b15194ab23ca
MD5 a2cc2186ed9db4eb27e123925fa06445
BLAKE2b-256 410e06e84cc12236ccf78452f33a5b041795e268692c9de0e1d099619af68855

See more details on using hashes here.

Provenance

The following attestation bundles were made for otxcli-0.1.2-py3-none-any.whl:

Publisher: publish.yml on seifreed/otxcli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 files

0.1.0

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page