Skip to content

Automate VA process with Rapid7 InsightVM: Generate custom VA report and emaill to specific users via Outlook

Notifications You must be signed in to change notification settings

chickenit07/rapid7_va_workflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📄 README.md


Workflow Automation Tool

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.


Features

  1. Automated Workflow Execution:

    • Executes workflows based on a YAML configuration file (workflow_schedule.yaml).
    • Cycles through groups sequentially.
  2. Manual Workflow Execution:

    • Execute workflows manually for specific report IDs and recipients.
  3. Report Generation:

    • Triggers report generation for specified IDs.
  4. Error Handling:

    • Sends notifications to the workflow owner in case of failures.
  5. Report Display:

    • Lists available reports for manual review or validation.

Project Structure

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

Requirements

  1. Python: Version 3.8 or later.
  2. Dependencies: Install via requirements.txt:
    pip install -r requirements.txt

Setup

  1. Clone the repository:

    git clone <repository_url>
    cd project/
  2. 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]
  3. 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"]

Usage

Run the script using main.py with the following options:

1. Auto Execute Workflows

Execute workflows based on workflow_schedule.yaml:

python3 main.py --auto

2. Show Available Reports

List available reports:

python3 main.py --show

Display all reports:

python3 main.py --show all

3. Check Specific Reports

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]

4. Generate Reports

Trigger report generation for specific report IDs:

python3 main.py --gen <report_id1> <report_id2>

Example:

python3 main.py --gen 38 39

Logs

Logs are stored in the logs/ directory:

  • main.log: Logs for the main script.
  • workflow.log: Logs for workflow-related activities.

How It Works

  1. Automated Execution:

    • Reads workflow_schedule.yaml to execute workflows for the current group.
    • Tracks progress in logs/schedule_process.txt to ensure sequential execution.
  2. Manual Execution:

    • Allows specific workflows to be executed with --check and --gen.
  3. Email Notifications:

    • Sends processed reports via email to recipients in the schedule.
    • Sends error notifications to WORKFLOW_OWNER on failures.

About

Automate VA process with Rapid7 InsightVM: Generate custom VA report and emaill to specific users via Outlook

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages