Skip to main content

elizaOS Shell Plugin - Shell command execution with directory restrictions and history tracking

Project description

elizaOS Shell Plugin (Python)

A secure shell command execution plugin for elizaOS that allows agents to run terminal commands within a restricted directory with command history tracking.

Installation

pip install elizaos-plugin-shell

Features

  • Cross-platform support: Works on Linux, macOS, and Windows
  • Directory restriction: Commands are restricted to a specified directory for safety
  • Command filtering: Configurable list of forbidden commands
  • Timeout protection: Automatic termination of long-running commands
  • Command history: Tracks command execution history per conversation
  • File operation tracking: Monitors file creation, modification, and deletion
  • Type safe: Full type annotations with Pydantic models

Configuration

Set the following environment variables:

# Set the allowed directory (commands can only run here)
SHELL_ALLOWED_DIRECTORY=/path/to/safe/directory

# Optional: Set custom timeout in milliseconds (default: 30000)
SHELL_TIMEOUT=60000

# Optional: Add additional forbidden commands (comma-separated)
SHELL_FORBIDDEN_COMMANDS=rm,mv,cp,chmod,chown,shutdown,reboot

Usage

from elizaos_plugin_shell import ShellService, ShellConfig

# Load configuration
config = ShellConfig.from_env()

# Create service
service = ShellService(config)

# Execute a command
result = await service.execute_command("ls -la", conversation_id="conv-123")

if result.success:
    print(f"Output: {result.stdout}")
else:
    print(f"Error: {result.stderr}")

# Get command history
history = service.get_command_history("conv-123", limit=10)

# Clear history
service.clear_command_history("conv-123")

Security

The plugin enforces several security measures:

  1. Directory Restriction: All commands execute within SHELL_ALLOWED_DIRECTORY
  2. Forbidden Commands: Dangerous commands are blocked by default
  3. Path Traversal Protection: Blocks ../ and similar patterns
  4. No Shell Expansion: Commands execute without dangerous shell interpretation
  5. Timeout Protection: Commands auto-terminate after timeout

License

MIT

Project details


Download files

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

Source Distribution

elizaos_plugin_shell-2.0.0a5.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

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

elizaos_plugin_shell-2.0.0a5-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file elizaos_plugin_shell-2.0.0a5.tar.gz.

File metadata

  • Download URL: elizaos_plugin_shell-2.0.0a5.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for elizaos_plugin_shell-2.0.0a5.tar.gz
Algorithm Hash digest
SHA256 a95a3fafd22cfa409b3783784e8c4cebe83558baff007609b42bce2dc033b43d
MD5 90de39723b0fffcbcab7fe62158cea6c
BLAKE2b-256 3c1828d0c5c9d58e979826944e3273cb9a0f8f6ad74193065b0a522cf92ae92c

See more details on using hashes here.

File details

Details for the file elizaos_plugin_shell-2.0.0a5-py3-none-any.whl.

File metadata

File hashes

Hashes for elizaos_plugin_shell-2.0.0a5-py3-none-any.whl
Algorithm Hash digest
SHA256 5bd062903b2c63d416e80f3c2d11b6130d40e6e949894d3743a38ca6d7a0965e
MD5 f23f7b76416a909e9886d385dde736a3
BLAKE2b-256 d5de31dacf99fcfe950a7d6d05a3458df4208a5bd27723de6f3f53240e8380e4

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