or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

check-management.mdcheck-models.mdcli-interface.mdconfiguration.mdfinding-management.mdindex.mdlogging-utilities.mdprovider-framework.md
tile.json

tessl/pypi-prowler

Open source cloud security assessment tool for AWS, Azure, GCP, and Kubernetes with hundreds of compliance checks.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/prowler@5.10.x

To install, run

npx @tessl/cli install tessl/pypi-prowler@5.10.0

index.mddocs/

Prowler

Prowler is an open-source cloud security assessment tool that performs comprehensive security audits across AWS, Azure, GCP, Kubernetes, GitHub, and Microsoft 365 environments. It provides hundreds of security checks aligned with industry compliance frameworks including CIS benchmarks, NIST, PCI-DSS, GDPR, HIPAA, and SOC2, enabling automated security assessments, continuous monitoring, and compliance validation for cloud infrastructures.

Package Information

  • Package Name: prowler
  • Language: Python
  • Installation: pip install prowler
  • Repository: https://github.com/prowler-cloud/prowler
  • Documentation: https://docs.prowler.cloud

Core Imports

import prowler

Main CLI entry point:

from prowler.__main__ import prowler

Core check execution:

from prowler.lib.check.check import execute_checks
from prowler.lib.check.checks_loader import load_checks_to_execute
from prowler.lib.check.models import CheckMetadata, Severity
from prowler.lib.outputs.finding import Finding

Provider management:

from prowler.providers.aws.aws_provider import AWSProvider
from prowler.providers.azure.azure_provider import AzureProvider
from prowler.providers.gcp.gcp_provider import GCPProvider
from prowler.providers.common.provider import Provider

Configuration and compliance:

from prowler.config.config import (
    prowler_version,
    get_available_compliance_frameworks,
    available_compliance_frameworks,
    available_output_formats,
    default_output_directory
)

Logging:

from prowler.lib.logger import logger, set_logging_config

Basic Usage

CLI Usage

from prowler.__main__ import prowler

# Run prowler CLI with arguments
import sys
sys.argv = ['prowler', 'aws', '--region', 'us-east-1']
prowler()

Programmatic Usage

from prowler.lib.check.check import execute_checks
from prowler.lib.check.checks_loader import load_checks_to_execute
from prowler.providers.aws.aws_provider import AWSProvider
from prowler.lib.outputs.finding import Finding

# Initialize AWS provider with authentication
provider = AWSProvider(
    profile="default",
    regions={"us-east-1", "us-west-2"},
    resource_tags=["Environment=production"]
)

# Load checks for execution
checks = load_checks_to_execute(provider, check_list=['iam_user_mfa_enabled'])

# Execute security checks
findings = execute_checks(checks, provider)

# Process findings
for finding in findings:
    if finding.status == 'FAIL':
        print(f"Failed check: {finding.metadata.CheckID}")
        print(f"Resource: {finding.resource_uid}")
        print(f"Description: {finding.metadata.Description}")

Provider Authentication Examples

from prowler.providers.aws.aws_provider import AWSProvider
from prowler.providers.azure.azure_provider import AzureProvider
from prowler.providers.gcp.gcp_provider import GCPProvider

# AWS with IAM role assumption
aws_provider = AWSProvider(
    role_arn="arn:aws:iam::123456789012:role/ProwlerRole",
    external_id="unique-external-id",
    regions={"us-east-1", "eu-west-1"}
)

# Azure with service principal
azure_provider = AzureProvider(
    client_id="12345678-1234-1234-1234-123456789012",
    client_secret="your-client-secret",
    tenant_id="87654321-4321-4321-4321-210987654321",
    subscription_ids=["sub-1", "sub-2"]
)

# GCP with service account
gcp_provider = GCPProvider(
    credentials_file="/path/to/service-account.json",
    project_ids=["project-1", "project-2"],
    organization_id="123456789012"
)

Architecture

Prowler follows a modular architecture organized around key components:

  • Providers: Cloud platform abstractions (AWS, Azure, GCP, Kubernetes, GitHub, M365) implementing a common Provider interface
  • Checks: Security assessment modules organized by service and compliance framework
  • Findings: Standardized result objects representing security check outcomes
  • Outputs: Multiple output formats (JSON, CSV, HTML, ASFF, OCSF) with compliance reporting
  • Compliance: Framework mappings linking checks to industry standards and regulations

This design enables Prowler to scale across multiple cloud platforms while maintaining consistent security assessment patterns and supporting extensive compliance reporting requirements.

Capabilities

CLI Interface and Main Entry Point

Main command-line interface providing comprehensive cloud security scanning with support for multiple providers, filtering options, compliance frameworks, and output formats.

def prowler():
    """
    Main CLI entry point that orchestrates the entire scanning process.
    Uses sys.argv for command-line argument parsing.
    
    Returns:
    None (exits with appropriate status code)
    """

CLI Interface

Check Management and Execution

Core functionality for loading, filtering, and executing security checks across cloud providers with support for custom checks, service filtering, and compliance framework mapping.

def execute_checks(checks: list, provider: Provider) -> list[Finding]:
    """
    Execute security checks and return findings.
    
    Parameters:
    - checks: List of check modules to execute
    - provider: Provider instance (AWS, Azure, GCP, etc.)
    
    Returns:
    List of Finding objects representing check results
    """

def load_checks_to_execute(provider: Provider, check_list: list = None, service_list: list = None) -> list:
    """
    Load checks based on provider and filtering criteria.
    
    Parameters:
    - provider: Provider instance
    - check_list: Optional list of specific checks to run
    - service_list: Optional list of services to include
    
    Returns:
    List of check modules to execute
    """

Check Management

Check Metadata and Models

Standardized data models for representing security check metadata, severity levels, remediation information, and compliance mappings using Pydantic for validation.

class CheckMetadata:
    """
    Pydantic model for check metadata.
    
    Attributes:
    - Provider: str - Provider type (aws, azure, gcp, etc.)
    - CheckID: str - Unique check identifier
    - CheckTitle: str - Human-readable check name
    - CheckType: list[str] - Check categories
    - ServiceName: str - Cloud service name
    - SubServiceName: str - Sub-service name
    - Severity: Severity - Severity level enum
    - ResourceType: str - Resource type being checked
    - Description: str - Check description
    - Risk: str - Risk description
    - Remediation: Remediation - Remediation information
    """

class Severity(Enum):
    """Severity level enumeration."""
    critical = "critical"
    high = "high"
    medium = "medium"  
    low = "low"
    informational = "informational"

Check Models

Finding Management and Output

Comprehensive finding representation and output generation supporting multiple formats (JSON, CSV, HTML, ASFF, OCSF) with compliance reporting and integration capabilities.

class Finding:
    """
    Pydantic model representing a security finding.
    
    Attributes:
    - auth_method: str - Authentication method used
    - timestamp: datetime - Finding timestamp
    - account_uid: str - Account unique identifier
    - metadata: CheckMetadata - Check metadata
    - status: Status - Finding status (PASS/FAIL/MANUAL)
    - resource_uid: str - Resource unique identifier
    - region: str - Cloud region
    - compliance: dict - Compliance framework mappings
    """

def generate_output(findings: list[Finding], output_format: str, output_directory: str):
    """
    Generate output in specified format.
    
    Parameters:
    - findings: List of Finding objects
    - output_format: Output format (json, csv, html, asff, ocsf)
    - output_directory: Directory for output files
    
    Returns:
    None (writes files to output directory)
    """

Finding Management

Provider Framework

Multi-cloud provider abstraction supporting AWS, Azure, GCP, Kubernetes, GitHub, and Microsoft 365 with standardized authentication, session management, and credential handling.

class Provider:
    """
    Abstract base class for all cloud providers.
    
    Properties:
    - type: str - Provider type identifier
    - identity: dict - Provider identity information
    - session: object - Provider session object
    - audit_config: dict - Audit configuration
    
    Methods:
    - setup_session(): Abstract method to setup provider session
    - print_credentials(): Abstract method to print credential info
    - validate_arguments(): Abstract method to validate provider arguments
    """

class AWSProvider(Provider):
    """AWS provider implementation."""

class AzureProvider(Provider):
    """Azure provider implementation."""

class GCPProvider(Provider):
    """GCP provider implementation."""

Provider Framework

Configuration and Compliance

Configuration management and compliance framework support with mappings to industry standards including CIS benchmarks, NIST, ISO 27001, PCI-DSS, and custom frameworks.

prowler_version: str = "5.10.2"
available_compliance_frameworks: list[str]
available_output_formats: list[str]
default_output_directory: str

def get_available_compliance_frameworks(provider: str = None) -> list[str]:
    """
    Get available compliance frameworks for a provider.
    
    Parameters:
    - provider: Optional provider name to filter frameworks
    
    Returns:
    List of available compliance framework names
    """

def check_current_version() -> dict:
    """
    Check for newer Prowler versions.
    
    Returns:
    Dictionary with version information and update availability
    """

Configuration

Logging and Utilities

Logging configuration, utility functions, and helper methods for string manipulation, data processing, and common operations across the Prowler ecosystem.

def set_logging_config(log_level: str, log_file: str = None, only_logs: bool = False):
    """
    Configure logging for Prowler.
    
    Parameters:
    - log_level: Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
    - log_file: Optional log file path
    - only_logs: Whether to suppress banner and only show logs
    
    Returns:
    None
    """

logger: Logger  # Global logger instance
logging_levels: dict[str, int]  # Mapping of level names to constants

Logging and Utilities

Types

from enum import Enum
from typing import Optional, List, Dict, Any
from pydantic import BaseModel
from datetime import datetime

class Status(Enum):
    """Finding status enumeration."""
    PASS = "PASS"
    FAIL = "FAIL"
    MANUAL = "MANUAL"

class Provider(Enum):
    """Supported provider enumeration."""
    aws = "aws"
    azure = "azure"
    gcp = "gcp"
    kubernetes = "kubernetes"
    github = "github"
    m365 = "m365"
    nhn = "nhn"
    iac = "iac"

class Code(BaseModel):
    """Remediation code model."""
    NativeIaC: Optional[str] = None
    Terraform: Optional[str] = None
    CLI: Optional[str] = None
    Other: Optional[str] = None

class Recommendation(BaseModel):
    """Recommendation model."""
    Text: str
    Url: Optional[str] = None

class Remediation(BaseModel):
    """Remediation information model."""
    Code: Optional[Code] = None
    Recommendation: Recommendation