diff --git a/util/compliance_report/readme.md b/util/compliance_report/readme.md index c55168fb72..8ad9bee98b 100644 --- a/util/compliance_report/readme.md +++ b/util/compliance_report/readme.md @@ -1,3 +1,70 @@ -# How to use it? +# ThreatScore Compliance Report Generator -python3 util/compliance_report/compliance_generator.py --scan-id 01975963-8db9-7d65-8422-aded62a0a7ad --compliance-id prowler_threatscore_azure --email --password +This tool generates a PDF compliance report using Prowler's API endpoints, summarizing compliance requirements, risk levels, and findings for a given scan and compliance framework. + +## Features +- Authenticates with the Prowler API using email and password +- Retrieves compliance requirements and attributes for a given scan and compliance framework +- Generates a visually rich PDF report, including: + - Compliance summary and description + - Compliance score by section (with charts) + - Critical failed requirements (with risk and weight) + - Detailed requirements and findings + +## Requirements +- Python 3.7+ +- Dependencies: `matplotlib`, `requests`, `reportlab` + +Install dependencies with: +```bash +pip install matplotlib requests reportlab +``` + +## Usage + +```bash +python3 util/compliance_report/threatscore_report_generator.py \ + --scan-id \ + --compliance-id \ + --email \ + --password \ + [--output ] \ + [--base-url ] \ + [--only-failed] \ + [--min-risk-level ] +``` + +### Arguments +- `--scan-id` (required): ID of the scan executed by Prowler. +- `--compliance-id` (required): Compliance framework ID (e.g., `prowler_threatscore_azure`, `nis2_azure`). +- `--email` (required): Email for API authentication. +- `--password` (required): Password for API authentication. +- `--output` (optional): Output PDF file path (default: `threatscore_report.pdf`). +- `--base-url` (optional): Base URL for the API (default: `http://localhost:8080`). +- `--only-failed` (optional): Only include failed requirements in the report. +- `--min-risk-level` (optional): Minimum risk level for critical failed requirements (default: 4). + +### Example +```bash +python3 util/compliance_report/threatscore_report_generator.py \ + --scan-id 12345678-1234-5678-1234-567812345678 \ + --compliance-id prowler_threatscore_azure \ + --email user@example.com \ + --password mypassword \ + --output my_report.pdf \ + --base-url http://localhost:8080 \ + --only-failed \ + --min-risk-level 4 +``` + +## Output +- The script will generate a PDF file with: + - Compliance framework summary + - Compliance score by section (with bar chart) + - Table of critical failed requirements (if any) + - Detailed breakdown of each requirement and its findings + +## Notes +- The script authenticates with the API and retrieves all necessary data automatically. +- If you encounter authentication errors, check your email, password, and API URL. +- For more details, see the script source: `util/compliance_report/threatscore_report_generator.py` diff --git a/util/compliance_report/compliance_generator.py b/util/compliance_report/threatscore_report_generator.py similarity index 99% rename from util/compliance_report/compliance_generator.py rename to util/compliance_report/threatscore_report_generator.py index 99cd99c760..d9dc002e58 100644 --- a/util/compliance_report/compliance_generator.py +++ b/util/compliance_report/threatscore_report_generator.py @@ -18,7 +18,7 @@ from reportlab.platypus import ( ) -def generate_compliance_report( +def generate_threatscore_report( scan_id: str, compliance_id: str, output_path: str, @@ -873,7 +873,7 @@ if __name__ == "__main__": ) args = parser.parse_args() - generate_compliance_report( + generate_threatscore_report( args.scan_id, args.compliance_id, args.output,