This tool automates the process of generating, downloading, processing, and emailing reports. It is designed to work with YAML-based schedules, allows manual and automated workflows, and supports error handling with notifications.
-
Automated Workflow Execution:
- Executes workflows based on a YAML configuration file (
workflow_schedule.yaml
). - Cycles through groups sequentially.
- Executes workflows based on a YAML configuration file (
-
Manual Workflow Execution:
- Execute workflows manually for specific report IDs and recipients.
-
Report Generation:
- Triggers report generation for specified IDs.
-
Error Handling:
- Sends notifications to the workflow owner in case of failures.
-
Report Display:
- Lists available reports for manual review or validation.
project/
├── modules/
│ ├── download_reports.py # Handles downloading reports
│ ├── gen_solution_report.py # Processes solution reports
│ ├── gen_vuln_report.py # Processes vulnerability reports
│ ├── report_cleaner.py # Archives reports
│ ├── send_email.py # Sends emails with attachments
│ ├── force_gen_reports.py # Handles report generation and display
│ ├── workflow.py # Core workflow logic
├── logs/
│ ├── main.log # Logs for the main script
│ ├── workflow.log # Logs for workflow executions
│ ├── schedule_process.txt # Tracks progress in schedule execution
├── reports/ # Stores downloaded reports
├── workflow_schedule.yaml # Workflow schedule configuration
├── main.py # Entry point for the application
├── .env # Environment variables
├── README.md # Documentation
- Python: Version 3.8 or later.
- Dependencies: Install via
requirements.txt
:pip install -r requirements.txt
-
Clone the repository:
git clone <repository_url> cd project/
-
Create a
.env
file with the following variables:INSIGHTVM_HOST=https://<your_insightvm_host> USERNAME=<your_insightvm_username> PASSWORD=<your_insightvm_password> DOWNLOAD_PATH=./reports EMAIL_HOST=<your_email_host> EMAIL_PORT=587 EMAIL_HOST_USER=<your_email_user> EMAIL_HOST_PASSWORD=<your_email_password> EMAIL_DOMAIN=@yourcompany.com WORKFLOW_OWNER=[email protected]
-
Configure
workflow_schedule.yaml
:schedule_groups: first: - pair: [38, 39] receivers: ["user1"] cc: ["user2"] - pair: [42, 43] receivers: ["user3"] cc: ["user4"] second: - pair: [52, 53] receivers: ["user5"] cc: ["user6"]
Run the script using main.py
with the following options:
Execute workflows based on workflow_schedule.yaml
:
python3 main.py --auto
List available reports:
python3 main.py --show
Display all reports:
python3 main.py --show all
Manually execute a workflow for specific report IDs and a receiver email:
python3 main.py --check <report_id1> <report_id2> <receiver_email>
Example:
python3 main.py --check 38 39 [email protected]
Trigger report generation for specific report IDs:
python3 main.py --gen <report_id1> <report_id2>
Example:
python3 main.py --gen 38 39
Logs are stored in the logs/
directory:
main.log
: Logs for the main script.workflow.log
: Logs for workflow-related activities.
-
Automated Execution:
- Reads
workflow_schedule.yaml
to execute workflows for the current group. - Tracks progress in
logs/schedule_process.txt
to ensure sequential execution.
- Reads
-
Manual Execution:
- Allows specific workflows to be executed with
--check
and--gen
.
- Allows specific workflows to be executed with
-
Email Notifications:
- Sends processed reports via email to recipients in the schedule.
- Sends error notifications to
WORKFLOW_OWNER
on failures.