

Note: This guide demonstrates how to build a unified AI-powered security integration between CrowdStrike Falcon and Zscaler platforms. The code uses actual API patterns from both vendors. You'll need valid accounts with both providers.
| Service | Required Access | How to Obtain |
|---|---|---|
| CrowdStrike Falcon | API Client ID & Secret (OAuth2) | Falcon Console → Support → API Clients |
| Zscaler | API Key & Cloud Name | Zscaler Admin Portal → Administration → API Keys |
| OpenAI (for AI correlation) | API Key | platform.openai.com → API Keys |
# Python 3.10+ required
python3 --version # Should be 3.10+
# Node.js 18+ for TypeScript examples
node --version # Should be 18+
# Git for version control
git --version
CrowdStrike API Scopes:
event_streams:read - Real-time detection eventshosts:read - Host inventoryintel:read - Threat intelligenceincidents:read - Incident managementZscaler API Permissions:
logs:read - Security logspolicy:read - Policy configurationusers:read - User activity# Create virtual environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Upgrade pip
pip install --upgrade pip
# Install required packages
pip install \
httpx==0.27.0 \
pydantic==2.7.1 \
pydantic-settings==2.3.3 \
python-dotenv==1.0.1 \
openai==1.30.1 \
tenacity==8.2.3 \
structlog==24.1.0 \
prometheus-client==0.19.0 \
fastapi==0.110.1 \
uvicorn==0.29.0
# Development dependencies
pip install pytest==8.2.0 pytest-asyncio==0.23.3 pytest-mock==3.14.0 ruff==0.4.4
# Initialize project
mkdir crowedstrike-zscaler-integration
cd crowedstrike-zscaler-integration
npm init -y
# Install production dependencies
npm install \
axios@1.7.2 \
zod@3.23.8 \
dotenv@16.4.5 \
openai@4.56.0 \
pino@9.1.0 \
pino-pretty@11.2.2 \
prom-client@15.1.3 \
fastify@4.28.1
# Install development dependencies
npm install -D \
typescript@5.5.4 \
@types/node@20.14.10 \
tsx@4.16.2 \
vitest@2.0.4 \
@vitest/coverage-v8@2.0.4 \
eslint@9.8.0 \
@typescript-eslint/eslint-plugin@8.0.0 \
@typescript-eslint/parser@8.0.0
// tsconfig.json
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"lib": ["ES2022"],
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"declaration": true,
"declarationMap": true,
"sourceMap": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}
# src/config.py
"""Centralized configuration management with validation."""
from functools import lru_cache
from pydantic import Field, field_validator
from pydantic_settings import BaseSettings, SettingsConfigDict
from typing import Literal
class CrowdStrikeConfig(BaseSettings):
"""CrowdStrike Falcon API configuration."""
model_config = SettingsConfigDict(env_prefix="CROWDSTRIKE_", extra="ignore")
client_id: str = Field(..., description="OAuth2 Client ID")
client_secret: str = Field(..., description="OAuth2 Client Secret")
base_url: str = Field(
default="https://api.crowdstrike.com",
description="API base URL (use us-1, us-2, eu-1, laggar.gcw.crowdstrike.com for GovCloud)"
)
cloud: Literal["us-1", "us-2", "eu-1", "us-gov-1"] = Field(default="us-1")
@property
def token_url(self) -> str:
return f"{self.base_url}/oauth2/token"
@property
def api_base(self) -> str:
return f"{self.base_url}"
class ZscalerConfig(BaseSettings):
"""Zscaler API configuration."""
model_config = SettingsConfigDict(env_prefix="ZSCALER_", extra="ignore")
api_key: str = Field(..., description="Zscaler API Key")
cloud: Literal["zscaler", "zscalertwo", "zscalerthree", "zscalerbeta", "gov"] = Field(
default="zscaler",
description="Zscaler cloud instance"
)
username: str | None = Field(default=None, description="Admin username (for legacy auth)")
password: str | None = Field(default=None, description="Admin password (for legacy auth)")
@property
def base_url(self) -> str:
cloud_urls = {
"zscaler": "https://zsapi.zscaler.net",
"zscalertwo": "https://zsapi.zscalertwo.net",
"zscalerthree": "https://zsapi.zscalerthree.net",
"zscalerbeta": "https://zsapi.zscalerbeta.net",
"gov": "https://zsapi.zscaler.net", # GovCloud uses same endpoint
}
return cloud_urls[self.cloud]
class AIConfig(BaseSettings):
"""AI/LLM configuration for threat correlation."""
model_config = SettingsConfigDict(env_prefix="AI_", extra="ignore")
openai_api_key: str = Field(..., description="OpenAI API Key")
model: str = Field(default="gpt-4o-mini", description="Model for correlation")
max_tokens: int = Field(default=2000, description="Max tokens per request")
temperature: float = Field(default=0.1, description="Low temperature for consistency")
class AppConfig(BaseSettings):
"""Main application configuration."""
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore")
# Sub-configurations
crowdstrike: CrowdStrikeConfig = Field(default_factory=CrowdStrikeConfig)
zscaler: ZscalerConfig = Field(default_factory=ZscalerConfig)
ai: AIConfig = Field(default_factory=AIConfig)
# Application settings
log_level: str = Field(default="INFO")
metrics_port: int = Field(default=9090)
api_port: int = Field(default=8080)
correlation_window_minutes: int = Field(default=15)
max_concurrent_requests: int = Field(default=10)
@lru_cache
def get_config() -> AppConfig:
"""Get cached configuration instance."""
return AppConfig()
# src/clients/crowdstrike.py
"""CrowdStrike Falcon API client with OAuth2 authentication and retry logic."""
import asyncio
import time
from dataclasses import dataclass
from typing import Any
from urllib.parse import urljoin
import httpx
import structlog
from tenacity import (
retry,
retry_if_exception_type,
stop_after_attempt,
wait_exponential_jitter,
)
from config import get_config
logger = structlog.get_logger(__name__)
@dataclass
class TokenCache:
"""Thread-safe token cache with expiration tracking."""
access_token: str | None = None
expires_at: float = 0
_lock: asyncio.Lock = asyncio.Lock()
async def get_token(self) -> str | None:
async with self._lock:
if self.access_token and time.time() < self.expires_at - 60: # 60s buffer
return self.access_token
return None
async def set_token(self, token: str, expires_in: int) -> None:
async with self._lock:
self.access_token = token
self.expires_at = time.time() + expires_in
class CrowdStrikeClient:
"""
Async CrowdStrike Falcon API client.
Handles OAuth2 authentication, automatic token refresh, retries,
and rate limiting per CrowdStrike API guidelines.
"""
def __init__(self, config: Any | None = None):
self.config = config or get_config().crowdstrike
self._token_cache = TokenCache()
self._client: httpx.AsyncClient | None = None
self._semaphore: asyncio.Semaphore | None = None
async def __aenter__(self) -> "CrowdStrikeClient":
await self._ensure_client()
return self
async def __aexit__(self, *args: Any) -> None:
await self.close()
async def _ensure_client(self) -> None:
"""Initialize HTTP client with connection pooling."""
if self._client is None:
limits = httpx.Limits(
max_keepalive_connections=20,
max_connections=100,
keepalive_expiry=30.0
)
timeout = httpx.Timeout(30.0, connect=10.0)
self._client = httpx.AsyncClient(
limits=limits,
timeout=timeout,
headers={"User-Agent": "ICARAX-Security-Integration/1.0"}
)
self._semaphore = asyncio.Semaphore(
get_config().max_concurrent_requests
)
async def close(self) -> None:
"""Close HTTP client and clean up resources."""
if self._client:
await self._client.aclose()
self._client = None
@retry(
wait=wait_exponential_jitter(initial=1, max=30),
stop=stop_after_attempt(3),
retry=retry_if_exception_type((httpx.TimeoutException, httpx.NetworkError))
)
async def _get_access_token(self) -> str:
"""Obtain OAuth2 access token using client credentials flow."""
cached = await self._token_cache.get_token()
if cached:
return cached
await self._ensure_client()
assert self._client is not None
logger.info("requesting_new_oauth_token", cloud=self.config.cloud)
response = await self._client.post(
self.config.token_url,
data={
"client_id": self.config.client_id,
"client_secret": self.config.client_secret,
},
headers={"Content-Type": "application/x-www-form-urlencoded"},
)
response.raise_for_status()
token_data = response.json()
access_token = token_data["access_token"]
expires_in = token_data.get("expires_in", 1800) # Default 30 min
await self._token_cache.set_token(access_token, expires_in)
logger.info("oauth_token_obtained", expires_in=expires_in)
return access_token
async def _request(
self,
method: str,
endpoint: str,
**kwargs: Any
) -> httpx.Response:
"""Make authenticated API request with automatic token refresh."""
await self._ensure_client()
assert self._client is not None
assert self._semaphore is not None
async with self._semaphore:
token = await self._get_access_token()
headers = kwargs.pop("headers", {})
headers["Authorization"] = f"Bearer {token}"
url = urljoin(self.config.api_base + "/", endpoint.lstrip("/"))
try:
response = await self._client.request(
method, url, headers=headers, **kwargs
)
# Handle token expiration
if response.status_code == 401:
logger.warning("token_expired_refreshing", endpoint=endpoint)
self._token_cache.access_token = None # Force refresh
token = await self._get_access_token()
headers["Authorization"] = f"Bearer {token}"
response = await self._client.request(
method, url, headers=headers, **kwargs
)
response.raise_for_status()
return response
except httpx.HTTPStatusError as e:
logger.error(
"api_request_failed",
endpoint=endpoint,
status_code=e.response.status_code,
response_text=e.response.text[:500]
)
raise
# ==================== Detection/Event APIs ====================
async def get_detections(
self,
limit: int = 100,
offset: int = 0,
filter_query: str | None = None,
sort: str = "-created_timestamp"
) -> dict[str, Any]:
"""
Retrieve detection events from Falcon.
Args:
limit: Maximum results (max 5000)
offset: Pagination offset
filter_query: FQL filter (e.g., "severity:>='high'+created_timestamp:>'2024-01-01'")
sort: Sort field with direction prefix
"""
params = {"limit": min(limit, 5000), "offset": offset, "sort": sort}
if filter_query:
params["filter"] = filter_query
response = await self._request("GET", "/detects/queries/detects/v1", params=params)
return response.json()
async def get_detection_details(self, detection_ids: list[str]) -> dict[str, Any]:
"""Get detailed detection entities by IDs (max 100 per request)."""
if not detection_ids:
return {"resources": []}
# Chunk into batches of 100
all_resources = []
for i in range(0, len(detection_ids), 100):
batch = detection_ids[i:i + 100]
response = await self._request(
"POST",
"/detects/entities/summaries/GET/v1",
json={"ids": batch}
)
all_resources.extend(response.json().get("resources", []))
return {"resources": all_resources}
# ==================== Host/Device APIs ====================
async def get_hosts(
self,
limit: int = 100,
offset: int = 0,
filter_query: str | None = None
) -> dict[str, Any]:
"""Query host/device inventory."""
params = {"limit": min(limit, 5000), "offset": offset}
if filter_query:
params["filter"] = filter_query
response = await self._request("GET", "/devices/queries/devices/v1", params=params)
return response.json()
async def get_host_details(self, device_ids: list[str]) -> dict[str, Any]:
"""Get detailed host information."""
if not device_ids:
return {"resources": []}
all_resources = []
for i in range(0, len(device_ids), 100):
batch = device_ids[i:i + 100]
response = await self._request(
"POST",
"/devices/entities/devices/v2",
json={"ids": batch}
)
all_resources.extend(response.json().get("resources", []))
return {"resources": all_resources}
# ==================== Threat Intelligence APIs ====================
async def get_intel_indicators(
self,
limit: int = 100,
filter_query: str | None = None
) -> dict[str, Any]:
"""Query threat intelligence indicators."""
params = {"limit": min(limit, 5000)}
if filter_query:
params["filter"] = filter_query
response = await self._request("GET", "/intel/queries/indicators/v1", params=params)
return response.json()
async def get_indicator_details(self, indicator_ids: list[str]) -> dict[str, Any]:
"""Get detailed threat intelligence."""
if not indicator_ids:
return {"resources": []}
response = await self._request(
"POST",
"/intel/entities/indicators/GET/v1",
json={"ids": indicator_ids}
)
return response.json()
# ==================== Incident APIs ====================
async def get_incidents(
self,
limit: int = 100,
filter_query: str | None = None
) -> dict[str, Any]:
"""Query security incidents."""
params = {"limit": min(limit, 5000)}
if filter_query:
params["filter"] = filter_query
response = await self._request("GET", "/incidents/queries/incidents/v1", params=params)
return response.json()
async def get_incident_details(self, incident_ids: list[str]) -> dict[str, Any]:
"""Get detailed incident information."""
if not incident_ids:
return {"resources": []}
response = await self._request(
"POST",
"/incidents/entities/incidents/GET/v2",
json={"ids": incident_ids}
)
return response.json()
# Convenience function for simple scripts
async def create_crowdstrike_client() -> CrowdStrikeClient:
"""Create and initialize a CrowdStrike client."""
client = CrowdStrikeClient()
await client._ensure_client()
return client
# src/clients/zscaler.py
"""Zscaler API client with support for both API key and legacy authentication."""
import asyncio
import time
from dataclasses import dataclass
from typing import Any
from urllib.parse import urljoin
import httpx
import structlog
from tenacity import (
retry,
retry_if_exception_type,
stop_after_attempt,
wait_exponential_jitter,
)
from config import get_config
logger = structlog.get_logger(__name__)
@dataclass
class ZscalerSession:
"""Zscaler session with cookie-based authentication."""
jsession_id: str | None = None
obfuscated_api_key: str | None = None
expires_at: float = 0
_lock: asyncio.Lock = asyncio.Lock()
class ZscalerClient:
"""
Async Zscaler API client.
Supports both modern API key authentication (recommended) and
legacy username/password with API key obfuscation.
"""
def __init__(self, config: Any | None = None):
self.config = config or get_config().zscaler
self._session = ZscalerSession()
self._client: httpx.AsyncClient | None = None
self._semaphore: asyncio.Semaphore | None = None
async def __aenter__(self) -> "ZscalerClient":
await self._ensure_client()
await self.authenticate()
return self
async def __aexit__(self, *args: Any) -> None:
await self.close()
async def _ensure_client(self) -> None:
"""Initialize HTTP client."""
if self._client is None:
limits = httpx.Limits(max_keepalive_connections=10, max_connections=50)
timeout = httpx.Timeout(60.0, connect=15.0)
self._client = httpx.AsyncClient(
limits=limits,
timeout=timeout,
headers={"User-Agent": "ICARAX-Security-Integration/1.0"}
)
self._semaphore = asyncio.Semaphore(get_config().max_concurrent_requests)
async def close(self) -> None:
"""Close client and logout."""
if self._session.jsession_id:
await self.logout()
if self._client:
await self._client.aclose()
self._client = None
def _get_timestamp(self) -> int:
"""Get current timestamp in milliseconds."""
return int(time.time() * 1000)
def _obfuscate_api_key(self, api_key: str, timestamp: int) -> str:
"""
Obfuscate API key per Zscaler specification.
Algorithm: Take chars at index (n*2) where n = timestamp % 10
"""
n = timestamp % 10
result = []
for i in range(n, len(api_key), 2):
result.append(api_key[i])
return "".join(result)
@retry(
wait=wait_exponential_jitter(initial=2, max=30),
stop=stop_after_attempt(3),
retry=retry_if_exception_type((httpx.TimeoutException, httpx.NetworkError))
)
async def authenticate(self) -> None:
"""Authenticate with Zscaler API."""
await self._ensure_client()
assert self._client is not None
# Try API key authentication first (modern, recommended)
if self.config.api_key:
await self._authenticate_api_key()
elif self.config.username and self.config.password:
await self._authenticate_legacy()
else:
raise ValueError("No valid authentication credentials provided")
async def _authenticate_api_key(self) -> None:
"""Authenticate using API key (single request)."""
timestamp = self._get_timestamp()
obfuscated = self._obfuscate_api_key(self.config.api_key, timestamp)
payload = {
"apiKey": self.config.api_key,
"timestamp": timestamp,
"obfuscatedApiKey": obfuscated
}
logger.info("authenticating_with_api_key", cloud=self.config.cloud)
response = await self._client.post(
urljoin(self.config.base_url, "/api/v1/authenticatedSession"),
json=payload
)
response.raise_for_status()
# Extract session cookie
set_cookie = response.headers.get("Set-Cookie", "")
if "JSESSIONID" in set_cookie:
self._session.jsession_id = set_cookie.split("JSESSIONID=")[1].split(";")[0]
self._session.obfuscated_api_key = obfuscated
self._session.expires_at = time.time() + 3600 # 1 hour default
logger.info("api_key_authentication_successful")
else:
raise RuntimeError("Failed to obtain JSESSIONID from API key auth")
async def _authenticate_legacy(self) -> None:
"""Authenticate using username/password + API key (legacy)."""
timestamp = self._get_timestamp()
obfuscated = self._obfuscate_api_key(self.config.api_key or "", timestamp)
payload = {
"username": self.config.username,
"password": self.config.password,
"apiKey": self.config.api_key,
"timestamp": timestamp,
"obfuscatedApiKey": obfuscated
}
logger.info("authenticating_with_legacy_credentials")
response = await self._client.post(
urljoin(self.config.base_url, "/api/v1/authenticatedSession"),
json=payload
)
response.raise_for_status()
set_cookie = response.headers.get("Set-Cookie", "")
if "JSESSIONID" in set_cookie:
self._session.jsession_id = set_cookie.split("JSESSIONID=")[1].split(";")[0]
self._session.obfuscated_api_key = obfuscated
self._session.expires_at = time.time() + 3600
logger.info("legacy_authentication_successful")
else:
raise RuntimeError("Failed to obtain JSESSIONID from legacy auth")
async def logout(self) -> None:
"""Logout and invalidate session."""
if not self._session.jsession_id or not self._client:
return
try:
await self._client.delete(
urljoin(self.config.base_url, "/api/v1/authenticatedSession"),
cookies={"JSESSIONID": self._session.jsession_id}
)
logger.info("logged_out_successfully")
except Exception as e:
logger.warning("logout_failed", error=str(e))
finally:
self._session.jsession_id = None
self._session.expires_at = 0
def _get_auth_headers(self) -> dict[str, str]:
"""Get authentication headers/cookies for requests."""
if not self._session.jsession_id:
raise RuntimeError("Not authenticated. Call authenticate() first.")
# Check if session needs refresh
if time.time() > self._session.expires_at - 300: # 5 min buffer
# Session will be refreshed on next request
pass
return {"Cookie": f"JSESSIONID={self._session.jsession_id}"}
async def _request(
self,
method: str,
endpoint: str,
**kwargs: Any
) -> httpx.Response:
"""Make authenticated API request with session management."""
await self._ensure_client()
assert self._client is not None
assert self._semaphore is not None
async with self._semaphore:
# Ensure valid session
if not self._session.jsession_id or time.time() > self._session.expires_at - 60:
await self.authenticate()
headers = kwargs.pop("headers", {})
headers.update(self._get_auth_headers())
url = urljoin(self.config.base_url + "/", endpoint.lstrip("/"))
try:
response = await self._client.request(method, url, headers=headers, **kwargs)
# Handle session expiration
if response.status_code == 401:
logger.warning("session_expired_reauthenticating", endpoint=endpoint)
await self.authenticate()
headers.update(self._get_auth_headers())
response = await self._client.request(method, url, headers=headers, **kwargs)
response.raise_for_status()
return response
except httpx.HTTPStatusError as e:
logger.error(
"zscaler_api_failed",
endpoint=endpoint,
status_code=e.response.status_code,
response_text=e.response.text[:500]
)
raise
# ==================== Security Logs ====================
async def get_security_logs(
self,
start_time: int,
end_time: int | None = None,
limit: int = 1000,
filter_query: str | None = None
) -> dict[str, Any]:
"""
Retrieve security logs (Firewall, Web, DLP, etc.).
Args:
start_time: Start time in milliseconds since epoch
end_time: End time in milliseconds (default: now)
limit: Maximum logs to return
filter_query: Additional filter (e.g., "action:blocked")
"""
if end_time is None:
end_time = self._get_timestamp()
params = {
"startTime": start_time,
"endTime": end_time,
"pageSize": min(limit, 10000)
}
if filter_query:
params["filter"] = filter_query
response = await self._request("GET", "/api/v1/securityLogs", params=params)
return response.json()
async def get_firewall_logs(
self,
start_time: int,
end_time: int | None = None,
limit: int = 1000
) -> dict[str, Any]:
"""Retrieve firewall logs specifically."""
return await self.get_security_logs(start_time, end_time, limit, "logType:firewall")
async def get_web_logs(
self,
start_time: int,
end_time: int | None = None,
limit: int = 1000
) -> dict[str, Any]:
"""Retrieve web transaction logs."""
return await self.get_security_logs(start_time, end_time, limit, "logType:web")
async def get_dlp_logs(
self,
start_time: int,
end_time: int | None = None,
limit: int = 1000
) -> dict[str, Any]:
"""Retrieve DLP incident logs."""
return await self.get_security_logs(start_time, end_time, limit, "logType:dlp")
# ==================== Policy Management ====================
async def get_firewall_policies(self) -> dict[str, Any]:
"""Retrieve firewall policy rules."""
response = await self._request("GET", "/api/v1/firewallPolicies")
return response.json()
async def get_url_categories(self) -> dict[str, Any]:
"""Retrieve URL categories for policy reference."""
response = await self._request("GET", "/api/v1/urlCategories")
return response.json()
# ==================== User/Department Info ====================
async def get_users(self, limit: int = 100) -> dict[str, Any]:
"""Retrieve user inventory."""
response = await self._request("GET", "/api/v1/users", params={"pageSize": limit})
return response.json()
async def get_departments(self) -> dict[str, Any]:
"""Retrieve department/group structure."""
response = await self._request("GET", "/api/v1/departments")
return response.json()
# Convenience function
async def create_zscaler_client() -> ZscalerClient:
"""Create and authenticate a Zscaler client."""
client = ZscalerClient()
await client._ensure_client()
await client.authenticate()
return client
# src/ai/correlation_engine.py
"""AI-powered threat correlation between CrowdStrike and Zscaler events."""
import json
import hashlib
from dataclasses import dataclass, field
from datetime import datetime, timedelta
from typing import Any
from enum import Enum
import structlog
from openai import AsyncOpenAI
from pydantic import BaseModel, Field
from tenacity import retry, stop_after_attempt, wait_exponential_jitter
from config import get_config
logger = structlog.get_logger(__name__)
class Severity(str, Enum):
"""Unified severity levels."""
CRITICAL = "critical"
HIGH = "high"
MEDIUM = "medium"
LOW = "low"
INFO = "info"
class EventSource(str, Enum):
"""Event source identifiers."""
CROWDSTRIKE = "crowdstrike"
ZSCALER = "zscaler"
@dataclass
class NormalizedEvent:
"""Normalized security event from any source."""
event_id: str
source: EventSource
timestamp: datetime
severity: Severity
event_type: str
title: str
description: str
# Entity identifiers for correlation
host_ids: list[str] = field(default_factory=list)
user_ids: list[str] = field(default_factory=list)
ip_addresses: list[str] = field(default_factory=list)
domains: list[str] = field(default_factory=list)
file_hashes: list[str] = field(default_factory=list)
mitre_techniques: list[str] = field(default_factory=list)
# Raw data for reference
raw_data: dict[str, Any] = field(default_factory=dict)
def correlation_key(self) -> str:
"""Generate a key for deduplication."""
components = [
self.source.value,
self.event_type,
"|".join(sorted(self.host_ids)),
"|".join(sorted(self.user_ids)),
"|".join(sorted(self.ip_addresses)),
]
return hashlib.sha256("|".join(components).encode()).hexdigest()[:16]
class CorrelationResult(BaseModel):
"""AI correlation analysis result."""
correlated: bool = Field(description="Whether events are correlated")
confidence: float = Field(ge=0.0, le=1.0, description="Confidence score 0-1")
attack_narrative: str = Field(description="Human-readable attack story")
mitre_tactics: list[str] = Field(default_factory=list, description="MITRE ATT&CK tactics")
mitre_techniques: list[str] = Field(default_factory=list, description="MITRE ATT&CK techniques")
recommended_actions: list[str] = Field(default_factory=list, description="Recommended response actions")
risk_score: int = Field(ge=0, le=100, description="Overall risk score 0-100")
iocs_shared: list[str] = Field(default_factory=list, description="Shared IOCs between events")
class CorrelationEngine:
"""
AI-powered correlation engine for multi-source security events.
Uses LLMs to analyze relationships between CrowdStrike endpoint detections
and Zscaler network/cloud security events.
"""
def __init__(self, config: Any | None = None):
self.config = config or get_config().ai
self.client = AsyncOpenAI(api_key=self.config.openai_api_key)
self._prompt_template = self._build_prompt_template()
def _build_prompt_template(self) -> str:
return """You are a senior security analyst specializing in threat correlation across endpoint and network security platforms.
Analyze the following security events from two sources:
1. **CrowdStrike Falcon** (EDR/XDR) - Endpoint detection and response
2. **Zscaler** (SSE/CASB/SWG) - Network/cloud security
EVENTS TO CORRELATE
---
## Next Steps
1. **Get API Access** - Sign up at the official website
2. **Try the Examples** - Run the code snippets above
3. **Read the Docs** - Check official documentation
4. **Join Communities** - Discord, Reddit, GitHub discussions
5. **Experiment** - Build something cool!
## Further Reading
- [TechCrunch AI](https://techcrunch.com/category/artificial-intelligence/)
- [The Verge](https://www.theverge.com/technology)
- [Wired AI](https://www.wired.com/tag/artificial-intelligence/)
- [Medium AI](https://medium.com/topic/artificial-intelligence)
**Source:** [Dark Reading](<![CDATA[https://www.darkreading.com/endpoint-security/crowdstrike-ai-security-push-zscaler-deal]]>)
---
*Follow ICARAX for more AI insights and tutorials.*
