Skip to main content

Qriton Shield

Real-time IP threat intelligence with Modern Hopfield Networks. Detect and block malicious IPs with AI-powered anomaly detection, a 4-tier response system, and a global network of Shields.

Installation

pip install qriton-shield

Quick Start

from datetime import datetime
from qriton_shield import Shield, HttpRequest

shield = Shield()
shield.start()

# Process an HTTP request
result = shield.process_request(HttpRequest(
    timestamp=datetime.now(),
    client_ip="192.168.1.100",
    method="GET",
    url="/api/data",
    status_code=200,
    bytes_sent=1024,
    bytes_received=256,
    user_agent="Mozilla/5.0",
))

print(f"Decision: {result.decision}")  # allow | rate_limit | challenge | block
print(f"Tier: {result.tier}")          # 0-3
print(f"Threat Score: {result.threat_score}")
print(f"Anomaly Score: {result.anomaly_score}")

shield.stop()

Features

  • Modern Hopfield Networks — Continuous Hopfield Network with LogSumExp energy function for exponential-capacity anomaly detection
  • 20-Feature Analysis — Network (L4), application (L7), and malware (V2) traffic features with gradient-based attribution
  • 4-Tier Response — Allow (0-30) -> Rate Limit (30-60) -> Challenge (60-80) -> Block (80+)
  • Adaptive Threat Modes — relaxed / balanced / aggressive / lockdown with auto-escalation
  • Web Application Firewall — OWASP Top 10 pattern detection (SQLi, XSS, path traversal, command injection)
  • Cross-Platform Firewall — Windows routes, Linux iptables, macOS pfctl
  • Subnet Velocity Detection — Auto-aggregate /24 blocks for coordinated attacks
  • Challenge/Trust System — Behavioral verification with trust tokens
  • Night Mode — Automatic minimum protection during off-hours
  • Geographic Fencing — Country-based blocking with risk multipliers
  • Threat Intelligence — Spamhaus, Firehol, AbuseIPDB integration
  • CDN Whitelist — Cloudflare, AWS CloudFront, Google, Fastly auto-whitelisted
  • Federated Learning — Cross-shield Hopfield model sharing
  • Data Exfiltration Detection — Credit cards, SSNs, API keys, private keys
  • Troll Mode — Rickrolls, tarpits, honeypots, fake vulnerabilities
  • MCP Guard — Firewall for Claude MCP tool calls (prompt injection detection)
  • Hash-Chain Audit Log — Tamper-evident decision trail for compliance
  • 7-Layer Pipeline (v2) — Network, Transport, Identity, Capability, Semantic, State, Collective

CLI

# Start Shield server
shield -m balanced -p 8765

# Start with config file
shield -c settings.json

# Monitor a log file
shield -l /var/log/nginx/access.log

# Security audit
shield audit

# Version
shield version

API

from qriton_shield import Shield, ShieldConfig, NightModeConfig

# Full configuration
config = ShieldConfig(
    threat_mode="balanced",
    state_path="shield_state.json",
    night_mode=NightModeConfig(enabled=True, start_hour=22, end_hour=6, minimum_mode="balanced"),
)

shield = Shield(config)
shield.on("block", lambda d: print(f"Blocked {d['ip']}: {d['reason']}"))
shield.on("anomaly", lambda d: print(f"Anomaly score: {d['score']:.1f}"))
shield.start()

Hopfield Network (standalone)

from qriton_shield import ContinuousHopfieldNetwork

net = ContinuousHopfieldNetwork(20, beta=1.0)
net.train([pattern1, pattern2, pattern3])
result = net.recall(noisy_input)
print(f"Energy: {result.final_energy}, Converged: {result.converged}")

WAF

from qriton_shield import WafEngine

waf = WafEngine()
match = waf.check("/search?q=1' UNION SELECT * FROM users--")
if match:
    print(f"WAF: {match.category} ({match.rule_name}), score={match.score}")

MCP Guard

from qriton_shield import MCPGuard

guard = MCPGuard()
result = guard.check_tool_call("filesystem_write", {"path": "/etc/passwd", "content": "..."})
if not result["allowed"]:
    print(f"Blocked: {result['reason']}")

Geographic Fencing

from qriton_shield import GeoFencing, GeoConfig

geo = GeoFencing(GeoConfig(
    enabled=True,
    whitelist=["US", "DE", "GB"],
    high_risk_countries=["CN", "RU", "KP"],
))
info = geo.check_ip("8.8.8.8")
print(f"Country: {info['country']}, High Risk: {info['is_high_risk']}")

Threat Modes

Mode Anomaly Threshold SYN Timeout HTTP RPM Limit
relaxed 0.8 60s 500
balanced 0.6 45s 300
aggressive 0.4 10s 100
lockdown 0.2 5s 30

Architecture

HTTP Request
    |
    v
[Whitelist Check] --> bypass if CDN/known-good
    |
[Threat Scoring] --> L4 + L7 + credential stuffing + rate acceleration
    |
[Hopfield AI] --> 20-feature anomaly detection with explainability
    |
[4-Tier Response]
    |-- Tier 0: Allow (score < 30)
    |-- Tier 1: Rate Limit (30-60)
    |-- Tier 2: Challenge (60-80)
    |-- Tier 3: Block (80+)
    |
[Auto Mode Switch] --> escalate/deescalate based on block rate

Requirements

  • Python >= 3.10
  • No external dependencies (pure Python)

Links

License

Apache-2.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qriton_shield-3.3.0.tar.gz (49.8 kB view details)

Uploaded Source

Built Distribution

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

qriton_shield-3.3.0-py3-none-any.whl (63.2 kB view details)

Uploaded Python 3

File details

Details for the file qriton_shield-3.3.0.tar.gz.

File metadata

  • Download URL: qriton_shield-3.3.0.tar.gz
  • Upload date:
  • Size: 49.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for qriton_shield-3.3.0.tar.gz
Algorithm Hash digest
SHA256 a4d71bf1c0448128ef2f634b20726b1df6fb72c95b915dbafed244f7371c8977
MD5 c8b2066a2565c92de7eab5c26adcea6b
BLAKE2b-256 7755aa6b8b53139b3621e328b49358d1463b3d4c502071300c0b09b4b79ab280

See more details on using hashes here.

File details

Details for the file qriton_shield-3.3.0-py3-none-any.whl.

File metadata

  • Download URL: qriton_shield-3.3.0-py3-none-any.whl
  • Upload date:
  • Size: 63.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for qriton_shield-3.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cd8dd00f0fc2150bbfaaf769828007a22c66f4b71c6fd4a84c29b738ee297363
MD5 934def43c4d4e4c65621194e414fd42d
BLAKE2b-256 475d1e66d6fdf13fa29c9820ce8c8048c7a666f73788547ddccf0d67f86a8fbf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page