Skip to content

Commit 9b34064

Browse files
committed
first release
1 parent 4e0d43f commit 9b34064

15 files changed

Lines changed: 3339 additions & 0 deletions

MANIFEST.in

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
include LICENSE
2+
include README.md
3+
include requirements.txt
4+
include pyproject.toml
5+
include pytest.ini
6+
include .coveragerc
7+
8+
recursive-include tests *.py
9+
recursive-exclude * __pycache__
10+
recursive-exclude * *.py[cod]
11+
recursive-exclude * *$py.class
12+
recursive-exclude * *.so
13+
recursive-exclude * .git*
14+
recursive-exclude * .pytest_cache
15+
recursive-exclude * .coverage
16+
recursive-exclude * htmlcov

README.md

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# PRODAFT CATALYST API Client
2+
3+
[![PyPI version](https://badge.fury.io/py/python-catalyst.svg)](https://badge.fury.io/py/python-catalyst)
4+
[![Python Versions](https://img.shields.io/pypi/pyversions/python-catalyst.svg)](https://pypi.org/project/python-catalyst/)
5+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6+
[![Tests](https://github.com/prodaft/python-catalyst/actions/workflows/python-test.yml/badge.svg)](https://github.com/prodaft/python-catalyst/actions/workflows/python-test.yml)
7+
8+
A Python client for the PRODAFT CATALYST API, enabling seamless integration with OpenCTI by converting threat intelligence data into STIX 2.1 format.
9+
10+
## Overview
11+
12+
This library provides a simple interface to retrieve threat intelligence from the PRODAFT CATALYST platform and convert it into STIX 2.1 format for ingestion into OpenCTI or other threat intelligence platforms.
13+
14+
## Key Features
15+
16+
- Retrieve threat intelligence from CATALYST API
17+
- Extract entities (malware, threat actors, tools, etc.)
18+
- Convert to STIX 2.1 format for OpenCTI integration
19+
- Support for all CATALYST observable types
20+
- TLP classification support (CLEAR, GREEN, AMBER, AMBER+STRICT, RED)
21+
- Automatic pagination for large result sets
22+
- Proxy and custom logging support
23+
24+
## Installation
25+
26+
```bash
27+
pip install python-catalyst
28+
```
29+
30+
## Requirements
31+
32+
- Python 3.8+
33+
- requests
34+
- stix2
35+
- python-dateutil
36+
- pycti
37+
38+
## Basic Usage
39+
40+
```python
41+
from python_catalyst import CatalystClient, PostCategory, TLPLevel
42+
from datetime import datetime
43+
44+
# Initialize client
45+
client = CatalystClient(api_key="your_api_key")
46+
47+
# Get threat intelligence data
48+
content = client.get_member_content("content_id")
49+
50+
# Extract entities
51+
entities = client.extract_entities_from_member_content("content_id")
52+
53+
# Convert to STIX format for OpenCTI
54+
report, stix_objects = client.create_report_from_member_content(content)
55+
```
56+
57+
## Documentation
58+
59+
### Authentication
60+
61+
```python
62+
client = CatalystClient(
63+
api_key="your_api_key",
64+
base_url="https://prod.blindspot.prodaft.com/api"
65+
)
66+
```
67+
68+
### Content Retrieval
69+
70+
The client supports various methods to retrieve threat intelligence:
71+
72+
- `get_member_content(content_id)`: Get a specific content by ID
73+
- `get_member_contents(category, tlp, page, page_size)`: Get paginated content
74+
- `get_all_member_contents(category, published_on_after, search)`: Get all content with automatic pagination
75+
- `get_updated_member_contents(since, max_results)`: Get content updated since a specific date
76+
77+
### Entity Extraction
78+
79+
```python
80+
entities = client.extract_entities_from_member_content("content_id")
81+
```
82+
83+
### STIX Conversion
84+
85+
Convert CATALYST content to STIX 2.1 objects for OpenCTI integration:
86+
87+
```python
88+
# Convert to STIX format
89+
report, stix_objects = client.create_report_from_member_content(content)
90+
```
91+
92+
## Development
93+
94+
### Setting up the development environment
95+
96+
```bash
97+
# Clone the repository
98+
git clone https://github.com/prodaft/python-catalyst.git
99+
cd python-catalyst
100+
101+
# Install development dependencies
102+
pip install -r requirements-dev.txt
103+
```
104+
105+
### Running tests
106+
107+
```bash
108+
# Run unit tests
109+
pytest -xvs tests/ -k "not test_integration"
110+
111+
# Run integration tests (requires API key)
112+
export CATALYST_API_KEY=your_api_key
113+
pytest -xvs tests/ --run-integration
114+
115+
```
116+
117+
## Contributing
118+
119+
Contributions are welcome! Please feel free to submit a Pull Request.
120+
121+
1. Fork the repository
122+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
123+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
124+
4. Push to the branch (`git push origin feature/amazing-feature`)
125+
5. Open a Pull Request
126+
127+
## Support
128+
129+
For support or feature requests, please create an issue on the GitHub repository or contact PRODAFT.
130+
131+
## License
132+
133+
Distributed under the MIT License. See `LICENSE` for more information.

pyproject.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[build-system]
2+
requires = ["setuptools>=42", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[tool.pytest]
6+
testpaths = ["tests"]
7+
python_files = "test_*.py"
8+
addopts = ""
9+
markers = [
10+
"integration: marks tests as integration tests (deselect with '-k \"not test_integration\"')",
11+
]
12+
13+
[tool.black]
14+
line-length = 88
15+
target-version = ['py38', 'py39', 'py310', 'py311']
16+
include = '\.pyi?$'
17+
18+
[tool.isort]
19+
profile = "black"
20+
multi_line_output = 3

pytest.ini

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[pytest]
2+
testpaths = tests
3+
python_files = test_*.py
4+
python_classes = Test*
5+
python_functions = test_*
6+
addopts = --verbose
7+
markers =
8+
unit: Unit tests
9+
integration: Integration tests

python_catalyst/__init__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""
2+
PRODAFT CATALYST API client package.
3+
"""
4+
5+
__version__ = "0.1.0"
6+
7+
from .client import CatalystClient
8+
from .enums import ObservableType, PostCategory, TLPLevel
9+
from .stix_converter import StixConverter
10+
11+
__all__ = [
12+
"CatalystClient",
13+
"StixConverter",
14+
"ObservableType",
15+
"PostCategory",
16+
"TLPLevel",
17+
]

0 commit comments

Comments
 (0)