ChaosProxy
#python#automation#microsaas
Bulletproof your architecture with ChaosProxy, the elite chaos engineering proxy. Effortlessly inject latency, dropped packets, and API failures to expose critical vulnerabilities before your users do. Empower your team to automate resilience, maximize uptime, and deploy fault-tolerant distributed systems with absolute confidence. Don’t fear the outage—master the chaos today.
Read the technical deep-diveHardening Distributed Python Systems with ChaosProxymain.pymain.py — sample excerpt in the tool's style
#!/usr/bin/env python3
"""
ChaosProxy - Elite Chaos Engineering Proxy for Distributed Resilience.
ChaosProxy intercepts HTTP/S traffic to simulate network instability, API
failures, and latency spikes, enabling proactive vulnerability detection.
Features:
- Configurable latency injection and artificial jitter
- Dynamic HTTP response status code mutation (e.g., 500, 502, 503, 429)
- Probabilistic TCP connection drops and packet truncation
- Automated rule evaluation via JSON-based chaos profiles
- Zero-dependency deployment utilizing pure Python standard library
Usage:
$ python main.py --host 127.0.0.1 --port 8080 --config chaos_rules.json
"""
import asyncio
import enum
import json
import logging
import random
import time
from dataclasses import dataclass, field
from typing import Dict, List, Optional, Tuple
# Configure system logging
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s")
logger = logging.getLogger("ChaosProxy")
@enum.unique
class FaultType(str, enum.Enum):
"""Supported chaos fault injection modalities."""
LATENCY = "latency"
HTTP_ERROR = "http_error"
DROP_CONNECTION = "drop_connection"
CORRUPT_BODY = "corrupt_body"
@dataclass(frozen=True)
class ChaosRule:
"""Targeting rule defining fault type, probability, and parameters."""
fault_type: FaultType
probability: float
delay_seconds: float = 0.0
status_code: int = 500
path_pattern: str = "*"
class ChaosProxy:
"""Core asynchronous TCP/HTTP proxy engine for fault injection."""
# ... the full file ships with your download