Sploitus

Exploit for Ai-Vulnerability-Code-Detector

githubexploit Β· 2026-08-14

Exploit Code

README214 lines
## https://sploitus.com/exploit?id=8106D700-6C4F-5341-9647-A312A720C8ED
# AI-Powered Vulnerability Scanner

A comprehensive security scanning tool that uses artificial intelligence to detect vulnerabilities in code repositories. The scanner combines static analysis, dynamic testing, and AI-powered reasoning to identify security issues across multiple vulnerability types.

## Features

- **AI-Powered Analysis**: Uses LLMs to understand code context and identify complex vulnerabilities
- **Multiple Vulnerability Types**: Detects SQL injection, XSS, path traversal, race conditions, integer overflows, logic flaws, and more
- **Repository Scanning**: Analyzes GitHub repositories for security issues
- **Exploit Generation**: Creates proof-of-concept exploits for discovered vulnerabilities
- **RESTful API**: Easy integration with other tools and services
- **Modern Frontend**: React-based UI for viewing scan results and managing scans
- **Database Storage**: Persistent storage of scan results and vulnerability data

## Technologies Used

### Backend
- **Python 3.13**: Core programming language
- **FastAPI**: High-performance web framework
- **SQLAlchemy**: ORM for database operations
- **Pydantic**: Data validation and settings management
- **OpenAI GPT-4**: AI-powered reasoning and analysis
- **LangChain**: Framework for LLM applications
- **Stable Baselines3**: Reinforcement learning for exploit generation
- **Python-Multipart**: Handling file uploads
- **Python-JOSE**: JWT implementation for authentication
- **Passlib**: Password hashing
- **Tenacity**: Retrying mechanism
- **GitPython**: Git repository interaction

### Frontend
- **React 18**: JavaScript library for building user interfaces
- **React Router**: Declarative routing for React applications
- **Tailwind CSS**: Utility-first CSS framework
- **Framer Motion**: Animation library for React
- **Recharts**: Charting library built on React
- **Axios**: Promise-based HTTP client
- **React Dropzone**: Drag-and-drop file uploads
- **React Hot Toast**: Notification system
- **Lucide React**: Beautiful icons
- **Headless UI**: Unstyled, accessible UI components
- **Heroicons**: SVG icons

## Project Structure

```
Aivulnerabilitycode/
β”œβ”€β”€ backend/                  # Python/FastAPI backend
β”‚   β”œβ”€β”€ app/                  # Main application code
β”‚   β”‚   β”œβ”€β”€ api/              # API route definitions
β”‚   β”‚   β”œβ”€β”€ ai/               # AI reasoning components
β”‚   β”‚   β”œβ”€β”€ core/             # Core vulnerability detection logic
β”‚   β”‚   β”œβ”€β”€ models/           # Database models
β”‚   β”‚   β”œβ”€β”€ services/         # Business logic services
β”‚   β”‚   └── utils/            # Utility functions
β”‚   β”œβ”€β”€ data/                 # Persistent data storage
β”‚   β”œβ”€β”€ .env.example          # Environment variables template
β”‚   β”œβ”€β”€ requirements.txt      # Python dependencies
β”‚   └── README.md             # Backend-specific documentation
β”œβ”€β”€ frontend/                 # React frontend
β”‚   β”œβ”€β”€ public/               # Static assets
β”‚   β”‚   └── hero-bg.mp4       # Background video
β”‚   β”œβ”€β”€ src/                  # Source code
β”‚   β”‚   β”œβ”€β”€ components/       # React components
β”‚   β”‚   β”œβ”€β”€ layouts/          # Page layouts
β”‚   β”‚   └── ...               # Other frontend files
β”‚   β”œβ”€β”€ package.json          # Node.js dependencies
β”‚   └── .gitignore            # Frontend-specific ignore rules
β”œβ”€β”€ .gitignore                # Root-level ignore rules
�└── docker-compose.yml        # Docker configuration (if applicable)
```

## Requirements

### Prerequisites
- Python 3.9+ (tested with 3.13)
- Node.js 18+ (for frontend development)
- XAMPP (with MySQL/MariaDB) or alternative MySQL database
- Git (for repository scanning)

### Backend Dependencies
Install the required Python packages:
```bash
pip install -r backend/requirements.txt
```

### Frontend Dependencies
Install the required Node.js packages:
```bash
cd frontend
npm install
```

## Configuration

### Environment Variables
Create a `.env` file in the backend directory based on the provided example:

```bash
cd backend
cp .env.example .env
```

Then edit the `.env` file to configure:
- Database connection details
- OpenAI API key (for AI features)
- Secret keys for session management
- Debug mode settings

### Database Setup
1. Start MySQL/MariaDB (via XAMPP or your preferred method)
2. Create the database: `CREATE DATABASE vuln_scanner;`
3. The application will automatically create the necessary tables on startup

## Installation

### Backend Setup
```bash
# Clone the repository
git clone 
cd Aivulnerabilitycode/backend

# Install dependencies
pip install -r requirements.txt

# Configure environment
cp .env.example .env
# Edit .env with your settings

# Start the server
python -m app.main
```

### Frontend Setup
```bash
# Navigate to frontend directory
cd ../frontend

# Install dependencies
npm install

# Start the development server
npm start
```

## Usage

### API Endpoints
Once the backend is running, the API will be available at `http://localhost:8000`:

- `GET /` - API health check
- `GET /health` - Detailed health status
- `POST /api/scan/github` - Start a new GitHub repository scan
- `GET /api/scan/status/{scan_id}` - Check scan progress
- `GET /api/results/{scan_id}` - Get detailed scan results
- `GET /api/history` - Get scan history

### Web Interface
Access the frontend at `http://localhost:3000` to:
- Submit repositories for scanning
- View scan progress and results
- Browse discovered vulnerabilities
- Examine generated exploit code
- Manage scan history

## How It Works

1. **Repository Acquisition**: The scanner clones the target GitHub repository to analyze
2. **Static Analysis**: Code is parsed and analyzed for common vulnerability patterns
3. **AI Reasoning**: LLMs analyze code context to identify complex, context-dependent vulnerabilities
4. **Dynamic Testing**: Generated exploits are tested against safe targets to confirm vulnerabilities
5. **Result Compilation**: Findings are compiled into detailed reports with severity ratings
6. **Exploit Generation**: Proof-of-concept code is created for each confirmed vulnerability

## Customization

### Adding New Vulnerability Checks
1. Extend the vulnerability models in `backend/app/models/`
2. Add detection logic in `backend/app/core/`
3. Update the AI reasoning prompts in `backend/app/ai/`
4. Add API endpoints in `backend/app/api/` if needed

### Configuration Options
Adjust settings in `.env`:
- `OPENAI_API_KEY`: Your OpenAI API key for AI features
- `DEBUG`: Set to `False` in production
- `MAX_UPLOAD_SIZE`: Maximum file size for uploads (default: 100MB)
- `SECRET_KEY`: Secret key for session management (change in production)

## Future Improvements

- [ ] Support for additional version control systems (GitLab, Bitbucket)
- [ ] Scheduled automated scanning
- [ ] Integration with CI/CD pipelines
- [ ] Enhanced reporting formats (PDF, HTML, XML)
- [ ] User authentication and role-based access control
- [ ] Docker containerization for easier deployment
- [ ] Kubernetes deployment manifests
- [ ] Additional AI models for specialized vulnerability types

## License

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

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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