Skip to main content

โšก ULTRON-AI: Advanced AI-powered code analysis with Chain of Thought and ReAct framework

Project description

Ultron AI

Advanced AI-powered security code analysis with no strings attached.

Ultron is a sophisticated, command-line static analysis tool that leverages Gemini models to identify security vulnerabilities in your codebase. It combines traditional static analysis techniques with advanced AI agent capabilities to deliver deep, context-aware insights.

License: GPL v3

๐Ÿ“‹ Requirements

  • Python 3.10 or higher
  • Gemini API key
  • Required Python packages (see requirements.txt)

๐Ÿš€ Quick Start

For Users (Recommended)

  1. Install from PyPI:

    pip install ultron-ai
    
  2. Configure API Key: Ultron requires a Google Gemini API key. Create a .env file in your project directory:

    # .env
    GEMINI_API_KEY="YOUR_GEMINI_API_KEY"
    

    Alternatively, export it as an environment variable (export GEMINI_API_KEY="...").

For Developers (Contributing)

  1. Clone the repository:

    git clone https://github.com/your-repo/ultron-ai.git
    cd ultron-ai
    
  2. Install in editable mode: This will install the package and its dependencies, allowing you to edit the code directly.

    pip install -e .
    
  3. Configure API Key: Follow the same instructions as for users by creating a .env file in the cloned project's root.

โœจ Features

  • Dual-Mode Analysis: Choose between a quick, comprehensive scan (review) or a deep, mission-driven investigation (autonomous-review).
  • Autonomous Agent with Tools: The autonomous-review mode unleashes a ReAct-based agent equipped with tools to read files, search the codebase, and execute shell commands to dynamically validate its findings.
  • Structured, Verifiable Output: The review mode enforces a strict JSON output, validated by Pydantic models. This ensures reliable, machine-readable results and supports conversion to the industry-standard SARIF format for CI/CD integration.

How to Use

Ultron is operated via the command line.

Mode 1: Comprehensive Review (will be deprecated)

Use the review command for a fast, comprehensive analysis of a file or project. It's ideal for getting a full picture of the codebase's health.

Basic Review of a single file:

python -m ultron.main_cli review -p path/to/your/file.py -l python

Review an entire directory recursively:

python -m ultron.main_cli review -p ./my-project/ -l javascript -r

Advanced Review with Deep Dive and SARIF Output: This command will perform the standard review, then use a specialized agent to try and improve the PoCs for findings, and finally output the results to a SARIF file for CI/CD integration.

python -m ultron.main_cli review -p ./app/ --deep-dive -o sarif > results.sarif

Mode 2: Autonomous Review (Power house of ultron)

Use the autonomous-review command to give the agent a specific, high-level goal. It's best for investigating a complex feature or hunting for a specific type of vulnerability.

Example Mission: Find and prove an RCE vulnerability.

python -m ultron.main_cli autonomous-review \
  -p ./vulnerable-app/ \
  -m "2.5-flash-05-20" \
  --mission "Your primary goal is to find a remote code execution (RCE) vulnerability. You must trace all user-controlled input to dangerous sinks like 'eval', 'exec', or 'subprocess.run'. You final report must include a working Proof of Concept."

The agent will log its entire thought process to a file in the logs/ directory.


How It Works: A Flow Diagram

review command: CLI Input -> Gather Files -> Generate Context (AST/LLM) -> Build Master Prompt -> engine.reviewer -> LLM (Gemini) -> JSON Response -> Pydantic Validation -> (Optional) engine.agent (Deep Dive) -> Filter Results -> Display/SARIF Output

autonomous-review:

                   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                   โ”‚ Start: Receive Code & Task โ”‚
                   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ–ผ
                   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                   โ”‚ Understand Code & Strategy โ”‚
                   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ–ผ
                   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                   โ”‚  More Analysis Needed?     โ”‚
                   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                           โ”‚            โ”‚
                          Yes           No
                           โ”‚            โ”‚
                           โ–ผ            โ–ผ
                   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                   โ”‚ Use Tools  โ”‚   โ”‚ Consolidate  โ”‚
                   โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                        โ–ผ                โ–ผ
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚ Vulnerability?  โ”‚   โ”‚ Final Report  โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                     โ”‚      โ”‚              โ–ผ
                     |      |            โ”Œโ”€โ”€โ”€โ”€โ”
                     |    No             โ”‚ Endโ”‚
                     |     |             โ””โ”€โ”€โ”€โ”€โ”˜
                    Yes    โ–ผ             
                     |    More Analysis 
                     |
                     |
                     |
                     |
                     โ–ผ
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚ Create & Verify PoC    โ”‚
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                 โ–ผ
         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ”‚ Confirmed?    โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜
               โ”‚    โ”‚
               |    |
               โ”‚    โ””โ”€โ”€โ”€โ”€โ”€> More Analysis
              Yes
               โ–ผ
     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
     โ”‚ Save & Continue or Go to   โ”‚
     โ”‚ Final Report if Max Turns  โ”‚
     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“‹ TODOs

  • Add support for Other Models
  • Improve code navigation for large codebases
  • Implement multi-step planning and reasoning
  • Test against a large open source codebase
  • Add basic documentation and examples

๐Ÿค Contributing

We welcome contributions from the security community! To contribute:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“œ License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

โš ๏ธ Disclaimer

Ultron is intended for educational and research purposes only. Always obtain proper authorization before testing any system for vulnerabilities. The authors are not responsible for any misuse of this tool.

Made with โค๏ธ by Vinay

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

ultron_ai-0.1.4.tar.gz (77.7 kB view details)

Uploaded Source

Built Distribution

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

ultron_ai-0.1.4-py3-none-any.whl (85.9 kB view details)

Uploaded Python 3

File details

Details for the file ultron_ai-0.1.4.tar.gz.

File metadata

  • Download URL: ultron_ai-0.1.4.tar.gz
  • Upload date:
  • Size: 77.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.4

File hashes

Hashes for ultron_ai-0.1.4.tar.gz
Algorithm Hash digest
SHA256 83e26160707a0c8f57cc67db8fbf63d409c27504541560998066019cd8f84789
MD5 1f08be86f246ba36d4d2499278761624
BLAKE2b-256 74d3d3f65724a32efee5c21cc6d318f1f388c3e0750e0542a6fa1da519b8898c

See more details on using hashes here.

File details

Details for the file ultron_ai-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: ultron_ai-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 85.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.4

File hashes

Hashes for ultron_ai-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a54d76d7f73b0b17d4e2c06d9b70cf909a812da3ef796fa055997c178dabf204
MD5 eb637648935d13c7f25689bbcb1c8057
BLAKE2b-256 6d1024c5ec98fc18d656be728f88efc4b6e8862944115d183964b320816715d5

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