Reporting System
Relevant source files
The following files were used as context for generating this wiki page:
The Reporting System in OWASP Nettacker is a modular framework responsible for aggregating scan results and presenting them in various formats. It supports multiple export types, including HTML, JSON, CSV, and Text, to accommodate different auditing and integration requirements. The system is tightly integrated with the core engine and the SQLite/MySQL database to ensure persistence and historical tracking.
A key capability of the reporting system is "drift detection," which allows users to compare current scan results with historical data stored in the database. This enables security professionals to identify changes in the attack surface, such as new open ports, newly discovered hosts, or resolved vulnerabilities. Sources: README.md:43-46, nettacker/config.py:126-133
Architecture and Data Flow
The reporting system operates by capturing events generated during the scanning process and storing them in a central database before rendering them into the final output format.
The diagram above illustrates how scan data moves from the engine to the database and is subsequently processed into reports or served via the API. Sources: nettacker/api/engine.py:276-350, nettacker/web/static/js/main.js:705-750
Key Components
| Component | Description |
|---|---|
| Database Models | Stores report metadata and individual log events. |
| API Engine | Provides endpoints to retrieve, list, and search report data. |
| Web Static Assets | HTML and JS templates used to render reports in the browser. |
| Localization (i18n) | Provides translated strings for reports in multiple languages. |
Sources: nettacker/api/engine.py:46-52, nettacker/locale/en.yaml:45-55, nettacker/config.py:92-115
Report Generation Formats
Nettacker generates reports based on user-defined configurations. The default output is typically an HTML file with an auto-generated filename containing a timestamp and a random token.
Supported Output Types
- HTML: Interactive reports often including D3.js or other graph visualizations.
- JSON: Machine-readable format for integration with other tools or CI/CD pipelines.
- CSV: Tabular data for spreadsheet analysis.
- Text: Simplified output for CLI viewing.
Sources: nettacker/config.py:126-133, nettacker/api/engine.py:165-175
Report Naming Convention
By default, reports are saved in the .nettacker/data/results directory using the following pattern:
results_{date_time}_{random_chars}.html
Sources: nettacker/config.py:126-130, nettacker/config.py:90
Scan Comparison (Drift Detection)
The comparison system allows users to identify differences between two unique scan_id entries. This is exposed via the API and a specialized HTML template.
Comparison Logic
The system compares two datasets (Current Scan vs. Comparison Scan) to identify:
- New Targets Discovered: Entities found in the latest scan but not the previous one.
- Old Targets Not Detected: Entities that disappeared since the last scan.
- Result Changes: Variations in scan type or open ports for existing targets.
API Endpoints for Reporting
The API serves as the primary interface for the Web UI to interact with the reporting system.
| Endpoint | Method | Parameters | Description |
|---|---|---|---|
/results/get_list | GET | page | Returns a paginated list of all generated reports. |
/results/get | GET | id | Downloads the report file (HTML/TXT/JSON/CSV). |
/results/get_json | GET | id | Generates a JSON export for a specific scan ID on the fly. |
/logs/search | GET | q, page | Searches through individual event logs across all scans. |
/compare/scans | POST | scan_id_first, scan_id_second | Triggers the creation of a comparison report. |
Sources: nettacker/api/engine.py:276-285, nettacker/api/engine.py:293-313, nettacker/api/engine.py:461-480
Reporting Configuration
Reporting behavior is controlled through DefaultSettings in the configuration module.
# From nettacker/config.py
class DefaultSettings(ConfigBase):
graph_name = "d3_tree_v2_graph"
language = "en"
report_path_filename = "{results_path}/results_{date_time}_{random_chars}.html"
verbose_event = False
verbose_mode = False
Sources: nettacker/config.py:118-133
Users can override these settings via CLI flags or the Web UI. For example, setting the language configuration adjusts the labels in the report using YAML files found in nettacker/locale/. Sources: nettacker/locale/en.yaml:1-20, nettacker/web/static/index.html:160-165
Web UI Integration
The Web UI (accessible via index.html) provides a dashboard for viewing results. It uses main.js to asynchronously fetch scan data and render it using the renderjson library and D3.js for graphs. Sources: nettacker/web/static/index.html:30-45, nettacker/web/static/js/main.js:410-450
Result Filtering
The UI includes a crawler area that allows filtering results by host or module. It leverages the /logs/search API endpoint to provide real-time results as the user types. Sources: nettacker/web/static/js/main.js:630-650, nettacker/web/static/index.html:260-275
Conclusion
The OWASP Nettacker Reporting System provides a flexible and robust method for documenting security assessments. By utilizing a database-driven approach, it moves beyond static files to offer dynamic searching, paginated browsing, and automated drift detection, making it suitable for both ad-hoc scans and continuous monitoring environments.