animus-engine-sdk 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- animus_engine_sdk-1.0.0/AnimusCore_v1/QUICKSTART.md +243 -0
- animus_engine_sdk-1.0.0/AnimusCore_v1/animus_release.hpp +2548 -0
- animus_engine_sdk-1.0.0/LICENSE +21 -0
- animus_engine_sdk-1.0.0/MANIFEST.in +6 -0
- animus_engine_sdk-1.0.0/PKG-INFO +171 -0
- animus_engine_sdk-1.0.0/README.md +145 -0
- animus_engine_sdk-1.0.0/animus/AnimusCore_v1.dll +0 -0
- animus_engine_sdk-1.0.0/animus/__init__.py +15 -0
- animus_engine_sdk-1.0.0/animus/bindings.py +167 -0
- animus_engine_sdk-1.0.0/animus/core.py +29 -0
- animus_engine_sdk-1.0.0/animus/decorators.py +100 -0
- animus_engine_sdk-1.0.0/animus/shm.py +145 -0
- animus_engine_sdk-1.0.0/animus_engine_sdk.egg-info/PKG-INFO +171 -0
- animus_engine_sdk-1.0.0/animus_engine_sdk.egg-info/SOURCES.txt +17 -0
- animus_engine_sdk-1.0.0/animus_engine_sdk.egg-info/dependency_links.txt +1 -0
- animus_engine_sdk-1.0.0/animus_engine_sdk.egg-info/top_level.txt +1 -0
- animus_engine_sdk-1.0.0/pyproject.toml +54 -0
- animus_engine_sdk-1.0.0/setup.cfg +4 -0
- animus_engine_sdk-1.0.0/setup.py +74 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# Animus Core v1.0 -- Client Quickstart Guides
|
|
2
|
+
|
|
3
|
+
Four proof-of-concept quickstarts, one per way of consuming Animus Core.
|
|
4
|
+
Pick the one that matches your integration:
|
|
5
|
+
|
|
6
|
+
| Guide | For | Platform |
|
|
7
|
+
|---|---|---|
|
|
8
|
+
| [1. Python SDK](#1-python-sdk-pip-install) | Orchestrators, SOAR pipelines, scripting | Any (Windows/Linux/macOS) |
|
|
9
|
+
| [2. C++ single header](#2-c-single-header-embedded--in-process) | Embedding directly in a C++17 service, ultra-low-latency execution paths | Any (portable subset); Windows + MSVC for the full feature set |
|
|
10
|
+
| [3. Secure multi-tenant + mTLS](#3-secure-multi-tenant--mtls-transport) | Multiple isolated tenants, encrypted remote ingestion | Windows + MSVC |
|
|
11
|
+
| [4. Distributed cluster](#4-distributed-raft-lite-cluster) | High-availability, multi-node rule replication | Windows + MSVC |
|
|
12
|
+
|
|
13
|
+
All four PoCs below are real, runnable code paths already exercised in this
|
|
14
|
+
repo's own verification demos (see `AnimusCore_v1/BENCHMARKS.md` for the
|
|
15
|
+
measured numbers) -- not illustrative pseudocode.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 1. Python SDK (`pip install`)
|
|
20
|
+
|
|
21
|
+
Zero third-party Python dependencies (see `CLAUDE.md`) -- everything the
|
|
22
|
+
`animus` package imports is Python 3.8+ stdlib.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install animus-core
|
|
26
|
+
# or, from a source checkout:
|
|
27
|
+
pip install -e .
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
import animus
|
|
32
|
+
|
|
33
|
+
# 1. Bring up the native engine (a lock-free ring buffer + rule engine
|
|
34
|
+
# running in-process, no IPC).
|
|
35
|
+
engine = animus.AnimusBindings()
|
|
36
|
+
engine.init(buffer_capacity=1 << 16)
|
|
37
|
+
|
|
38
|
+
# 2. Register a declarative threshold rule: fire when event_id=500's
|
|
39
|
+
# metric_value exceeds 100.
|
|
40
|
+
engine.add_rule(
|
|
41
|
+
rule_id=1,
|
|
42
|
+
event_id=500,
|
|
43
|
+
threshold=100,
|
|
44
|
+
comparator=animus.RuleComparator.GREATER_THAN,
|
|
45
|
+
severity=5,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
# 3. Ingest telemetry -- never blocks; returns False if the ring is full.
|
|
49
|
+
engine.record_event(event_id=500, trace_id=1, metric_value=150)
|
|
50
|
+
|
|
51
|
+
# 4. Drain matched signals (a background persistence worker evaluates rules
|
|
52
|
+
# as events are logged -- see start_logging() below).
|
|
53
|
+
engine.start_logging("telemetry.log")
|
|
54
|
+
import time; time.sleep(0.05) # let the worker catch up
|
|
55
|
+
for signal in engine.poll_signals(max_count=32):
|
|
56
|
+
print(f"MATCH rule={signal.rule_id} event={signal.event_id} value={signal.metric_value}")
|
|
57
|
+
engine.stop_logging()
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Instrumenting existing code with `@animus.trace`:**
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
@animus.trace(event_id=42)
|
|
64
|
+
def call_downstream_api():
|
|
65
|
+
... # each call is recorded as one telemetry event (duration in ns)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Cross-process telemetry (no serialization step):**
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from animus import SharedTelemetryRing
|
|
72
|
+
ring = SharedTelemetryRing.create("my-shared-segment", capacity=65536)
|
|
73
|
+
# ... hand the segment name to a second process, which attaches with
|
|
74
|
+
# SharedTelemetryRing.attach("my-shared-segment") and reads zero-copy.
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
See `AnimusCore_v1/soar_orchestrator.py` for a full automated-response
|
|
78
|
+
pipeline built on this, and `AnimusCore_v1/shm_ipc_demo.py` for the
|
|
79
|
+
cross-process ring in action.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 2. C++ single header (embedded / in-process)
|
|
84
|
+
|
|
85
|
+
For an embedded or ultra-low-latency deployment, skip Python and ctypes
|
|
86
|
+
entirely: `animus_release.hpp` is one self-contained file -- drop it into
|
|
87
|
+
your project and `#include` it, no build step, no linking against a
|
|
88
|
+
separate `.dll`/`.so`.
|
|
89
|
+
|
|
90
|
+
```cpp
|
|
91
|
+
#include "animus_release.hpp"
|
|
92
|
+
|
|
93
|
+
int main() {
|
|
94
|
+
auto engine = animus::Engine::Create(1 << 16);
|
|
95
|
+
|
|
96
|
+
engine->add_rule(
|
|
97
|
+
/*rule_id=*/1, /*event_id=*/500, /*threshold=*/100,
|
|
98
|
+
static_cast<uint8_t>(animus::RuleComparator::GreaterThan),
|
|
99
|
+
/*severity=*/5);
|
|
100
|
+
|
|
101
|
+
engine->record(/*event_id=*/500, /*trace_id=*/1, /*value=*/150);
|
|
102
|
+
|
|
103
|
+
engine->start_persistence("telemetry.log");
|
|
104
|
+
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
|
105
|
+
|
|
106
|
+
animus::ThreatSignal sig{};
|
|
107
|
+
if (engine->poll_signals(&sig, 1) == 1) {
|
|
108
|
+
std::printf("MATCH rule=%u event=%u value=%llu\n",
|
|
109
|
+
sig.rule_id, sig.event_id, (unsigned long long)sig.metric_value);
|
|
110
|
+
}
|
|
111
|
+
engine->stop_persistence();
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Portable core + RBAC layer (animus::, animus::security::) compiles with
|
|
117
|
+
# any C++17 compiler -- Linux, macOS, or Windows with g++/clang -- and was
|
|
118
|
+
# verified with a real g++ (MinGW) build and run, not just a compile check:
|
|
119
|
+
g++ -std=c++17 -O2 -pthread poc.cpp -o poc
|
|
120
|
+
|
|
121
|
+
# Full feature set (adds animus::transport::, animus::cluster::) requires
|
|
122
|
+
# MSVC specifically, not just "Windows" -- Schannel/SSPI is Windows-only,
|
|
123
|
+
# and certificate loading additionally relies on an MSVC-only
|
|
124
|
+
# std::ifstream(std::wstring, ...) overload that MinGW/libstdc++ doesn't
|
|
125
|
+
# provide. animus_release.hpp gates those two sections on
|
|
126
|
+
# `defined(_WIN32) && defined(_MSC_VER)` (not just _WIN32) for exactly this
|
|
127
|
+
# reason -- building the single header with MinGW g++ on Windows still only
|
|
128
|
+
# gets you the portable core + RBAC layer, verified above, not a build error:
|
|
129
|
+
cl /std:c++17 /EHsc /O2 poc.cpp
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
`animus_release.hpp` is a **generated** file -- it is produced from the
|
|
133
|
+
four source headers (`animus.hpp`, `animus_security.hpp`,
|
|
134
|
+
`animus_transport.hpp`, `animus_cluster.hpp`) by `amalgamate.py`. If you're
|
|
135
|
+
working from this repo rather than a downloaded release, regenerate it
|
|
136
|
+
after touching any of the four sources:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
python amalgamate.py
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
See `AnimusCore_v1/execution_interop_demo.cpp` for a full broker/execution
|
|
143
|
+
integration built the same way (against the un-amalgamated headers).
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## 3. Secure multi-tenant + mTLS transport
|
|
148
|
+
|
|
149
|
+
For a deployment serving multiple isolated tenants over an untrusted
|
|
150
|
+
network link. Windows/MSVC only (Schannel-based).
|
|
151
|
+
|
|
152
|
+
```powershell
|
|
153
|
+
# Generate a demo CA + server/client leaf certificates (native Windows PKI
|
|
154
|
+
# cmdlets, no OpenSSL):
|
|
155
|
+
powershell -File AnimusCore_v1/generate_demo_certs.ps1
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
```cpp
|
|
159
|
+
#include "animus_release.hpp" // or animus_security.hpp + animus_transport.hpp
|
|
160
|
+
|
|
161
|
+
// Server side: verify a client cert, resolve it to an AccessToken, and
|
|
162
|
+
// route every call through RBAC + tenant isolation.
|
|
163
|
+
animus::security::TenantRegistry registry;
|
|
164
|
+
registry.create_tenant(/*tenant_id=*/42, 1 << 16);
|
|
165
|
+
animus::security::SecureTelemetryGateway gateway(registry);
|
|
166
|
+
|
|
167
|
+
animus::transport::TrustedRoot trust(ca_cert);
|
|
168
|
+
animus::transport::CertificateIdentityMap identity_map;
|
|
169
|
+
identity_map.add(L"animus-client-tenant-42", animus::security::AccessToken{42, /*principal_id=*/1, animus::security::Role::Operator});
|
|
170
|
+
|
|
171
|
+
// ... accept an mTLS connection (animus::transport::SecureChannel), verify
|
|
172
|
+
// the peer cert against `trust`, resolve its CN through `identity_map.resolve(cert, token)`,
|
|
173
|
+
// then dispatch each received WireFrame through `gateway.record(token, ...)`.
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Full working client + server: `AnimusCore_v1/secure_multitenancy_demo.cpp`
|
|
177
|
+
(RBAC/tenancy only) and `AnimusCore_v1/secure_transport_demo.cpp` (adds real
|
|
178
|
+
TLS 1.3 mutual auth over loopback TCP). Build/run:
|
|
179
|
+
|
|
180
|
+
```powershell
|
|
181
|
+
# From an "x64 Native Tools Command Prompt for VS":
|
|
182
|
+
cl /std:c++17 /EHsc /O2 AnimusCore_v1/secure_transport_demo.cpp
|
|
183
|
+
secure_transport_demo.exe
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## 4. Distributed Raft-lite cluster
|
|
189
|
+
|
|
190
|
+
For high-availability rule replication across multiple nodes, with no
|
|
191
|
+
gRPC/Protobuf dependency -- inter-node RPC reuses the same mTLS transport as
|
|
192
|
+
guide 3. Windows/MSVC only.
|
|
193
|
+
|
|
194
|
+
```powershell
|
|
195
|
+
# generate_demo_certs.ps1 also issues 3 cluster-node identities
|
|
196
|
+
# (animus-node-1/2/3):
|
|
197
|
+
powershell -File AnimusCore_v1/generate_demo_certs.ps1
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
```cpp
|
|
201
|
+
#include "animus_release.hpp" // or animus_cluster.hpp directly
|
|
202
|
+
|
|
203
|
+
using namespace animus::cluster;
|
|
204
|
+
|
|
205
|
+
PeerConfig p2{2, "10.0.0.2", 47902, L"animus-node-2"};
|
|
206
|
+
PeerConfig p3{3, "10.0.0.3", 47903, L"animus-node-3"};
|
|
207
|
+
|
|
208
|
+
auto engine = animus::Engine::Create(1 << 16);
|
|
209
|
+
engine->start_persistence("node1.log"); // required for rules to evaluate
|
|
210
|
+
|
|
211
|
+
RaftNode node(/*id=*/1, {p2, p3}, std::move(my_cert), trust, *engine, /*listen_port=*/47901);
|
|
212
|
+
node.start();
|
|
213
|
+
|
|
214
|
+
// From whichever node is currently leader (check node.is_leader()):
|
|
215
|
+
AddRuleCommand cmd{/*rule_id=*/1, /*event_id=*/500, /*threshold=*/100, /*comparator=*/0, /*severity=*/5};
|
|
216
|
+
NodeId leader_hint = 0;
|
|
217
|
+
if (node.propose(cmd, &leader_hint) == ProposeResult::Ok) {
|
|
218
|
+
// Committed to a majority; every node's local `engine` now has the rule.
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
`propose()` blocks until the command is committed to a majority (not just
|
|
223
|
+
accepted locally) -- see `AnimusCore_v1/BENCHMARKS.md`'s Phase 10 section
|
|
224
|
+
for measured write-latency and full-cluster convergence numbers. Full
|
|
225
|
+
3-node PoC with real failover: `AnimusCore_v1/cluster_demo.cpp`.
|
|
226
|
+
|
|
227
|
+
```powershell
|
|
228
|
+
cl /std:c++17 /EHsc /O2 AnimusCore_v1/cluster_demo.cpp
|
|
229
|
+
cluster_demo.exe
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Which guide should I start with?
|
|
235
|
+
|
|
236
|
+
- Building a Python-based SOAR/orchestration pipeline, or just scripting
|
|
237
|
+
against telemetry? **Guide 1.**
|
|
238
|
+
- Embedding directly in a latency-sensitive C++ service (e.g. an execution
|
|
239
|
+
path) with no Python/ctypes hop? **Guide 2.**
|
|
240
|
+
- Need per-tenant isolation and/or encrypted remote ingestion? **Guide 3**
|
|
241
|
+
(layers on top of Guide 2's engine).
|
|
242
|
+
- Need the rule set to survive a node failure? **Guide 4** (layers on top
|
|
243
|
+
of Guide 3's transport).
|