Modular firewall system for monitoring and blocking network/LLM requests.
pip install -e .Or install from the parent project:
pip install -e ../firewall_layerlogger.py- Logging setuprules.py- Firewall rules (block POST, allow localhost, etc.)observer.py- Request/LLM observation handlersfirewall.py- Main firewall context manager__init__.py- Public API
from firewall_layer import observe_extract_content
with observe_extract_content() as observations:
# Your code here
result = some_function()
# observations contains all network/LLM activityfrom firewall_layer import Firewall
from firewall_layer.rules import BlockPostRule, AllowLocalhostRule, FirewallRules
# Create custom rules
rules = FirewallRules([
BlockPostRule(), # Block all POST
AllowLocalhostRule(), # Allow localhost (overrides block)
])
with Firewall(rules=rules) as firewall:
# Your code
passBlockPostRule()- Blocks all POST requestsAllowLocalhostRule()- Allows requests to localhostBlockDomainRule(domains=['example.com'])- Blocks specific domains
- Monitors
requestslibrary calls - Monitors
aiohttpcalls (async) - Monitors LLM
invokecalls - Blocks requests based on rules
- Logs all activity to file
- Modular and extensible