Skip to content

AI Shell is an intelligent, multi-modal command-line assistant that bridges the gap between natural language and complex shell operations. Powered by Large Language Models (LLMs), it translates your requests into executable commands, provides conversational guidance, and integrates with specialized tools like the Metasploit Framework.

License

Notifications You must be signed in to change notification settings

GizzZmo/Ai_shell

Β 
Β 

Repository files navigation

AI Shell πŸ€–

Your Intelligent Command-Line Copilot

License: MIT Python 3.9+ GitHub Release

CI Security Documentation Performance

Codecov CodeQL

GitHub issues GitHub pull requests GitHub stars

Transform natural language into powerful shell commands with AI

πŸš€ Quick Start β€’ πŸ“– Documentation β€’ 🀝 Contributing
πŸ› Issues β€’ πŸ“Š Workflow Status


Overview

AI Shell is an intelligent, multi-modal command-line assistant that bridges the gap between natural language and complex shell operations. Powered by Large Language Models (LLMs), it translates your requests into executable commands, provides conversational guidance, and integrates with specialized tools like the Metasploit Framework.

Whether you're a beginner learning the command line or a seasoned expert looking to accelerate your workflow, AI Shell adapts to your needs.

✨ Key Features

  • πŸ”„ Multi-Modal Architecture: Three distinct operating modes for different use cases
  • 🧠 Advanced LLM Integration: Support for both cloud (Gemini) and local (Ollama) models
  • πŸ”’ Security-First Design: Built-in command validation and user confirmation
  • πŸ’¬ Conversational Memory: Context-aware responses with chat history
  • πŸ› οΈ Tool Integration: Native support for penetration testing workflows
  • πŸ“Š Learning Capability: Feedback loop for continuous improvement

🎯 Operating Modes

1. Command Translator Mode

Transform natural language into precise shell commands.

> find all files larger than 100MB in my home directory
β†’ find ~ -type f -size +100M

2. AI Assistant Mode

Conversational partner for complex command-line tasks with explanations and guidance.

You: How can I check which processes are using the most memory?
Assistant: On Linux, you can use the 'ps' command combined with 'sort':

```bash
ps aux --sort=-%mem | head -n 10

This lists all running processes, sorts them by memory usage in descending order, and shows the top 10.


### 3. Metasploit Assistant Mode
Your personal cybersecurity expert with direct msfconsole integration.

Assistant: You can search for Log4j exploits using the 'search' command:

```bash
search cve:2021-44228

Would you like me to run this command for you?


## πŸš€ Quick Start

### Prerequisites

- **Python 3.9+** 
- **Metasploit Framework** (optional, for Metasploit mode)
- **Ollama** (optional, for local LLMs)

### Installation

#### Option 1: From Source (Recommended)

```bash
# Clone the repository
git clone https://github.com/GizzZmo/Ai_shell.git
cd Ai_shell

# Install dependencies
pip install -r requirements.txt

# Install the package
pip install -e .

Option 2: Using Setup Scripts

Linux/Mac:

chmod +x install.sh
./install.sh

Windows:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process
.\install.ps1

Configuration

  1. Copy the example configuration:

    cp config.yaml.example config.yaml
  2. Set your API key (for Gemini):

    export GEMINI_API_KEY="your_api_key_here"
  3. For local LLMs, install Ollama:

    # Install Ollama (Linux)
    curl -fsSL https://ollama.ai/install.sh | sh
    
    # Pull a model
    ollama pull llama3

Usage

# Interactive mode selection
ai-shell

# Direct modes
ai-shell --mode translator
ai-shell --mode assistant 
ai-shell --mode metasploit

# Specify provider
ai-shell --provider local
ai-shell --provider gemini --api-key your_key

# Use custom config
ai-shell --config myconfig.yaml

πŸ“– Documentation

Configuration

The config.yaml file allows you to customize AI Shell's behavior:

llm:
  provider: gemini  # or 'local'
  gemini:
    api_key: ""
    model: gemini-1.5-flash
  local:
    host: localhost
    port: 11434
    model: llama3

security:
  require_confirmation: true
  dangerous_commands:
    - rm -rf
    - format
    - dd if=

logging:
  level: INFO
  file: ai_shell.log

Environment Variables

  • GEMINI_API_KEY: Your Google Gemini API key
  • AI_SHELL_CONFIG: Path to custom configuration file

Security Features

  • Command Validation: Blocks dangerous commands
  • User Confirmation: Requires approval before execution
  • Input Sanitization: Protects against command injection
  • Configurable Restrictions: Customizable safety lists

πŸ”§ Development

Project Structure

ai_shell/
β”œβ”€β”€ ai_shell/           # Main package
β”‚   β”œβ”€β”€ main.py         # Application entry point
β”‚   β”œβ”€β”€ config.py       # Configuration management
β”‚   β”œβ”€β”€ llm.py          # LLM integration
β”‚   β”œβ”€β”€ executor.py     # Command execution and security
β”‚   └── ui.py           # User interface utilities
β”œβ”€β”€ tests/              # Test suite
β”œβ”€β”€ docs/               # Documentation (coming soon)
β”œβ”€β”€ setup.py            # Package setup
└── requirements.txt    # Dependencies

Testing

# Install development dependencies
pip install pytest pytest-cov black flake8

# Run all tests
python -m pytest

# Run with coverage
python -m pytest --cov=ai_shell

Code Style

# Format code
black ai_shell/ tests/

# Check style
flake8 ai_shell/ tests/

πŸ”’ Security

  • API Keys: Store securely using environment variables
  • Command Review: Always review before execution
  • Local LLMs: Consider for sensitive environments
  • Network Security: Be cautious with cloud providers

πŸ”„ CI/CD & Workflow System

AI Shell uses a comprehensive GitHub Actions workflow system to ensure code quality, security, and reliability:

πŸ› οΈ Automated Workflows

Continuous Integration (CI)

  • βœ… Multi-OS Testing: Tests run on Ubuntu, Windows, and macOS
  • βœ… Python Versions: Supports Python 3.9, 3.10, 3.11, and 3.12
  • βœ… Code Quality: Automated linting with flake8 and formatting checks with black
  • βœ… Test Coverage: pytest with coverage reporting to Codecov
  • βœ… Package Installation: Validates the package can be installed and used

Security Scanning

  • πŸ”’ CodeQL Analysis: Advanced code security scanning with extended queries
  • πŸ”’ Dependency Scanning: Automated vulnerability checks using Safety
  • πŸ”’ Secrets Detection: Trivy scans for exposed secrets in the codebase
  • πŸ”’ License Compliance: Verifies all dependencies use compatible licenses
  • πŸ”’ Scheduled Scans: Daily security checks to catch new vulnerabilities

Documentation

  • πŸ“– Markdown Validation: Ensures all documentation is syntactically correct
  • πŸ“– Link Checking: Validates internal and external links
  • πŸ“– Code Example Testing: Verifies Python code examples in documentation
  • πŸ“– Automated Deployment: Builds and deploys docs to GitHub Pages with MkDocs
  • πŸ“– Material Theme: Beautiful, searchable documentation site

Performance Monitoring

  • ⚑ Benchmark Tests: Measures performance of core components
  • ⚑ Memory Profiling: Tracks memory usage and detects leaks
  • ⚑ Response Time Monitoring: Ensures operations meet performance targets
  • ⚑ Weekly Runs: Regular performance regression testing

Release Automation

  • πŸš€ Automated Releases: Tag-based releases to GitHub and PyPI
  • πŸš€ Changelog Generation: Automatic changelog from git commits
  • πŸš€ Package Building: Builds and validates distribution packages
  • πŸš€ Pre-release Support: Handles alpha, beta, and RC releases

Smart Automation

  • 🏷️ Auto-labeling: Automatically labels issues and PRs based on content
  • 🏷️ Size Detection: Labels PRs by change size (XS, S, M, L, XL)
  • 🏷️ Component Detection: Labels based on changed files and components
  • πŸ“Š Status Dashboard: Daily workflow status reports and repository statistics

πŸ“Š Workflow Status

Check our Workflow Status Dashboard for real-time status of all workflows, or view the Actions tab for detailed run history.

πŸ”§ Running Workflows Locally

You can run tests and checks locally before pushing:

# Run tests
python -m pytest tests/ -v --cov=ai_shell

# Check code style
flake8 ai_shell/ tests/
black --check ai_shell/ tests/

# Run security checks
pip install safety
safety check

# Run performance benchmarks
python -m pytest tests/benchmarks/ --benchmark-only

🀝 Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

Quick Steps

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes with tests
  4. Submit a pull request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Google Gemini for powerful language model capabilities
  • Ollama community for local LLM support
  • Metasploit Framework for penetration testing integration

πŸ“ž Support


⚠️ Disclaimer: AI Shell executes system commands. Always review commands before execution and use appropriate security measures. The developers are not responsible for any damage caused by misuse of this tool.

You: ? search for exploits related to the log4j vulnerability

About

AI Shell is an intelligent, multi-modal command-line assistant that bridges the gap between natural language and complex shell operations. Powered by Large Language Models (LLMs), it translates your requests into executable commands, provides conversational guidance, and integrates with specialized tools like the Metasploit Framework.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 96.5%
  • PowerShell 1.9%
  • Shell 1.6%