Skip to content

A FastAPI-based service that analyzes Lua scripts for potential security risks, obfuscation and runs them in a Sandbox with a mocked lua engine specific API, automating the approval process for Lua-based applications.

Notifications You must be signed in to change notification settings

Stupidoodle/lua-auto-approve

Repository files navigation

Lua Script Analyzer

Tests codecov

A FastAPI-based service that analyzes Lua scripts for potential security risks and obfuscation.

Features

  • Detection of dangerous functions and potential security risks
  • Identification of obfuscated code
  • Analysis of script entropy
  • Testing environment with FatalityAPI mocks
  • Comprehensive test coverage

Installation

# Clone the repository
git clone https://github.com/Stupidoodle/lua-auto-approve.git
cd lua-auto-approve

# Install dependencies
pip install -r requirements.txt

Running Tests

# Run tests with coverage report
pytest --cov=./

# Run tests with verbose output
pytest -v

API Usage

The service provides a single endpoint for analyzing Lua scripts:

POST /analyze-script

Example using curl:

curl -X POST -F "file=@script.lua" http://localhost:8000/analyze-script

The response will indicate whether the script is approved or flagged:

{
    "status": "approved"
}

or

{
    "status": "flagged",
    "reason": "Contains dangerous function"
}

Project Structure

├── main.py                 # FastAPI application and core logic
├── tests/
│   ├── test_main.py       # Core functionality tests
│   ├── test_fatality_api_class.py  # API mock tests
│   └── test_main_integration.py    # Integration tests
└── .github/
    └── workflows/
        └── tests.yml      # GitHub Actions workflow

Contributing

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

About

A FastAPI-based service that analyzes Lua scripts for potential security risks, obfuscation and runs them in a Sandbox with a mocked lua engine specific API, automating the approval process for Lua-based applications.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published