Overview
Scan4all provides a powerful and extensible scanning engine that allows you to create custom scan modules. The engine uses an event-driven architecture with a worker pool for efficient concurrent scanning.Engine Architecture
The scan4all engine is built on several core components:Engine Structure
The main engine object is defined inengine/engineImp.go:18:
Key Features
- Event-driven architecture: All scans are triggered through events
- Worker pool: Uses
antsfor efficient goroutine management (default: 5000 workers) - Concurrent execution: Each scan module runs independently
- Built-in deduplication: Prevents redundant scans of the same target
Creating a Custom Scan Module
Step 1: Register Your Scan Function
To create a custom scan module, you need to register it with the engine using the factory pattern:Step 2: Implement Your Scan Logic
Create your scanning function that processes the event data:Step 3: Trigger Additional Scans
You can trigger other scan modules as part of your scan flow:Available Scan Types
The following scan types are commonly used:ScanType_GoPoc- Go-based POC scanningScanType_Nmap- Nmap port scanningScanType_Masscan- Masscan port scanningScanType_WebScan- Web vulnerability scanning
Preventing Duplicate Scans
Use the built-in deduplication mechanism:Configuration and Options
Access global configuration options:Sending Results
There are multiple ways to send results:Basic Result Logging
Structured Result with Metadata
Best Practices
Use Worker Pools Efficiently
Use Worker Pools Efficiently
The engine manages a worker pool automatically. Avoid creating additional goroutines unnecessarily.
Implement Proper Error Handling
Implement Proper Error Handling
Always handle errors gracefully and log them appropriately:
Respect Rate Limits
Respect Rate Limits
Use the built-in rate limiting mechanisms:
Clean Resource Usage
Clean Resource Usage
Always clean up resources and handle context cancellation:
Example: Complete Custom Module
Here’s a complete example of a custom scan module:Next Steps
Custom POCs
Learn how to write custom Proof-of-Concept exploits
API Integration
Integrate scan4all into your applications