{"id":27933379,"url":"https://github.com/dosx-dev/html-guard","last_synced_at":"2025-05-07T04:58:28.499Z","repository":{"id":221730158,"uuid":"753801007","full_name":"DosX-dev/HTML-Guard","owner":"DosX-dev","description":"Protect your web-application with Dynamic Style Loading and Real-Time Obfuscation. Easy to use!","archived":false,"fork":false,"pushed_at":"2024-08-22T08:48:14.000Z","size":151,"stargazers_count":58,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-07T04:58:23.799Z","etag":null,"topics":["application-security","css","drm","easy-to-use","framework","guard","html","js","module","obfuscator","protection","react","reactjs","security","static","vuejs","web","website"],"latest_commit_sha":null,"homepage":"https://dosx.su","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DosX-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-02-06T20:20:00.000Z","updated_at":"2025-05-01T04:47:03.000Z","dependencies_parsed_at":"2024-08-22T09:58:11.248Z","dependency_job_id":"efa51eaa-5513-4f23-be52-ff86e6523a1c","html_url":"https://github.com/DosX-dev/HTML-Guard","commit_stats":null,"previous_names":["dosx-dev/html-guard"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DosX-dev%2FHTML-Guard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DosX-dev%2FHTML-Guard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DosX-dev%2FHTML-Guard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DosX-dev%2FHTML-Guard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DosX-dev","download_url":"https://codeload.github.com/DosX-dev/HTML-Guard/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252816949,"owners_count":21808704,"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":["application-security","css","drm","easy-to-use","framework","guard","html","js","module","obfuscator","protection","react","reactjs","security","static","vuejs","web","website"],"created_at":"2025-05-07T04:58:27.881Z","updated_at":"2025-05-07T04:58:28.492Z","avatar_url":"https://github.com/DosX-dev.png","language":"JavaScript","readme":"\u003e [!NOTE]\n\u003e 🌟 Try the more advanced project **[WebSafeCompiler](https://github.com/DosX-dev/WebSafeCompiler)** for reliable protection of your site from copying or any analysis of the source code!\n\n# 🛢 HTML Guard\nWhen you add the static module `html-guard.js` it will automatically obfuscate the page layout. Protect your web application/site.\n\n⚙️📄 __Makes it possible to use dynamic loading of resources using built-in functions, which prevents static downloading of styles and scripts.__\n\nBriefly about the functions of HTML Guard:\n * 🛡 Obfuscation of HTML (auto)\n * 🛡🛠 Dynamic adding of CSS/JS (requires setup)\n * 🛡🛠 Protected attributes via prefix `_`\n * 🛡 Blocking DevTools in any browsers\n * 🛡 Lock the context menu\n * 🛡 Block dragging from a page\n * 🛡 Block text selection on a page\n * 🛡 Block console output\n\n![](screenshots/devtools.jpg)\n\n## 🔧 Add it to your site\n```html\n\u003c!DOCTYPE  html\u003e\n\u003chtml\u003e\n    \u003chead\u003e\n        \u003c!-- Site protection ON! --\u003e\n        \u003cscript src=\"html-guard.min.js\"\u003e\u003c/script\u003e\n        \u003cscript\u003e\n            // Configure protection \u0026 resource loading\n        \u003c/script\u003e\n    \u003c/head\u003e\n\n    \u003cbody\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n```\n\n## ✅ Configure\n\n### 🔒⚙️🔴 Safe style/script adding protection (recommended)\nAvoid using `\u003clink\u003e`. Dynamically load .css and .js files! This method makes it possible to bypass downloaders of sites such as [web2zip.com](https://web2zip.com/). Dynamic addition of site resources makes it impossible to copy them during static analysis.\nAnd in this case, when HTML Guard is removed from the dependencies, the contents of the web application will not be able to load for obvious reasons.\n\n```html\n\u003cscript\u003e\n    // ADDING: Add link to 'style.css'\n    HtmlGuard.loader.loadStyleByRef(\"styles.css\");\n\u003c/script\u003e\n```\n\n```html\n\u003cscript\u003e\n    // ADDING: Add script \"test.js\" to head\n    HtmlGuard.loader.loadScriptBySrc(\"test.js\");\n\n    //  OR\n\n    // ADDING: Add script \"test.js\" to head after document loading\n    HtmlGuard.loader.loadScriptBySrc_ContentLoaded(\"test.js\");\n\u003c/script\u003e\n```\n\n### 🔒🖼🔴 Dynamic attributes protection (recommended)\n\nAdd `_` prefix before any attribute so that, `src` becomes `_src`. HTML Guard will automatically load this element\n\nThis protection method has 2 advantages:\n * Pictures and other resources will not be loaded through a static download of the site\n * Without HTML Guard attributes will not load\n\nFor example:\n```html\n\u003cimg _src=\"image.jpg\" /\u003e\n```\n\n### 🔒✨ Block Dev-Tools (recommended)\nThis function blocks any attempts to open developer tools and, if detected, reloads the page.\n```html\n\u003cscript\u003e\n    // PROTECTION: Disable DevTools\n    HtmlGuard.protections.antiDevTools();\n\u003c/script\u003e\n```\n\n### 🔒 Disable context menu\nBlocks the opening of the standard context menu.\n```html\n\u003cscript\u003e\n    // PROTECTION: Disable context menu\n    HtmlGuard.protections.blockContextMenu();\n\u003c/script\u003e\n```\n\n### 🔒 Disable drag\nThe user will not be able to drag elements from the site.\n```html\n\u003cscript\u003e\n    // PROTECTION: Disable drag\n    HtmlGuard.protections.blockDrag();\n\u003c/script\u003e\n```\n\n### 🔒 Disable selection\nRemoves the ability to use selection.\n```html\n\u003cscript\u003e\n    // PROTECTION: Disable selection\n    HtmlGuard.protections.blockSelection();\n\u003c/script\u003e\n```\n\n### 🔒 Disable console output\nThis will be useful for hiding debug logs from the browser console. Hooks functions such as `log`, `debug`, `warn`, `error`, `dir`, `dirxml`, `assert`, `table` making them return __null__\n```html\n\u003cscript\u003e\n    // PROTECTION: Disable console output\n    HtmlGuard.protections.blockConsoleOutput();\n\u003c/script\u003e\n```\n\n## 📄 Example of using\n```html\n\u003chead\u003e\n\u003c!-- Example of HTML-Guard protection --\u003e\n\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\n\u003chead\u003e\n    \u003cscript src=\"../html-guard.js\"\u003e\u003c/script\u003e\n    \u003cscript\u003e\n        // PROTECTION: Disable DevTools\n        HtmlGuard.protections.antiDevTools();\n\n        // PROTECTION: Disable context menu\n        HtmlGuard.protections.blockContextMenu();\n\n        // PROTECTION: Disable drag\n        HtmlGuard.protections.blockDrag();\n\n        // PROTECTION: Disable selection\n        HtmlGuard.protections.blockSelection();\n\n        // PROTECTION: Disable console output\n        HtmlGuard.protections.blockConsoleOutput();\n\n        // ADDING: Add link to 'style.css'\n        HtmlGuard.loader.loadStyleByRef(\"styles.css\");\n\n        // ADDING: Run 'test.js' script\n        HtmlGuard.loader.loadScriptBySrc(\"test.js\");\n    \u003c/script\u003e\n\u003c/head\u003e\n\n\u003cbody\u003e\n    \u003cdiv\u003e\n        \u003c!-- '_id' is protected variant of 'id' --\u003e\n        \u003cp\u003eHello, world! Time: \u003cspan _id=\"time\"\u003e\u003c/span\u003e\u003c/p\u003e\n\n        \u003c!-- '_src' is protected variant of 'src' --\u003e\n        \u003cimg _src=\"test.jpg\" _alt=\"Test image\" /\u003e\n\n    \u003c/div\u003e\n\n    \u003ca _href=\"https://github.com/DosX-dev/HTML-Guard\"\u003eHTML Guard in GitHub!\u003c/a\u003e\n\n\u003c/body\u003e\n\n\u003c/html\u003e\n```\n\n## 📖 Note\nThis module is intended more for protecting web applications than for simple sites. If you are developing applications using frameworks like ReactJS, VueJS (and so on), then this project is perfect for you\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdosx-dev%2Fhtml-guard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdosx-dev%2Fhtml-guard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdosx-dev%2Fhtml-guard/lists"}