from bbot.modules.templates.bucket import bucket_template
from bbot.core.config.models import BaseModuleConfig, Field


class bucket_amazon(bucket_template):
    watched_events = ["DNS_NAME", "STORAGE_BUCKET"]
    produced_events = ["STORAGE_BUCKET", "FINDING"]
    flags = ["safe", "active", "cloud-enum", "web"]
    meta = {
        "description": "Check for S3 buckets related to target",
        "created_date": "2022-11-04",
        "author": "@TheTechromancer",
    }

    class Config(BaseModuleConfig):
        permutations: bool = Field(False, description="Whether to try permutations")

    scope_distance_modifier = 3

    cloudcheck_provider_name = "Amazon"
    delimiters = ("", ".", "-")
    base_domains = ["s3.amazonaws.com"]
    regions = [None]
    supports_open_check = True
