| cmd | ||
| docker | ||
| internal | ||
| scripts | ||
| .env.template | ||
| .gitignore | ||
| build.sh | ||
| Dockerfile | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| README.md | ||
| setup.bash | ||
Nuclei Service
A demo service showcasing Nuclei vulnerability scanning capabilities.
Overview
This service provides a robust API for managing Nuclei vulnerability scans, template management, and result storage. It's designed to handle high-volume scanning operations while maintaining performance and reliability. The service includes a background worker for processing scans asynchronously and storing results in PostgreSQL.
Key Features
- REST API for scans and templates
- PostgreSQL storage
- Docker deployment
- Zap logging
- Demo vulnerable routes
- Configurable scans
- Async processing
- Status tracking
- Build automation
Requirements
- Go 1.21+
- PostgreSQL 12+
- Docker & Docker Compose
- Nuclei (for local dev)
Quick Start
- Clone and setup:
git clone https://github.com/danial2026/nuclei-service-demo.git
cd nuclei-service-demo
./setup.bash
- Configure your environment:
# Edit .env with your settings
vim .env
- Launch with Docker:
docker-compose up --build
Project Structure
.
├── cmd/ # Application entry points
├── internal/ # Private application code
│ ├── model/ # Data models
│ ├── repository/ # Database operations
│ ├── service/ # Business logic
│ └── server/ # HTTP server and handlers
├── docker/ # Docker-related files
├── scripts/ # Utility scripts
├── build.sh # Build script
├── setup.bash # Setup script
├── Dockerfile # Main service Dockerfile
└── docker-compose.yml # Docker Compose configuration
API Reference
Templates
List Templates
GET /api/v1/templates
Query Parameters:
tags: Filter by template tagsauthor: Filter by template authorseverity: Filter by severity leveltype: Filter by template type
Response:
[
{
"id": "string",
"name": "string",
"author": "string",
"tags": ["string"],
"severity": "string",
"type": "string",
"description": "string",
"created_at": "string",
"updated_at": "string"
}
]
Get Template Details
GET /api/v1/templates/{id}
Refresh Template Cache
POST /api/v1/templates/refresh
Scans
List Scans
GET /api/v1/scans
Query Parameters:
status: Filter by scan statustarget: Filter by target URLtemplate_id: Filter by template ID
Start New Scan
POST /api/v1/scans
Request:
{
"target": "string",
"template_ids": ["string"],
"tags": ["string"],
"options": {
"concurrency": 10,
"rate_limit": 100,
"timeout": 30,
"retries": 3,
"headless": false
}
}
Get Scan Results
GET /api/v1/scans/{id}/results
Demo Server
The service includes a demo server that exposes intentionally vulnerable endpoints for testing purposes. These endpoints simulate common security vulnerabilities and can be used to test the Nuclei scanner.
Vulnerable Endpoints
- Open Redirect
GET /vuln/openredirect?redirect=<url>
Vulnerable to open redirect attacks.
- Oracle Fatwire LFI
GET /vuln/lfi-fatwire?fn=<file_path>
Vulnerable to Local File Inclusion attacks.
- HiBoss RCE
GET /vuln/hiboss-rce?ip=<ip_address>
Vulnerable to Remote Command Execution via ping command.
- ThinkPHP Arbitrary File Write
GET /vuln/thinkphp-write?content=<content>
Vulnerable to arbitrary file write operations.
- Zyxel Unauthenticated LFI
GET /vuln/zyxel-lfi?path=<file_path>
Vulnerable to Local File Inclusion attacks.
- Nuxt.js XSS
GET /vuln/nuxt-xss?stack=<payload>
Vulnerable to Cross-Site Scripting (XSS) attacks.
- Sick-Beard XSS
GET /vuln/sickbeard-xss?pattern=<payload>
Vulnerable to Cross-Site Scripting (XSS) attacks.
- Fastjson Deserialization RCE
POST /vuln/fastjson-rce
Vulnerable to Remote Code Execution via JSON deserialization.
- BeyondTrust XSS
GET /vuln/beyondtrust-xss?input=<payload>
Vulnerable to Cross-Site Scripting (XSS) attacks.
- WordPress Brandfolder Open Redirect
GET /vuln/brandfolder-redirect?url=<redirect_url>
Vulnerable to open redirect attacks.
Warning
: These endpoints are intentionally vulnerable and should only be used in controlled testing environments. Do not expose the demo server to production or untrusted networks.
Development
- Setup:
./setup.bash
- Run tests:
go test ./...
- Build the service:
./build.sh
- Start service:
go run cmd/server/main.go
Deployment
The service is containerized for easy deployment. The stack includes:
- API service
- PostgreSQL database
- Nuclei scanner service
- Background worker for scan processing
Deploy with:
docker-compose up -d
Contributing
Found a bug? Have a feature request? Contributions are welcome!
- Fork the repo
- Create your feature branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -m 'Add your feature') - Push to the branch (
git push origin feature/your-feature) - Open a Pull Request
Contact
- Website: danials.space
- Email: danial@danials.space
License
MIT License - see LICENSE for details.
Built with ❤️ by Danial | May 2025