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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: otxcli-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7a81090a919557d19407fa1fb2825b850dfe51702102f3ffec095375e4cc13ad
MD5 15aa10ddbf238fa69a12de100084da8c
BLAKE2b-256 3f98c5de59d738610a66bcf82b46b3ed348c2a8bb35e44b5c1db78917b975a69

See more details on using hashes here.

Provenance

The following attestation bundles were made for otxcli-0.1.0-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

0.1.2

2 files

This release

0.1.0 This release

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