https://github.com/dosx-dev/html-guard
Protect your web-application with Dynamic Style Loading and Real-Time Obfuscation. Easy to use!
https://github.com/dosx-dev/html-guard
application-security css drm easy-to-use framework guard html js module obfuscator protection react reactjs security static vuejs web website
Last synced: 10 months ago
JSON representation
Protect your web-application with Dynamic Style Loading and Real-Time Obfuscation. Easy to use!
- Host: GitHub
- URL: https://github.com/dosx-dev/html-guard
- Owner: DosX-dev
- Created: 2024-02-06T20:20:00.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-22T08:48:14.000Z (over 1 year ago)
- Last Synced: 2025-05-07T04:58:23.799Z (10 months ago)
- Topics: application-security, css, drm, easy-to-use, framework, guard, html, js, module, obfuscator, protection, react, reactjs, security, static, vuejs, web, website
- Language: JavaScript
- Homepage: https://dosx.su
- Size: 147 KB
- Stars: 58
- Watchers: 3
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
> [!NOTE]
> π 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!
# π’ HTML Guard
When you add the static module `html-guard.js` it will automatically obfuscate the page layout. Protect your web application/site.
βοΈπ __Makes it possible to use dynamic loading of resources using built-in functions, which prevents static downloading of styles and scripts.__
Briefly about the functions of HTML Guard:
* π‘ Obfuscation of HTML (auto)
* π‘π Dynamic adding of CSS/JS (requires setup)
* π‘π Protected attributes via prefix `_`
* π‘ Blocking DevTools in any browsers
* π‘ Lock the context menu
* π‘ Block dragging from a page
* π‘ Block text selection on a page
* π‘ Block console output

## π§ Add it to your site
```html
// Configure protection & resource loading
```
## β
Configure
### πβοΈπ΄ Safe style/script adding protection (recommended)
Avoid using ``. 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.
And 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.
```html
// ADDING: Add link to 'style.css'
HtmlGuard.loader.loadStyleByRef("styles.css");
```
```html
// ADDING: Add script "test.js" to head
HtmlGuard.loader.loadScriptBySrc("test.js");
// OR
// ADDING: Add script "test.js" to head after document loading
HtmlGuard.loader.loadScriptBySrc_ContentLoaded("test.js");
```
### ππΌπ΄ Dynamic attributes protection (recommended)
Add `_` prefix before any attribute so that, `src` becomes `_src`. HTML Guard will automatically load this element
This protection method has 2 advantages:
* Pictures and other resources will not be loaded through a static download of the site
* Without HTML Guard attributes will not load
For example:
```html
```
### πβ¨ Block Dev-Tools (recommended)
This function blocks any attempts to open developer tools and, if detected, reloads the page.
```html
// PROTECTION: Disable DevTools
HtmlGuard.protections.antiDevTools();
```
### π Disable context menu
Blocks the opening of the standard context menu.
```html
// PROTECTION: Disable context menu
HtmlGuard.protections.blockContextMenu();
```
### π Disable drag
The user will not be able to drag elements from the site.
```html
// PROTECTION: Disable drag
HtmlGuard.protections.blockDrag();
```
### π Disable selection
Removes the ability to use selection.
```html
// PROTECTION: Disable selection
HtmlGuard.protections.blockSelection();
```
### π Disable console output
This 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__
```html
// PROTECTION: Disable console output
HtmlGuard.protections.blockConsoleOutput();
```
## π Example of using
```html
// PROTECTION: Disable DevTools
HtmlGuard.protections.antiDevTools();
// PROTECTION: Disable context menu
HtmlGuard.protections.blockContextMenu();
// PROTECTION: Disable drag
HtmlGuard.protections.blockDrag();
// PROTECTION: Disable selection
HtmlGuard.protections.blockSelection();
// PROTECTION: Disable console output
HtmlGuard.protections.blockConsoleOutput();
// ADDING: Add link to 'style.css'
HtmlGuard.loader.loadStyleByRef("styles.css");
// ADDING: Run 'test.js' script
HtmlGuard.loader.loadScriptBySrc("test.js");
Hello, world! Time:
![]()
```
## π Note
This 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